• Binbin's avatar
    Fixed SET and BITFIELD commands being wrongly marked movablekeys (#10837) · 92fb4f4f
    Binbin authored
    
    
    The SET and BITFIELD command were added `get_keys_function` in #10148, causing
    them to be wrongly marked movablekeys in `populateCommandMovableKeys`.
    
    This was an unintended side effect introduced in #10148 (7.0 RC1)
    which could cause some clients an extra round trip for these commands in cluster mode.
    
    Since we define movablekeys as a way to determine if the legacy range [first, last, step]
    doesn't find all keys, then we need a completely different approach.
    
    The right approach should be to check if the legacy range covers all key-specs,
    and if none of the key-specs have the INCOMPLETE flag. 
    This way, we don't need to look at getkeys_proc of VARIABLE_FLAG at all.
    Probably with the exception of modules, who may still not be using key-specs.
    
    In this PR, we removed `populateCommandMovableKeys` and put its logic in
    `populateCommandLegacyRangeSpec`.
    In order to properly serve both old and new modules, we must probably keep relying
    CMD_MODULE_GETKEYS, but do that only for modules that don't declare key-specs. 
    For ones that do, we need to take the same approach we take with native redis commands.
    
    This approach was proposed by Oran. Fixes #10833
    Co-authored-by: default avatarOran Agra <oran@redislabs.com>
    92fb4f4f
server.c 269 KB