X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/b835f77933c0863605054eea716d0263aa634052..64b2834657e4c215dc0489417177a37c80d9ac46:/src/migrate.c diff --git a/src/migrate.c b/src/migrate.c index 8cddc502..6d8aad7f 100644 --- a/src/migrate.c +++ b/src/migrate.c @@ -285,7 +285,7 @@ int startKeyArchive(void) { ret = mdb_txn_begin(env, NULL, 0, &txn); if (ret != 0) return ret; - ret = mdb_open(txn, NULL, 0, &dbi); + ret = mdb_dbi_open(txn, NULL, 0, &dbi); if (ret != 0) return ret; mdb_txn_commit(txn); @@ -398,3 +398,27 @@ recover_err: sdsfree(sval); return NULL; } + +void purge(robj *key) { + if (server.mdb_state == REDIS_MDB_OFF) + return; + + int ret; + + MDB_val kval; + kval.mv_data = key->ptr; + kval.mv_size = sdslen((sds)key->ptr); + + MDB_txn *txn; + ret = mdb_txn_begin(env, NULL, 0, &txn); + if (ret != 0) + return; + + ret = mdb_del(txn, dbi, &kval, NULL); + if (ret != 0) { + mdb_txn_abort(txn); + return; + } + + mdb_txn_commit(txn); +}