summaryrefslogtreecommitdiff
path: root/src/aof.c
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2022-06-01 14:09:40 +0300
committerGitHub <noreply@github.com>2022-06-01 14:09:40 +0300
commitdf558618389a578b5eff7f60c9526e64952b74fb (patch)
tree949e7a2bd3a3f05643e68cc6f1ee03912d8a6c22 /src/aof.c
parentb2061de2e713d304ab8e845162888cca47ee32d3 (diff)
downloadredis-df558618389a578b5eff7f60c9526e64952b74fb.tar.gz
Expose script flags to processCommand for better handling (#10744)
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
Diffstat (limited to 'src/aof.c')
-rw-r--r--src/aof.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/aof.c b/src/aof.c
index 485fa1960..823759f24 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -1502,7 +1502,10 @@ int loadSingleAppendOnlyFile(char *filename) {
if (fakeClient->flags & CLIENT_MULTI &&
fakeClient->cmd->proc != execCommand)
{
- queueMultiCommand(fakeClient);
+ /* Note: we don't have to attempt calling evalGetCommandFlags,
+ * since this is AOF, the checks in processCommand are not made
+ * anyway.*/
+ queueMultiCommand(fakeClient, cmd->flags);
} else {
cmd->proc(fakeClient);
}