diff options
author | guybe7 <guy.benoish@redislabs.com> | 2022-01-20 10:32:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-20 11:32:11 +0200 |
commit | 10bbeb68377bc2b20442e6578183dbc61fb57ec3 (patch) | |
tree | 2b74cd978aaa459d0e118687ac279ba26eca8d13 /utils | |
parent | 9c6029225060a52d433ce7e5707736080688fe80 (diff) | |
download | redis-10bbeb68377bc2b20442e6578183dbc61fb57ec3.tar.gz |
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 9e4fb96ca12476b1c7468b143efca86b478bfb4a, 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
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/generate-command-code.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/utils/generate-command-code.py b/utils/generate-command-code.py index e6801f5df..28ad03a1f 100755 --- a/utils/generate-command-code.py +++ b/utils/generate-command-code.py @@ -215,8 +215,8 @@ class Command(object): def history_table_name(self): return "%s_History" % (self.fullname().replace(" ", "_")) - def hints_table_name(self): - return "%s_Hints" % (self.fullname().replace(" ", "_")) + def tips_table_name(self): + return "%s_tips" % (self.fullname().replace(" ", "_")) def arg_table_name(self): return "%s_Args" % (self.fullname().replace(" ", "_")) @@ -233,19 +233,19 @@ class Command(object): s += "{0}" return s - def hints_code(self): - if not self.desc.get("hints"): + def tips_code(self): + if not self.desc.get("command_tips"): return "" s = "" - for hint in self.desc["hints"].split(' '): - s += "\"%s\",\n" % hint + for hint in self.desc["command_tips"]: + s += "\"%s\",\n" % hint.lower() s += "NULL" return s def struct_code(self): """ Output example: - "set","Set the string value of a key","O(1)","1.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_STRING,SET_History,SET_Hints,setCommand,-3,"write denyoom @string",{{"write read",KSPEC_BS_INDEX,.bs.index={1},KSPEC_FK_RANGE,.fk.range={0,1,0}}},.args=SET_Args + "set","Set the string value of a key","O(1)","1.0.0",CMD_DOC_NONE,NULL,NULL,COMMAND_GROUP_STRING,SET_History,SET_tips,setCommand,-3,"write denyoom @string",{{"write read",KSPEC_BS_INDEX,.bs.index={1},KSPEC_FK_RANGE,.fk.range={0,1,0}}},.args=SET_Args """ def _flags_code(): @@ -282,7 +282,7 @@ class Command(object): get_optional_desc_string(self.desc, "deprecated_since"), GROUPS[self.group], self.history_table_name(), - self.hints_table_name(), + self.tips_table_name(), self.desc.get("function", "NULL"), self.desc["arity"], _flags_code(), @@ -328,14 +328,14 @@ class Command(object): else: f.write("#define %s NULL\n\n" % self.history_table_name()) - f.write("/* %s hints */\n" % self.fullname()) - code = self.hints_code() + f.write("/* %s tips */\n" % self.fullname()) + code = self.tips_code() if code: - f.write("const char *%s[] = {\n" % self.hints_table_name()) + f.write("const char *%s[] = {\n" % self.tips_table_name()) f.write("%s\n" % code) f.write("};\n\n") else: - f.write("#define %s NULL\n\n" % self.hints_table_name()) + f.write("#define %s NULL\n\n" % self.tips_table_name()) if self.args: for arg in self.args: |