summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2022-01-11 17:16:16 +0200
committerGitHub <noreply@github.com>2022-01-11 17:16:16 +0200
commit3204a03574475d1b852d839c197f07aaaf56b86d (patch)
tree6b5f9df0862ecbc8f83c9ec2681e15fd7dd445e8 /src/commands
parent5009b43dc658b306014d1a4f58a7e31a454df281 (diff)
downloadredis-3204a03574475d1b852d839c197f07aaaf56b86d.tar.gz
Move doc metadata from COMMAND to COMMAND DOCS (#10056)
Syntax: `COMMAND DOCS [<command name> ...]` Background: Apparently old version of hiredis (and thus also redis-cli) can't support more than 7 levels of multi-bulk nesting. The solution is to move all the doc related metadata from COMMAND to a new COMMAND DOCS sub-command. The new DOCS sub-command returns a map of commands (not an array like in COMMAND), And the same goes for the `subcommands` field inside it (also contains a map) Besides that, the remaining new fields of COMMAND (hints, key-specs, and sub-commands), are placed in the outer array rather than a nested map. this was done mainly for consistency with the old format. Other changes: --- * Allow COMMAND INFO with no arguments, which returns all commands, so that we can some day deprecated the plain COMMAND (no args) * Reduce the amount of deferred replies from both COMMAND and COMMAND DOCS, especially in the inner loops, since these create many small reply objects, which lead to many small write syscalls and many small TCP packets. To make this easier, when populating the command table, we count the history, args, and hints so we later know their size in advance. Additionally, the movablekeys flag was moved into the flags register. * Update generate-commands-json.py to take the data from both command, it now executes redis-cli directly, instead of taking input from stdin. * Sub-commands in both COMMAND (and COMMAND INFO), and also COMMAND DOCS, show their full name. i.e. CONFIG * GET will be shown as `config|get` rather than just `get`. This will be visible both when asking for `COMMAND INFO config` and COMMAND INFO config|get`, but is especially important for the later. i.e. imagine someone doing `COMMAND INFO slowlog|get config|get` not being able to distinguish between the two items in the array response.
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/command-docs.json26
-rw-r--r--src/commands/command-info.json13
2 files changed, 36 insertions, 3 deletions
diff --git a/src/commands/command-docs.json b/src/commands/command-docs.json
new file mode 100644
index 000000000..9d2e20566
--- /dev/null
+++ b/src/commands/command-docs.json
@@ -0,0 +1,26 @@
+{
+ "DOCS": {
+ "summary": "Get array of specific Redis command documentation",
+ "complexity": "O(N) where N is the number of commands to look up",
+ "group": "server",
+ "since": "7.0.0",
+ "arity": -2,
+ "container": "COMMAND",
+ "function": "commandDocsCommand",
+ "command_flags": [
+ "LOADING",
+ "STALE"
+ ],
+ "acl_categories": [
+ "CONNECTION"
+ ],
+ "arguments": [
+ {
+ "name": "command-name",
+ "type": "string",
+ "optional": true,
+ "multiple": true
+ }
+ ]
+ }
+}
diff --git a/src/commands/command-info.json b/src/commands/command-info.json
index 7e88bc6b1..9291f8912 100644
--- a/src/commands/command-info.json
+++ b/src/commands/command-info.json
@@ -1,12 +1,18 @@
{
"INFO": {
- "summary": "Get array of specific Redis command details",
- "complexity": "O(N) when N is number of commands to look up",
+ "summary": "Get array of specific Redis command details, or all when no argument is given.",
+ "complexity": "O(N) where N is the number of commands to look up",
"group": "server",
"since": "2.8.13",
- "arity": -3,
+ "arity": -2,
"container": "COMMAND",
"function": "commandInfoCommand",
+ "history": [
+ [
+ "7.0.0",
+ "Allowed to be called with no argument to get info on all commands."
+ ]
+ ],
"command_flags": [
"LOADING",
"STALE"
@@ -18,6 +24,7 @@
{
"name": "command-name",
"type": "string",
+ "optional": true,
"multiple": true
}
]