Unverified Commit 755b51a4 authored by Binbin's avatar Binbin Committed by GitHub
Browse files

When dirCreateIfMissing or openNewIncrAofForAppend fail, set...

When dirCreateIfMissing or openNewIncrAofForAppend fail, set aof_lastbgrewrite_status to err (#10775)

It will be displayed in the `aof_last_bgrewrite_status`
field of the INFO command.
parent c52922e1
...@@ -2408,6 +2408,7 @@ int rewriteAppendOnlyFileBackground(void) { ...@@ -2408,6 +2408,7 @@ int rewriteAppendOnlyFileBackground(void) {
if (dirCreateIfMissing(server.aof_dirname) == -1) { if (dirCreateIfMissing(server.aof_dirname) == -1) {
serverLog(LL_WARNING, "Can't open or create append-only dir %s: %s", serverLog(LL_WARNING, "Can't open or create append-only dir %s: %s",
server.aof_dirname, strerror(errno)); server.aof_dirname, strerror(errno));
server.aof_lastbgrewrite_status = C_ERR;
return C_ERR; return C_ERR;
} }
...@@ -2415,7 +2416,10 @@ int rewriteAppendOnlyFileBackground(void) { ...@@ -2415,7 +2416,10 @@ int rewriteAppendOnlyFileBackground(void) {
* feedAppendOnlyFile() to issue a SELECT command. */ * feedAppendOnlyFile() to issue a SELECT command. */
server.aof_selected_db = -1; server.aof_selected_db = -1;
flushAppendOnlyFile(1); flushAppendOnlyFile(1);
if (openNewIncrAofForAppend() != C_OK) return C_ERR; if (openNewIncrAofForAppend() != C_OK) {
server.aof_lastbgrewrite_status = C_ERR;
return C_ERR;
}
server.stat_aof_rewrites++; server.stat_aof_rewrites++;
if ((childpid = redisFork(CHILD_TYPE_AOF)) == 0) { if ((childpid = redisFork(CHILD_TYPE_AOF)) == 0) {
char tmpfile[256]; char tmpfile[256];
......
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