• Binbin's avatar
    Fix some commands key spec in json files (#10779) · 2a099d49
    Binbin authored
    There are some commands that has the wrong key specs.
    This PR adds a key-spec related check in generate-command-code.py.
    Check if the index is valid, or if there is an unused index.
    
    The check result will look like:
    ```
    [root]# python utils/generate-command-code.py
    Processing json files...
    Linking container command to subcommands...
    Checking all commands...
    command: RESTORE_ASKING may have unused key_spec
    command: RENAME may have unused key_spec
    command: PFDEBUG may have unused key_spec
    command: WATCH key_specs missing flags
    command: LCS arg: key2 key_spec_index error
    command: RENAMENX may have unused key_spec
    Error: There are errors in the commands check, please check the above logs.
    ```
    
    The following commands have been fixed according to the check results:
    - RESTORE ASKING: add missing arguments section (and history section)
    - RENAME: newkey's key_spec_index should be 1
    - PFDEBUG: add missing arguments (and change the arity from -3 to 3)
    - WATCH: add missing key_specs flags: RO, like EXIST (it allow you to know the key exists, or is modified, but doesn't "leak" the data)
    - LCS: key2 key_spec_index error, there is only one key-spec
    - RENAMENX: newkey's key_spec_index should be 1
    2a099d49
generate-command-code.py 16.3 KB