MCPcopy Create free account
hub / github.com/F-Stack/f-stack / discardDbBackup

Function discardDbBackup

app/redis-6.2.6/src/db.c:497–517  ·  view source on GitHub ↗

Discard a previously created backup, this can be slow (similar to FLUSHALL) * Arguments are similar to the ones of emptyDb, see EMPTYDB_ flags. */

Source from the content-addressed store, hash-verified

495/* Discard a previously created backup, this can be slow (similar to FLUSHALL)
496 * Arguments are similar to the ones of emptyDb, see EMPTYDB_ flags. */
497void discardDbBackup(dbBackup *buckup, int flags, void(callback)(void*)) {
498 int async = (flags & EMPTYDB_ASYNC);
499
500 /* Release main DBs backup . */
501 emptyDbStructure(buckup->dbarray, -1, async, callback);
502 for (int i=0; i<server.dbnum; i++) {
503 dictRelease(buckup->dbarray[i].dict);
504 dictRelease(buckup->dbarray[i].expires);
505 }
506
507 /* Release slots to keys map backup if enable cluster. */
508 if (server.cluster_enabled) freeSlotsToKeysMap(buckup->slots_to_keys, async);
509
510 /* Release buckup. */
511 zfree(buckup->dbarray);
512 zfree(buckup);
513
514 moduleFireServerEvent(REDISMODULE_EVENT_REPL_BACKUP,
515 REDISMODULE_SUBEVENT_REPL_BACKUP_DISCARD,
516 NULL);
517}
518
519/* Restore the previously created backup (discarding what currently resides
520 * in the db).

Callers 1

Calls 5

emptyDbStructureFunction · 0.85
freeSlotsToKeysMapFunction · 0.85
moduleFireServerEventFunction · 0.85
dictReleaseFunction · 0.70
zfreeFunction · 0.70

Tested by

no test coverage detected