• Oran Agra's avatar
    Expose script flags to processCommand for better handling (#10744) · df558618
    Oran Agra authored
    The important part is that read-only scripts (not just EVAL_RO
    and FCALL_RO, but also ones with `no-writes` executed by normal EVAL or
    FCALL), will now be permitted to run during CLIENT PAUSE WRITE (unlike
    before where only the _RO commands would be processed).
    
    Other than that, some errors like OOM, READONLY, MASTERDOWN are now
    handled by processCommand, rather than the command itself affects the
    error string (and even error code in some cases), and command stats.
    
    Besides that, now the `may-replicate` commands, PFCOUNT and PUBLISH, will
    be considered `write` commands in scripts and will be blocked in all
    read-only scripts just like other write commands.
    They'll also be blocked in EVAL_RO (i.e. even for scripts without the
    `no-writes` shebang flag.
    
    This commit also hides the `may_replicate` flag from the COMMAND command
    output. this is a **breaking change**.
    
    background about may_replicate:
    We don't want to expose a no-may-replicate flag or alike to scripts, since we
    consider the may-replicate thing an internal concern of redis, that we may
    some day get rid of.
    In fact, the may-replicate flag was initially introduced to flag EVAL: since
    we didn't know what it's gonna do ahead of execution, before function-flags
    existed). PUBLISH and PFCOUNT, both of which because they have side effects
    which may some day be fixed differently.
    
    code changes:
    The changes in eval.c are mostly code re-ordering:
    - evalCalcFunctionName is extracted out of evalGenericCommand
    - evalExtractShebangFlags is extracted luaCreateFunction
    - evalGetCommandFlags is new code
    df558618
eval.c 60.2 KB