Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
83e87bac
Commit
83e87bac
authored
Sep 26, 2019
by
Oran Agra
Browse files
Fix lastbgsave_status, when new child signal handler get intended kill
And add a test for that.
parent
78bbb9b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/server.c
View file @
83e87bac
...
@@ -1910,6 +1910,13 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
...
@@ -1910,6 +1910,13 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
if (WIFSIGNALED(statloc)) bysignal = WTERMSIG(statloc);
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) {
if (pid == -1) {
serverLog(LL_WARNING,"wait3() returned an error: %s. "
serverLog(LL_WARNING,"wait3() returned an error: %s. "
"rdb_child_pid = %d, aof_child_pid = %d, module_child_pid = %d",
"rdb_child_pid = %d, aof_child_pid = %d, module_child_pid = %d",
...
@@ -4578,7 +4585,7 @@ static void sigKillChildHandler(int sig) {
...
@@ -4578,7 +4585,7 @@ static void sigKillChildHandler(int sig) {
UNUSED(sig);
UNUSED(sig);
/* this handler is needed to resolve a valgrind warning */
/* this handler is needed to resolve a valgrind warning */
serverLogFromHandler(LL_WARNING, "Received SIGUSR1 in child, exiting now.");
serverLogFromHandler(LL_WARNING, "Received SIGUSR1 in child, exiting now.");
exitFromChild
(
1
);
exitFromChild(
SIGUSR
1);
}
}
void setupChildSignalHandlers(void) {
void setupChildSignalHandlers(void) {
...
...
tests/integration/rdb.tcl
View file @
83e87bac
...
@@ -115,3 +115,17 @@ start_server_and_kill_it [list "dir" $server_path] {
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment