Commit 83e87bac authored by Oran Agra's avatar Oran Agra
Browse files

Fix lastbgsave_status, when new child signal handler get intended kill

And add a test for that.
parent 78bbb9b5
......@@ -1910,6 +1910,13 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
if (WIFSIGNALED(statloc)) bysignal = WTERMSIG(statloc);
/* sigKillChildHandler catches the signal and calls exit(), but we
* must make sure not to flag lastbgsave_status, etc incorrectly. */
if (exitcode == SIGUSR1) {
bysignal = SIGUSR1;
exitcode = 1;
}
if (pid == -1) {
serverLog(LL_WARNING,"wait3() returned an error: %s. "
"rdb_child_pid = %d, aof_child_pid = %d, module_child_pid = %d",
......@@ -4578,7 +4585,7 @@ static void sigKillChildHandler(int sig) {
UNUSED(sig);
/* this handler is needed to resolve a valgrind warning */
serverLogFromHandler(LL_WARNING, "Received SIGUSR1 in child, exiting now.");
exitFromChild(1);
exitFromChild(SIGUSR1);
}
void setupChildSignalHandlers(void) {
......
......@@ -115,3 +115,17 @@ start_server_and_kill_it [list "dir" $server_path] {
}
}
}
start_server {} {
test {Test FLUSHALL aborts bgsave} {
r config set rdb-key-save-delay 1000
r debug populate 1000
r bgsave
assert_equal [s rdb_bgsave_in_progress] 1
r flushall
after 200
assert_equal [s rdb_bgsave_in_progress] 0
# make sure the server is still writable
r set x xx
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment