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
e24d4600
Unverified
Commit
e24d4600
authored
Apr 27, 2022
by
chenyang8094
Committed by
GitHub
Apr 27, 2022
Browse files
Delete renamed new incr when write manifest failed (#10649)
Followup fix for #10616
parent
81926254
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/aof.c
View file @
e24d4600
...
...
@@ -2517,7 +2517,8 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
if
(
!
bysignal
&&
exitcode
==
0
)
{
char
tmpfile
[
256
];
long
long
now
=
ustime
();
sds
new_base_filename
;
sds
new_base_filepath
=
NULL
;
sds
new_incr_filepath
=
NULL
;
aofManifest
*
temp_am
;
mstime_t
latency
;
...
...
@@ -2534,9 +2535,9 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
/* Get a new BASE file name and mark the previous (if we have)
* as the HISTORY type. */
new_base_filename
=
getNewBaseFileNameAndMarkPreAsHistory
(
temp_am
);
sds
new_base_filename
=
getNewBaseFileNameAndMarkPreAsHistory
(
temp_am
);
serverAssert
(
new_base_filename
!=
NULL
);
sds
new_base_filepath
=
makePath
(
server
.
aof_dirname
,
new_base_filename
);
new_base_filepath
=
makePath
(
server
.
aof_dirname
,
new_base_filename
);
/* Rename the temporary aof file to 'new_base_filename'. */
latencyStartMonitor
(
latency
);
...
...
@@ -2561,7 +2562,7 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
sdsfree
(
temp_incr_aof_name
);
/* Get next new incr aof name. */
sds
new_incr_filename
=
getNewIncrAofName
(
temp_am
);
sds
new_incr_filepath
=
makePath
(
server
.
aof_dirname
,
new_incr_filename
);
new_incr_filepath
=
makePath
(
server
.
aof_dirname
,
new_incr_filename
);
latencyStartMonitor
(
latency
);
if
(
rename
(
temp_incr_filepath
,
new_incr_filepath
)
==
-
1
)
{
serverLog
(
LL_WARNING
,
...
...
@@ -2579,7 +2580,6 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
latencyEndMonitor
(
latency
);
latencyAddSampleIfNeeded
(
"aof-rename"
,
latency
);
sdsfree
(
temp_incr_filepath
);
sdsfree
(
new_incr_filepath
);
}
/* Change the AOF file type in 'incr_aof_list' from AOF_FILE_TYPE_INCR
...
...
@@ -2591,9 +2591,14 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
bg_unlink
(
new_base_filepath
);
aofManifestFree
(
temp_am
);
sdsfree
(
new_base_filepath
);
if
(
new_incr_filepath
)
{
bg_unlink
(
new_incr_filepath
);
sdsfree
(
new_incr_filepath
);
}
goto
cleanup
;
}
sdsfree
(
new_base_filepath
);
if
(
new_incr_filepath
)
sdsfree
(
new_incr_filepath
);
/* We can safely let `server.aof_manifest` point to 'temp_am' and free the previous one. */
aofManifestFreeAndUpdate
(
temp_am
);
...
...
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