Describe the bug
In 8.0, the vector set commands are implemented as a module, but they always build regardless of the BUILD_WITH_MODULES
makefile setting. This breaks utils/generate-commands-json.py
, because when it encounters a vecset-related command, the required metadata is not present. For example, if you were to run the COMMAND DOCS
command on the VADD
command, you'll see the following:
127.0.0.1:6379> COMMAND DOCS VADD
1) "VADD"
2) 1) "group"
2) "module"
3) "module"
4) "vectorset"
Whereas doing so with the SET
command yields the following:
127.0.0.1:6379> COMMAND DOCS SET
1) "set"
2) 1) "summary"
2) "Sets the string value of a key, ignoring its type. The key is created if it doesn't exist."
3) "since"
4) "1.0.0"
5) "group"
6) "string"
7) "complexity"
8) "O(1)"
9) "history"
10) 1) 1) "2.6.12"
2) "Added the `EX`, `PX`, `NX` and `XX` options."
2) 1) "6.0.0"
2) "Added the `KEEPTTL` option."
3) 1) "6.2.0"
2) "Added the `GET`, `EXAT` and `PXAT` option."
4) 1) "7.0.0"
2) "Allowed the `NX` and `GET` options to be used together."
11) "arguments"
12) 1) 1) "name"
2) "key"
3) "type"
4) "key"
5) "display_text"
6) "key"
7) "key_spec_index"
8) (integer) 0
2) 1) "name"
2) "value"
3) "type"
4) "string"
5) "display_text"
6) "value"
3) 1) "name"
2) "condition"
3) "type"
4) "oneof"
5) "since"
6) "2.6.12"
7) "flags"
8) 1) optional
9) "arguments"
10) 1) 1) "name"
2) "nx"
3) "type"
4) "pure-token"
5) "display_text"
6) "nx"
7) "token"
8) "NX"
2) 1) "name"
2) "xx"
3) "type"
4) "pure-token"
5) "display_text"
6) "xx"
7) "token"
8) "XX"
4) 1) "name"
2) "get"
3) "type"
4) "pure-token"
5) "display_text"
6) "get"
7) "token"
8) "GET"
9) "since"
10) "6.2.0"
11) "flags"
12) 1) optional
5) 1) "name"
2) "expiration"
3) "type"
4) "oneof"
5) "flags"
6) 1) optional
7) "arguments"
8) 1) 1) "name"
2) "seconds"
3) "type"
4) "integer"
5) "display_text"
6) "seconds"
7) "token"
8) "EX"
9) "since"
10) "2.6.12"
2) 1) "name"
2) "milliseconds"
3) "type"
4) "integer"
5) "display_text"
6) "milliseconds"
7) "token"
8) "PX"
9) "since"
10) "2.6.12"
3) 1) "name"
2) "unix-time-seconds"
3) "type"
4) "unix-time"
5) "display_text"
6) "unix-time-seconds"
7) "token"
8) "EXAT"
9) "since"
10) "6.2.0"
4) 1) "name"
2) "unix-time-milliseconds"
3) "type"
4) "unix-time"
5) "display_text"
6) "unix-time-milliseconds"
7) "token"
8) "PXAT"
9) "since"
10) "6.2.0"
5) 1) "name"
2) "keepttl"
3) "type"
4) "pure-token"
5) "display_text"
6) "keepttl"
7) "token"
8) "KEEPTTL"
9) "since"
10) "6.0.0"
The latter contains all the required metadata, but the former does not.
Here’s an example of the error:
['VINFO', -1, ['readonly', 'module', 'fast'], 1, 1, 1, [], [], [{'flags': ['RW', 'access', 'update'], 'begin_search': {'type': 'index', 'spec': {'index': 1}}, 'find_keys': {'type': 'range', 'spec': {'lastkey': 0, 'keystep': 1, 'limit': 0}}}], []]
Traceback (most recent call last):
File "/Users/david.dougherty/tmp/redis/utils/generate-commands-json.py", line 129, in <module>
cmd = convert_entry_to_objects_array(entry, docs[entry[0]])
File "/Users/david.dougherty/tmp/redis/utils/generate-commands-json.py", line 74, in convert_entry_to_objects_array
value['summary'] = docs.pop('summary')
~~~~~~~~^^^^^^^^^^^
KeyError: 'summary'
To reproduce
Build redis from source without modules and then try to run the utils/generate-commands-json.py script.
Expected behavior
I expected the script to generate a complete and usable commands.json file (to STDOUT).
Comment From: NikhatSingla
I have resolved the issue and created a PR. Can someone with write access to the repository review it and merge the PR? Thanks