summaryrefslogtreecommitdiff
path: root/src/rdb.c
diff options
context:
space:
mode:
authorguybe7 <guy.benoish@redislabs.com>2022-01-04 12:37:47 +0100
committerGitHub <noreply@github.com>2022-01-04 13:37:47 +0200
commitac84b1cd826a39c80cbc80a83787b7ba2cbc3ec8 (patch)
tree3b2af344d2607af42e0a5048ae84788951b07204 /src/rdb.c
parent2e1979a21e0d30e8dacb86617f891fb004700fbc (diff)
downloadredis-ac84b1cd826a39c80cbc80a83787b7ba2cbc3ec8.tar.gz
Ban snapshot-creating commands and other admin commands from transactions (#10015)
Creating fork (or even a foreground SAVE) during a transaction breaks the atomicity of the transaction. In addition to that, it could mess up the propagated transaction to the AOF file. This change blocks SAVE, PSYNC, SYNC and SHUTDOWN from being executed inside MULTI-EXEC. It does that by adding a command flag, so that modules can flag their commands with that flag too. Besides it changes BGSAVE, BGREWRITEAOF, and CONFIG SET appendonly, to turn the scheduled flag instead of forking righ taway. Other changes: * expose `protected`, `no-async-loading`, and `no_multi` flags in COMMAND command * add a test to validate propagation of FLUSHALL inside a transaction. * add a test to validate how CONFIG SET that errors reacts in a transaction Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src/rdb.c')
-rw-r--r--src/rdb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rdb.c b/src/rdb.c
index b6d67181a..ee14fd12c 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -3432,8 +3432,8 @@ void bgsaveCommand(client *c) {
if (server.child_type == CHILD_TYPE_RDB) {
addReplyError(c,"Background save already in progress");
- } else if (hasActiveChildProcess()) {
- if (schedule) {
+ } else if (hasActiveChildProcess() || server.in_exec) {
+ if (schedule || server.in_exec) {
server.rdb_bgsave_scheduled = 1;
addReplyStatus(c,"Background saving scheduled");
} else {