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
7c9f6ebc
Commit
7c9f6ebc
authored
Jul 10, 2019
by
antirez
Browse files
Diskless replica: fix disklessLoadRestoreBackups() bug.
parent
3bbb9a14
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/replication.c
View file @
7c9f6ebc
...
...
@@ -1138,16 +1138,16 @@ redisDb *disklessLoadMakeBackups(void) {
*
* If the socket loading went wrong, we want to restore the old backups
* into the server databases. This function does just that in the case
* the '
count
' argument (the number of DBs to replace) is non-zero.
* the '
restore
' argument (the number of DBs to replace) is non-zero.
*
* When instead the loading succeeded we want just to free our old backups,
* in that case the funciton will do just that when '
count
' is 0. */
void disklessLoadRestoreBackups(redisDb *backup, int
count
, int empty_db_flags)
* in that case the funciton will do just that when '
restore
' is 0. */
void disklessLoadRestoreBackups(redisDb *backup, int
restore
, int empty_db_flags)
{
if (
count
) {
if (
restore
) {
/* Restore. */
emptyDbGeneric(server.db,-1,empty_db_flags,replicationEmptyDbCallback);
for (int i=0; i<
count
; i++) {
for (int i=0; i<
server.dbnum
; i++) {
dictRelease(server.db[i].dict);
dictRelease(server.db[i].expires);
server.db[i] = backup[i];
...
...
@@ -1155,7 +1155,7 @@ void disklessLoadRestoreBackups(redisDb *backup, int count, int empty_db_flags)
} else {
/* Delete. */
emptyDbGeneric(backup,-1,empty_db_flags,replicationEmptyDbCallback);
for (int i=0; i<
count
; i++) {
for (int i=0; i<
server.dbnum
; i++) {
dictRelease(backup[i].dict);
dictRelease(backup[i].expires);
}
...
...
@@ -1382,7 +1382,7 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
rioFreeFd(&rdb, NULL);
if (server.repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB) {
/* Restore the backed up databases. */
disklessLoadRestoreBackups(diskless_load_backup,
server.dbnum
,
disklessLoadRestoreBackups(diskless_load_backup,
1
,
empty_db_flags);
} else {
/* Remove the half-loaded data in case we started with
...
...
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