Unverified Commit 10bbeb68 authored by guybe7's avatar guybe7 Committed by GitHub
Browse files

Add command tips to COMMAND DOCS (#10104)

Adding command tips (see https://redis.io/topics/command-tips) to commands.

Breaking changes:
1. Removed the "random" and "sort_for_script" flags. They are now command tips.
(this isn't affecting redis behavior since #9812, but could affect some client applications
that's relying on COMMAND command flags)

Summary of changes:
1. add BLOCKING flag (new flag) for all commands that could block. The ACL category with
  the same name is now implicit.
2. move RANDOM flag to a `nondeterministic_output` tip
3. move SORT_FOR_SCRIPT flag to `nondeterministic_output_order` tip
3. add REQUEST_POLICY and RESPONSE_POLICY where appropriate as documented in the tips
4. deprecate (ignore) the `random` flag for RM_CreateCommand

Other notes:
1. Proxies need to send `RANDOMKEY` to all shards and then select one key randomly.
  The other option is to pick a random shard and transfer `RANDOMKEY `to it, but that scheme
  fails if this specific shard is empty
2. Remove CMD_RANDOM from `XACK` (i.e. XACK does not have RANDOM_OUTPUT)
   It was added in 9e4fb96c, I guess by mistake.
   Also from `(P)EXPIRETIME` (new command, was flagged "random" by mistake).
3. Add `nondeterministic_output` to `OBJECT ENCODING` (for the same reason `XTRIM` has it:
   the reply may differ depending on the internal representation in memory)
4. RANDOM on `HGETALL` was wrong (there due to a limitation of the old script sorting logic), now
  it's `nondeterministic_output_order`
5. Unrelated: Hide CMD_PROTECTED from COMMAND
parent 9c602922
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
"arity": 2, "arity": 2,
"function": "dumpCommand", "function": "dumpCommand",
"command_flags": [ "command_flags": [
"READONLY", "READONLY"
"RANDOM"
], ],
"acl_categories": [ "acl_categories": [
"KEYSPACE" "KEYSPACE"
], ],
"command_tips": [
"NONDETERMINISTIC_OUTPUT"
],
"key_specs": [ "key_specs": [
{ {
"flags": [ "flags": [
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
"acl_categories": [ "acl_categories": [
"KEYSPACE" "KEYSPACE"
], ],
"command_tips": [
"REQUEST_POLICY:MULTI_SHARD",
"RESPONSE_POLICY:AGG_SUM"
],
"key_specs": [ "key_specs": [
{ {
"flags": [ "flags": [
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
"function": "expiretimeCommand", "function": "expiretimeCommand",
"command_flags": [ "command_flags": [
"READONLY", "READONLY",
"RANDOM",
"FAST" "FAST"
], ],
"acl_categories": [ "acl_categories": [
......
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
"KEYSPACE", "KEYSPACE",
"DANGEROUS" "DANGEROUS"
], ],
"command_tips": [
"REQUEST_POLICY:ALL_SHARDS",
"RESPONSE_POLICY:ALL_SUCCEEDED"
],
"arguments": [ "arguments": [
{ {
"name": "async", "name": "async",
......
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
"KEYSPACE", "KEYSPACE",
"DANGEROUS" "DANGEROUS"
], ],
"command_tips": [
"REQUEST_POLICY:ALL_SHARDS",
"RESPONSE_POLICY:ALL_SUCCEEDED"
],
"arguments": [ "arguments": [
{ {
"name": "async", "name": "async",
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
"acl_categories": [ "acl_categories": [
"SCRIPTING" "SCRIPTING"
], ],
"command_tips": [
"REQUEST_POLICY:ALL_SHARDS",
"RESPONSE_POLICY:ALL_SUCCEEDED"
],
"arguments": [ "arguments": [
{ {
"name": "function-name", "name": "function-name",
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
"acl_categories": [ "acl_categories": [
"SCRIPTING" "SCRIPTING"
], ],
"command_tips": [
"REQUEST_POLICY:ALL_SHARDS",
"RESPONSE_POLICY:ALL_SUCCEEDED"
],
"arguments": [ "arguments": [
{ {
"name": "async", "name": "async",
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
], ],
"acl_categories": [ "acl_categories": [
"SCRIPTING" "SCRIPTING"
],
"command_tips": [
"REQUEST_POLICY:ALL_SHARDS",
"RESPONSE_POLICY:ONE_SUCCEEDED"
] ]
} }
} }
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
"acl_categories": [ "acl_categories": [
"SCRIPTING" "SCRIPTING"
], ],
"command_tips": [
"REQUEST_POLICY:ALL_SHARDS",
"RESPONSE_POLICY:ALL_SUCCEEDED"
],
"arguments": [ "arguments": [
{ {
"name": "engine-name", "name": "engine-name",
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
"acl_categories": [ "acl_categories": [
"SCRIPTING" "SCRIPTING"
], ],
"command_tips": [
"REQUEST_POLICY:ALL_SHARDS",
"RESPONSE_POLICY:ALL_SUCCEEDED"
],
"arguments": [ "arguments": [
{ {
"name": "serialized-value", "name": "serialized-value",
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
], ],
"acl_categories": [ "acl_categories": [
"SCRIPTING" "SCRIPTING"
],
"command_tips": [
"REQUEST_POLICY:ALL_SHARDS",
"RESPONSE_POLICY:ONE_SUCCEEDED"
] ]
} }
} }
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
"arity": 2, "arity": 2,
"function": "hgetallCommand", "function": "hgetallCommand",
"command_flags": [ "command_flags": [
"READONLY", "READONLY"
"RANDOM"
], ],
"acl_categories": [ "acl_categories": [
"HASH" "HASH"
], ],
"command_tips": [
"NONDETERMINISTIC_OUTPUT_ORDER"
],
"key_specs": [ "key_specs": [
{ {
"flags": [ "flags": [
......
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
"arity": 2, "arity": 2,
"function": "hkeysCommand", "function": "hkeysCommand",
"command_flags": [ "command_flags": [
"READONLY", "READONLY"
"SORT_FOR_SCRIPT"
], ],
"acl_categories": [ "acl_categories": [
"HASH" "HASH"
], ],
"command_tips": [
"NONDETERMINISTIC_OUTPUT_ORDER"
],
"key_specs": [ "key_specs": [
{ {
"flags": [ "flags": [
......
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
"arity": -2, "arity": -2,
"function": "hrandfieldCommand", "function": "hrandfieldCommand",
"command_flags": [ "command_flags": [
"READONLY", "READONLY"
"RANDOM"
], ],
"acl_categories": [ "acl_categories": [
"HASH" "HASH"
], ],
"command_tips": [
"NONDETERMINISTIC_OUTPUT"
],
"key_specs": [ "key_specs": [
{ {
"flags": [ "flags": [
......
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
"arity": -3, "arity": -3,
"function": "hscanCommand", "function": "hscanCommand",
"command_flags": [ "command_flags": [
"READONLY", "READONLY"
"RANDOM"
], ],
"acl_categories": [ "acl_categories": [
"HASH" "HASH"
], ],
"command_tips": [
"NONDETERMINISTIC_OUTPUT"
],
"key_specs": [ "key_specs": [
{ {
"flags": [ "flags": [
......
...@@ -7,12 +7,14 @@ ...@@ -7,12 +7,14 @@
"arity": 2, "arity": 2,
"function": "hvalsCommand", "function": "hvalsCommand",
"command_flags": [ "command_flags": [
"READONLY", "READONLY"
"SORT_FOR_SCRIPT"
], ],
"acl_categories": [ "acl_categories": [
"HASH" "HASH"
], ],
"command_tips": [
"NONDETERMINISTIC_OUTPUT_ORDER"
],
"key_specs": [ "key_specs": [
{ {
"flags": [ "flags": [
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
"arity": -1, "arity": -1,
"function": "infoCommand", "function": "infoCommand",
"command_flags": [ "command_flags": [
"RANDOM",
"LOADING", "LOADING",
"STALE", "STALE",
"SENTINEL" "SENTINEL"
...@@ -15,6 +14,11 @@ ...@@ -15,6 +14,11 @@
"acl_categories": [ "acl_categories": [
"DANGEROUS" "DANGEROUS"
], ],
"command_tips": [
"NONDETERMINISTIC_OUTPUT",
"REQUEST_POLICY:ALL_SHARDS",
"RESPONSE_POLICY:SPECIAL"
],
"arguments": [ "arguments": [
{ {
"name": "section", "name": "section",
......
...@@ -7,13 +7,16 @@ ...@@ -7,13 +7,16 @@
"arity": 2, "arity": 2,
"function": "keysCommand", "function": "keysCommand",
"command_flags": [ "command_flags": [
"READONLY", "READONLY"
"SORT_FOR_SCRIPT"
], ],
"acl_categories": [ "acl_categories": [
"KEYSPACE", "KEYSPACE",
"DANGEROUS" "DANGEROUS"
], ],
"command_tips": [
"REQUEST_POLICY:ALL_SHARDS",
"NONDETERMINISTIC_OUTPUT_ORDER"
],
"arguments": [ "arguments": [
{ {
"name": "pattern", "name": "pattern",
......
...@@ -7,11 +7,13 @@ ...@@ -7,11 +7,13 @@
"arity": 1, "arity": 1,
"function": "lastsaveCommand", "function": "lastsaveCommand",
"command_flags": [ "command_flags": [
"RANDOM",
"LOADING", "LOADING",
"STALE", "STALE",
"FAST" "FAST"
], ],
"command_tips": [
"NONDETERMINISTIC_OUTPUT"
],
"acl_categories": [ "acl_categories": [
"ADMIN", "ADMIN",
"DANGEROUS" "DANGEROUS"
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
"arity": 2, "arity": 2,
"container": "MEMORY", "container": "MEMORY",
"function": "memoryCommand", "function": "memoryCommand",
"command_flags": [ "command_tips": [
"RANDOM" "NONDETERMINISTIC_OUTPUT"
] ]
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment