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
f63bb958
Unverified
Commit
f63bb958
authored
Jun 02, 2021
by
pgxiaolianzi
Committed by
GitHub
Jun 01, 2021
Browse files
Fix typo on buckup to backup (#8919)
parent
7cb42c9c
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
f63bb958
...
...
@@ -493,22 +493,22 @@ dbBackup *backupDb(void) {
/* Discard a previously created backup, this can be slow (similar to FLUSHALL)
* Arguments are similar to the ones of emptyDb, see EMPTYDB_ flags. */
void
discardDbBackup
(
dbBackup
*
b
u
ckup
,
int
flags
,
void
(
callback
)(
void
*
))
{
void
discardDbBackup
(
dbBackup
*
b
a
ckup
,
int
flags
,
void
(
callback
)(
void
*
))
{
int
async
=
(
flags
&
EMPTYDB_ASYNC
);
/* Release main DBs backup . */
emptyDbStructure
(
b
u
ckup
->
dbarray
,
-
1
,
async
,
callback
);
emptyDbStructure
(
b
a
ckup
->
dbarray
,
-
1
,
async
,
callback
);
for
(
int
i
=
0
;
i
<
server
.
dbnum
;
i
++
)
{
dictRelease
(
b
u
ckup
->
dbarray
[
i
].
dict
);
dictRelease
(
b
u
ckup
->
dbarray
[
i
].
expires
);
dictRelease
(
b
a
ckup
->
dbarray
[
i
].
dict
);
dictRelease
(
b
a
ckup
->
dbarray
[
i
].
expires
);
}
/* Release slots to keys map backup if enable cluster. */
if
(
server
.
cluster_enabled
)
freeSlotsToKeysMap
(
b
u
ckup
->
slots_to_keys
,
async
);
if
(
server
.
cluster_enabled
)
freeSlotsToKeysMap
(
b
a
ckup
->
slots_to_keys
,
async
);
/* Release b
u
ckup. */
zfree
(
b
u
ckup
->
dbarray
);
zfree
(
b
u
ckup
);
/* Release b
a
ckup. */
zfree
(
b
a
ckup
->
dbarray
);
zfree
(
b
a
ckup
);
moduleFireServerEvent
(
REDISMODULE_EVENT_REPL_BACKUP
,
REDISMODULE_SUBEVENT_REPL_BACKUP_DISCARD
,
...
...
@@ -519,28 +519,28 @@ void discardDbBackup(dbBackup *buckup, int flags, void(callback)(void*)) {
* in the db).
* This function should be called after the current contents of the database
* was emptied with a previous call to emptyDb (possibly using the async mode). */
void
restoreDbBackup
(
dbBackup
*
b
u
ckup
)
{
void
restoreDbBackup
(
dbBackup
*
b
a
ckup
)
{
/* Restore main DBs. */
for
(
int
i
=
0
;
i
<
server
.
dbnum
;
i
++
)
{
serverAssert
(
dictSize
(
server
.
db
[
i
].
dict
)
==
0
);
serverAssert
(
dictSize
(
server
.
db
[
i
].
expires
)
==
0
);
dictRelease
(
server
.
db
[
i
].
dict
);
dictRelease
(
server
.
db
[
i
].
expires
);
server
.
db
[
i
]
=
b
u
ckup
->
dbarray
[
i
];
server
.
db
[
i
]
=
b
a
ckup
->
dbarray
[
i
];
}
/* Restore slots to keys map backup if enable cluster. */
if
(
server
.
cluster_enabled
)
{
serverAssert
(
server
.
cluster
->
slots_to_keys
->
numele
==
0
);
raxFree
(
server
.
cluster
->
slots_to_keys
);
server
.
cluster
->
slots_to_keys
=
b
u
ckup
->
slots_to_keys
;
memcpy
(
server
.
cluster
->
slots_keys_count
,
b
u
ckup
->
slots_keys_count
,
server
.
cluster
->
slots_to_keys
=
b
a
ckup
->
slots_to_keys
;
memcpy
(
server
.
cluster
->
slots_keys_count
,
b
a
ckup
->
slots_keys_count
,
sizeof
(
server
.
cluster
->
slots_keys_count
));
}
/* Release b
u
ckup. */
zfree
(
b
u
ckup
->
dbarray
);
zfree
(
b
u
ckup
);
/* Release b
a
ckup. */
zfree
(
b
a
ckup
->
dbarray
);
zfree
(
b
a
ckup
);
moduleFireServerEvent
(
REDISMODULE_EVENT_REPL_BACKUP
,
REDISMODULE_SUBEVENT_REPL_BACKUP_RESTORE
,
...
...
src/replication.c
View file @
f63bb958
...
...
@@ -1531,14 +1531,14 @@ dbBackup *disklessLoadMakeBackup(void) {
*
* If the socket loading went wrong, we want to restore the old backups
* into the server databases. */
void
disklessLoadRestoreBackup
(
dbBackup
*
b
u
ckup
)
{
restoreDbBackup
(
b
u
ckup
);
void
disklessLoadRestoreBackup
(
dbBackup
*
b
a
ckup
)
{
restoreDbBackup
(
b
a
ckup
);
}
/* Helper function for readSyncBulkPayload() to discard our old backups
* when the loading succeeded. */
void
disklessLoadDiscardBackup
(
dbBackup
*
b
u
ckup
,
int
flag
)
{
discardDbBackup
(
b
u
ckup
,
flag
,
replicationEmptyDbCallback
);
void
disklessLoadDiscardBackup
(
dbBackup
*
b
a
ckup
,
int
flag
)
{
discardDbBackup
(
b
a
ckup
,
flag
,
replicationEmptyDbCallback
);
}
/* Asynchronously read the SYNC payload we receive from a master */
...
...
src/server.h
View file @
f63bb958
...
...
@@ -2377,8 +2377,8 @@ long long emptyDbStructure(redisDb *dbarray, int dbnum, int async, void(callback
void
flushAllDataAndResetRDB
(
int
flags
);
long
long
dbTotalServerKeyCount
();
dbBackup
*
backupDb
(
void
);
void
restoreDbBackup
(
dbBackup
*
b
u
ckup
);
void
discardDbBackup
(
dbBackup
*
b
u
ckup
,
int
flags
,
void
(
callback
)(
void
*
));
void
restoreDbBackup
(
dbBackup
*
b
a
ckup
);
void
discardDbBackup
(
dbBackup
*
b
a
ckup
,
int
flags
,
void
(
callback
)(
void
*
));
int
selectDb
(
client
*
c
,
int
id
);
...
...
tests/cluster/tests/17-diskless-load-swapdb.tcl
View file @
f63bb958
# Check replica can restore database b
u
ckup correctly if fail to diskless load.
# Check replica can restore database b
a
ckup correctly if fail to diskless load.
source
"../tests/includes/init-tests.tcl"
...
...
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