Discard a previously created backup, this can be slow (similar to FLUSHALL) * Arguments are similar to the ones of emptyDb, see EMPTYDB_ flags. */
| 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. */ |
| 497 | void 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). |
no test coverage detected