Unverified Commit f63bb958 authored by pgxiaolianzi's avatar pgxiaolianzi Committed by GitHub
Browse files

Fix typo on buckup to backup (#8919)

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