Skip to content

Add Redis-compatible HSETEX format with backward compatibility#6624

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/fix-hsetex-command-incompatibility
Draft

Add Redis-compatible HSETEX format with backward compatibility#6624
Copilot wants to merge 1 commit intomainfrom
copilot/fix-hsetex-command-incompatibility

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 14, 2026

HSETEX was implemented in Dragonfly before Redis standardized it, resulting in incompatible formats. This adds support for Redis format while maintaining backward compatibility with existing Dragonfly usage.

Changes

Format detection: Automatically detects format by checking for FIELDS keyword presence

  • Dragonfly: HSETEX key [NX] [KEEPTTL] ttl_sec field value [field value ...]
  • Redis: HSETEX key [FNX|FXX] [EX|PX|EXAT|PXAT|KEEPTTL] FIELDS numfields field value [...]

Redis-specific features:

  • FNX/FXX: Set only if field doesn't exist / only if exists
  • EX/PX: Expiration in seconds / milliseconds
  • EXAT/PXAT: Absolute Unix timestamp in seconds / milliseconds
  • FIELDS numfields: Explicit field count validation

Implementation:

  • Extended OpSetParams with skip_if_not_exists flag for FXX support
  • Modified OpSet to handle FXX by checking field existence before update
  • Listpack converts to StringMap when FXX or TTL is used

Example:

// Both formats work seamlessly
HSETEX key 10 f1 v1              // Dragonfly format
HSETEX key EX 10 FIELDS 1 f1 v1  // Redis format

Testing: Added 11 test cases covering all Redis format options, backward compatibility, and error handling. All 43 existing tests pass.

Original prompt

This section details on the original issue you should resolve

<issue_title>Fix incompatibility for HSETEX command</issue_title>
<issue_description>HSETEX was implemented in Dragonfly before it was added to Redis, so we have a completely different layout.
We can support our format and Redis format simultaneously, because Redis uses tags like KEEPTTL, FIELDS, EXAT etc, but we don't. If such tags exist in the command format, we can understand that it is Redis approach.
I think we should proceed to support our format too, because I saw reports with bugs from some users regarding this functionality.</issue_description>

<agent_instructions>support all parameters that Redis supports, also add a couple of tests</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix incompatibility for HSETEX command Add Redis-compatible HSETEX format with backward compatibility Feb 14, 2026
Copilot AI requested a review from BorysTheDev February 14, 2026 15:56
@BorysTheDev BorysTheDev force-pushed the copilot/fix-hsetex-command-incompatibility branch from 318f374 to 895b873 Compare February 16, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix incompatibility for HSETEX command

2 participants