Commit 592a8dd2 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4386], address CR comments in toku_cachetable_unpin_and_remove

git-svn-id: file:///svn/toku/tokudb@39024 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5ef37006
......@@ -3180,17 +3180,12 @@ int toku_cachetable_unpin_and_remove (
// that may have been blocked (as argued above),
// it is safe to simply remove the PAIR from the
// cachetable. We don't need to write anything out.
if (nb_mutex_blocked_writers(&p->nb_mutex) == 0) {
cachetable_free_pair(ct, p);
break;
}
}
p->cq = NULL;
workqueue_destroy(&cq);
}
else {
//Remove pair.
cachetable_free_pair(ct, p);
}
//Remove pair.
cachetable_free_pair(ct, p);
r = 0;
goto done;
}
......
......@@ -47,18 +47,27 @@ txn_has_spilled_rollback_logs(TOKUTXN txn) {
return txn->spilled_rollback_tail.b != ROLLBACK_NONE.b;
}
static void rollback_unpin_remove_callback(CACHEKEY* cachekey, BOOL for_checkpoint, void* extra) {
struct brt_header* h = extra;
toku_free_blocknum(
h->blocktable,
cachekey,
h,
for_checkpoint
);
}
int
toku_delete_rollback_log(TOKUTXN txn, ROLLBACK_LOG_NODE log) {
int r;
CACHEFILE cf = txn->logger->rollback_cachefile;
struct brt_header *h = toku_cachefile_get_userdata(cf);
BLOCKNUM to_free = log->thislogname;
if (txn->pinned_inprogress_rollback_log == log) {
txn->pinned_inprogress_rollback_log = NULL;
}
r = toku_cachetable_unpin_and_remove (cf, log->thislogname, NULL, NULL);
r = toku_cachetable_unpin_and_remove (cf, log->thislogname, rollback_unpin_remove_callback, h);
assert(r==0);
toku_free_blocknum(h->blocktable, &to_free, h, FALSE);
return r;
}
......
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