Add OBJECT command to ensure compat with dbeaver/jedis/etc.#1925
Draft
badrishc wants to merge 1 commit into
Draft
Add OBJECT command to ensure compat with dbeaver/jedis/etc.#1925badrishc wants to merge 1 commit into
badrishc wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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
OBJECTsubcommands (ENCODING,REFCOUNT,IDLETIME,FREQ) via unified-store read paths, plusOBJECT HELPon the network layer. - Register
OBJECTin 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. |
50e6bf0 to
6c10d68
Compare
aa81e29 to
bcbadf0
Compare
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
bcbadf0 to
92578d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.