Skip to content

Add OBJECT command to ensure compat with dbeaver/jedis/etc.#1925

Draft
badrishc wants to merge 1 commit into
mainfrom
badrishc/object-command
Draft

Add OBJECT command to ensure compat with dbeaver/jedis/etc.#1925
badrishc wants to merge 1 commit into
mainfrom
badrishc/object-command

Conversation

@badrishc

Copy link
Copy Markdown
Collaborator

Implements the OBJECT command, which was previously unsupported and returned "-ERR unknown command". This broke RESP GUI clients such as DBeaver, whose key browser issues OBJECT ENCODING <key> per key (discussion #1909).

OBJECT ENCODING reports the following:

  • string -> raw (stored as raw bytes)
  • hash, set -> hashtable (Dictionary / HashSet)
  • list -> quicklist
  • sorted set -> skiplist (closest match to Garnet's red-black-tree + dict)

REFCOUNT returns 1 (no shared objects), IDLETIME returns 0 (no LRU idle tracking), FREQ returns the LFU-not-selected error, and a missing key returns nil. OBJECT read-subcommands carry key specs so cluster slot verification and transaction key locking work.

Adds command info/docs metadata, ACL coverage tests, and functional tests.

@badrishc badrishc marked this pull request as ready for review July 10, 2026 19:52
Copilot AI review requested due to automatic review settings July 10, 2026 19:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for the Redis-compatible OBJECT command (with subcommands) to improve interoperability with RESP clients that probe key internals (e.g., OBJECT ENCODING <key>), and wires it through command parsing, dispatch, unified-store reads, metadata/docs, ACL coverage, and tests.

Changes:

  • Implement OBJECT subcommands (ENCODING, REFCOUNT, IDLETIME, FREQ) via unified-store read paths, plus OBJECT HELP on the network layer.
  • Register OBJECT in the parser’s primary/subcommand lookup tables and server dispatch, and add API surface (IGarnetApi + unified API impl).
  • Update command metadata/docs resources and add standalone + ACL test coverage for the new command family.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
website/docs/commands/api-compatibility.md Marks OBJECT subcommands as supported and documents behavior.
test/standalone/Garnet.test/RespObjectCommandTests.cs New functional tests for OBJECT subcommands and RESP-wire output.
test/standalone/Garnet.test.acl/Resp/ACL/RespCommandTests.cs Adds ACL coverage tests for OBJECT subcommands and updates “only-subcommand” list.
playground/CommandInfoUpdater/SupportedCommand.cs Adds OBJECT (and subcommands) to the updater’s supported command map.
playground/CommandInfoUpdater/GarnetCommandsInfo.json Adds missing Name fields for RI commands in the updater input.
playground/CommandInfoUpdater/GarnetCommandsDocs.json Adds OBJECT docs entry and fills missing Name fields for RI docs entries in the updater input.
playground/CommandInfoUpdater/CommonUtils.cs Improves ignore-list handling when computing commands/subcommands to remove.
libs/server/Storage/Functions/UnifiedStore/ReadMethods.cs Implements unified-store read handlers for OBJECT subcommands.
libs/server/Resp/RespServerSession.cs Routes OBJECT_* commands to network handlers.
libs/server/Resp/RespCommandDataProvider.cs Adds validation when importing command info/docs JSON.
libs/server/Resp/Parser/RespCommandHashLookupData.cs Registers OBJECT as a parent command + defines subcommand table entries.
libs/server/Resp/Parser/RespCommandHashLookup.cs Builds/validates the OBJECT subcommand hash table and enables lookup routing.
libs/server/Resp/Parser/RespCommand.cs Adds new RespCommand enum values for OBJECT parent/subcommands.
libs/server/Resp/CmdStrings.cs Adds OBJECT ENCODING result strings and an OBJECT FREQ error string constant.
libs/server/Resp/BasicCommands.cs Implements network handlers for OBJECT read subcommands and OBJECT HELP.
libs/server/API/IGarnetApi.cs Adds the OBJECT API method signature.
libs/server/API/GarnetApiUnifiedCommands.cs Implements OBJECT API via unified-store read.
libs/resources/RespCommandsInfo.json Adds OBJECT command info + key specs for read subcommands.
libs/resources/RespCommandsDocs.json Adds OBJECT command docs + subcommand docs.

Comment thread libs/server/Resp/CmdStrings.cs Outdated
Comment thread libs/server/Resp/RespCommandDataProvider.cs Outdated
Comment thread website/docs/commands/api-compatibility.md Outdated
@badrishc badrishc force-pushed the badrishc/object-command branch 2 times, most recently from 50e6bf0 to 6c10d68 Compare July 10, 2026 20:25
@badrishc badrishc requested a review from Copilot July 10, 2026 20:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 11 comments.

Comment thread libs/server/Storage/Functions/UnifiedStore/ReadMethods.cs Outdated
Comment thread libs/server/Resp/BasicCommands.cs Outdated
Comment thread libs/server/Resp/BasicCommands.cs Outdated
Comment thread libs/server/Resp/BasicCommands.cs Outdated
Comment thread website/docs/commands/api-compatibility.md Outdated
Comment thread playground/CommandInfoUpdater/GarnetCommandsDocs.json
Comment thread playground/CommandInfoUpdater/GarnetCommandsDocs.json
Comment thread libs/resources/RespCommandsDocs.json
Comment thread libs/resources/RespCommandsDocs.json
Comment thread libs/resources/RespCommandsDocs.json
@badrishc badrishc force-pushed the badrishc/object-command branch 7 times, most recently from aa81e29 to bcbadf0 Compare July 10, 2026 23:06
Implements the OBJECT command, which was previously unsupported and returned
"-ERR unknown command". This broke RESP GUI clients such as DBeaver, whose key
browser issues `OBJECT ENCODING <key>` per key (discussion #1909).

OBJECT ENCODING reports Garnet's actual internal representation rather than
emulating the size-based encodings Garnet does not use (listpack/intset/
quicklist):
- string     -> raw       (stored as raw bytes; no native int/embstr encoding)
- hash, set  -> hashtable  (Dictionary / HashSet)
- list       -> quicklist  (LinkedList; the linkedlist encoding is obsolete)
- sorted set -> skiplist   (ordered index + dict)

REFCOUNT returns 1 (no shared objects), IDLETIME returns 0 (no LRU idle
tracking), FREQ returns an unsupported error (Garnet does not track access
frequency), and a missing key returns nil. OBJECT read-subcommands carry key
specs so cluster slot verification and transaction key locking work.

Command info/docs metadata is regenerated with the CommandInfoUpdater tool,
which required three fixes:
- the add/remove computation now honors the --ignore list when removing
  commands (it previously honored it only when adding, so ignored commands were
  still deleted);
- the JSON exporter uses relaxed encoding so it emits literal characters
  instead of \uXXXX escapes; and
- command-data import reports a clear error instead of crashing on an entry
  with a missing or duplicate Name.
Also adds the missing Name fields to the RI.GET/RI.RANGE (info) and
RI.DEL/RI.GET/RI.RANGE (docs) entries. Regenerating normalizes the flag/ACL
value ordering of a few pre-existing entries.

Adds a README for the CommandInfoUpdater tool documenting its inputs, the
baseline RESP server, and how to run it, and updates the add-garnet-command
skill to reference it and to document the per-sub-command override merge.

Registers the vector-set commands (VADD..VSIM) and the internal
CLUSTER|RESERVE sub-command in the tool's SupportedCommand.cs and Garnet
override files. These were present in the generated resources but missing
from the tool's supported-command list, so a regeneration needed an --ignore
list to avoid deleting them. They are now first-class tool-managed commands
(verified: the override files reproduce their resource entries byte-for-byte),
so the --ignore flag is no longer needed for a normal regeneration.

Fixes the CommandInfoUpdater tool's --force regeneration, which aborted against
Valkey 8.x: Valkey renamed the "skip_slowlog" command flag to "skip_commandlog",
a name the info parser did not recognize. Adds a parse-only description-alias
mechanism to EnumUtils (new EnumDescriptionAlias attribute) and tags the
SkipSlowLog flag with the new wire name; the flag's serialized description is
unchanged. --force now completes end-to-end (an internal sub-command such as
CLUSTER|RESERVE may change position, which is expected for a full regeneration).

Audits and hardens the CommandInfoUpdater tool: adds a -y/--yes flag to
auto-confirm prompts for non-interactive/scripted runs (it otherwise requires
an interactive Console.ReadKey); makes the command-info parser skip-and-warn on
unrecognized command flags / ACL categories instead of aborting the whole run;
and switches parsed command-name casing to ToUpperInvariant.

Closes override drift so tool --force regeneration is lossless: adds the
internal CLUSTER|ADVANCE_TIME entry to GarnetCommandsInfo.json (it was in the
resources but not the override, so --force dropped it), reconciles
CLUSTER|MLOG_KEY_TIME's info override with the resources (public + ReadOnly, not
internal) and adds its docs override entry. --force now drops no commands; the
only remaining --force deltas versus the checked-in resources are the baseline
server's own metadata and sub-command ordering.

Places the CLUSTER sub-commands into their canonical (tool-sorted) positions in
the generated RespCommandsInfo.json / RespCommandsDocs.json. Several internal
sub-commands had been appended out of order by past incremental runs; this is a
pure reordering (no field changes), so a future --force no longer reshuffles them.

Adds ACL coverage tests and functional tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7393fecb-938a-4a1f-9b14-296b48544fc9

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.

Comment thread playground/CommandInfoUpdater/SupportedCommand.cs
@badrishc badrishc marked this pull request as draft July 11, 2026 01:09
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.

2 participants