From 3609e305c1cbe55dbbfa84ed605e25654491d093 Mon Sep 17 00:00:00 2001 From: John Esmet Date: Wed, 17 Apr 2013 00:00:42 -0400 Subject: [PATCH] [t:4967] remove the ydb lock from end checkpoint. note_unpin_by_checkpoint removes an ft reference, which is protected by the ft's ref lock. git-svn-id: file:///svn/toku/tokudb@44129 c7de825b-a66e-492c-adef-691d508d4ae1 --- ft/cachetable.c | 4 ---- ft/cachetable.h | 1 - ft/checkpoint.c | 2 +- ft/tests/cachetable-3969.c | 2 -- ft/tests/cachetable-4545.c | 2 -- ft/tests/cachetable-checkpoint-pinned-nodes.c | 2 -- ft/tests/cachetable-checkpoint-prefetched-nodes.c | 2 -- ft/tests/cachetable-cleaner-checkpoint.c | 2 -- ft/tests/cachetable-cleaner-checkpoint2.c | 2 -- .../cachetable-cleaner-thread-empty-cachetable.c | 2 -- ft/tests/cachetable-clone-checkpoint.c | 2 -- .../cachetable-clone-partial-fetch-pinned-node.c | 2 -- ft/tests/cachetable-clone-partial-fetch.c | 2 -- ft/tests/cachetable-clone-pin-nonblocking.c | 2 -- ft/tests/cachetable-clone-unpin-remove.c | 2 -- ft/tests/cachetable-pin-checkpoint.c | 2 -- .../cachetable-pin-nonblocking-checkpoint-clean.c | 2 -- ft/tests/cachetable-put-checkpoint.c | 2 -- ft/tests/cachetable-simple-clone.c | 12 +++++------- ft/tests/cachetable-simple-clone2.c | 10 ++++------ ft/tests/cachetable-simple-maybe-get-pin.c | 2 -- ft/tests/cachetable-simple-pin-dep-nodes.c | 2 -- ft/tests/cachetable-simple-pin-nonblocking.c | 2 -- ft/tests/cachetable-simple-pin.c | 2 -- ft/tests/cachetable-simple-put-dep-nodes.c | 2 -- ft/tests/cachetable-simple-unpin-remove-checkpoint.c | 2 -- ft/tests/cachetable-unpin-remove-and-checkpoint.c | 2 -- ft/tests/test4302.c | 2 -- 28 files changed, 10 insertions(+), 65 deletions(-) diff --git a/ft/cachetable.c b/ft/cachetable.c index 2cb6c7255ab..305b843263f 100644 --- a/ft/cachetable.c +++ b/ft/cachetable.c @@ -194,7 +194,6 @@ static inline void ctpair_destroy(PAIR p) { // The cachetable is as close to an ENV as we get. // There are 3 locks, must be taken in this order -// TODO: review the removal of this mutex, since it is only ever held when the ydb lock is held // cachetable_mutex // cachefiles_mutex struct cachetable { @@ -3505,7 +3504,6 @@ int toku_cachetable_get_checkpointing_user_data_status (void) { int toku_cachetable_end_checkpoint(CACHETABLE ct, TOKULOGGER logger, - void (*ydb_lock)(void), void (*ydb_unlock)(void), void (*testcallback_f)(void*), void * testextra) { // Requires: The big checkpoint lock must be held (see checkpoint.c). // Algorithm: Write all pending nodes to disk @@ -3609,9 +3607,7 @@ toku_cachetable_end_checkpoint(CACHETABLE ct, TOKULOGGER logger, // checking for function existing so that this function // can be called from cachetable tests if (cf->note_unpin_by_checkpoint) { - ydb_lock(); int r = cf->note_unpin_by_checkpoint(cf, cf->userdata); - ydb_unlock(); if (r!=0) { retval = r; goto panic; diff --git a/ft/cachetable.h b/ft/cachetable.h index bd5e3dc19e7..93d1a0d9621 100644 --- a/ft/cachetable.h +++ b/ft/cachetable.h @@ -68,7 +68,6 @@ char * toku_cachefile_fname_in_cwd (CACHEFILE cf); // TODO: #1510 Add comments on how these behave int toku_cachetable_begin_checkpoint (CACHETABLE ct, TOKULOGGER); int toku_cachetable_end_checkpoint(CACHETABLE ct, TOKULOGGER logger, - void (*ydb_lock)(void), void (*ydb_unlock)(void), void (*testcallback_f)(void*), void * testextra); // Shuts down checkpoint thread diff --git a/ft/checkpoint.c b/ft/checkpoint.c index d14b313ecb3..650689e5079 100644 --- a/ft/checkpoint.c +++ b/ft/checkpoint.c @@ -295,7 +295,7 @@ toku_checkpoint(CACHETABLE ct, TOKULOGGER logger, if (r==0) { if (callback_f) callback_f(extra); // callback is called with checkpoint_safe_lock still held - r = toku_cachetable_end_checkpoint(ct, logger, ydb_lock, ydb_unlock, callback2_f, extra2); + r = toku_cachetable_end_checkpoint(ct, logger, callback2_f, extra2); } SET_CHECKPOINT_FOOTPRINT(50); if (r==0 && logger) { diff --git a/ft/tests/cachetable-3969.c b/ft/tests/cachetable-3969.c index 805623071ea..6ae064037e5 100644 --- a/ft/tests/cachetable-3969.c +++ b/ft/tests/cachetable-3969.c @@ -80,8 +80,6 @@ run_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-4545.c b/ft/tests/cachetable-4545.c index 1108588535d..49a0bad9ac9 100644 --- a/ft/tests/cachetable-4545.c +++ b/ft/tests/cachetable-4545.c @@ -71,8 +71,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-checkpoint-pinned-nodes.c b/ft/tests/cachetable-checkpoint-pinned-nodes.c index 40ec296bea5..ba3f53101ca 100644 --- a/ft/tests/cachetable-checkpoint-pinned-nodes.c +++ b/ft/tests/cachetable-checkpoint-pinned-nodes.c @@ -99,8 +99,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-checkpoint-prefetched-nodes.c b/ft/tests/cachetable-checkpoint-prefetched-nodes.c index d895b793899..d4199520505 100644 --- a/ft/tests/cachetable-checkpoint-prefetched-nodes.c +++ b/ft/tests/cachetable-checkpoint-prefetched-nodes.c @@ -98,8 +98,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-cleaner-checkpoint.c b/ft/tests/cachetable-cleaner-checkpoint.c index bf158dd6696..b795d5200fa 100644 --- a/ft/tests/cachetable-cleaner-checkpoint.c +++ b/ft/tests/cachetable-cleaner-checkpoint.c @@ -87,8 +87,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-cleaner-checkpoint2.c b/ft/tests/cachetable-cleaner-checkpoint2.c index 706f064d12a..9a391f2ff0c 100644 --- a/ft/tests/cachetable-cleaner-checkpoint2.c +++ b/ft/tests/cachetable-cleaner-checkpoint2.c @@ -87,8 +87,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-cleaner-thread-empty-cachetable.c b/ft/tests/cachetable-cleaner-thread-empty-cachetable.c index 81c3fd4d3b8..db98a485841 100644 --- a/ft/tests/cachetable-cleaner-thread-empty-cachetable.c +++ b/ft/tests/cachetable-cleaner-thread-empty-cachetable.c @@ -28,8 +28,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-clone-checkpoint.c b/ft/tests/cachetable-clone-checkpoint.c index 1aeb1c899c6..957f1c45c94 100644 --- a/ft/tests/cachetable-clone-checkpoint.c +++ b/ft/tests/cachetable-clone-checkpoint.c @@ -44,8 +44,6 @@ static void *run_end_checkpoint(void *arg) { int r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-clone-partial-fetch-pinned-node.c b/ft/tests/cachetable-clone-partial-fetch-pinned-node.c index 0f0e4b75df7..74efe76c123 100644 --- a/ft/tests/cachetable-clone-partial-fetch-pinned-node.c +++ b/ft/tests/cachetable-clone-partial-fetch-pinned-node.c @@ -92,8 +92,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-clone-partial-fetch.c b/ft/tests/cachetable-clone-partial-fetch.c index 5103b76f485..5b175f6ba9b 100644 --- a/ft/tests/cachetable-clone-partial-fetch.c +++ b/ft/tests/cachetable-clone-partial-fetch.c @@ -92,8 +92,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-clone-pin-nonblocking.c b/ft/tests/cachetable-clone-pin-nonblocking.c index 50a3a880be7..c8083cbf0b8 100644 --- a/ft/tests/cachetable-clone-pin-nonblocking.c +++ b/ft/tests/cachetable-clone-pin-nonblocking.c @@ -72,8 +72,6 @@ cachetable_test (enum cachetable_dirty dirty, BOOL cloneable) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-clone-unpin-remove.c b/ft/tests/cachetable-clone-unpin-remove.c index 9944fe1803d..87157570f34 100644 --- a/ft/tests/cachetable-clone-unpin-remove.c +++ b/ft/tests/cachetable-clone-unpin-remove.c @@ -81,8 +81,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-pin-checkpoint.c b/ft/tests/cachetable-pin-checkpoint.c index bfa6864e80f..743e9138681 100644 --- a/ft/tests/cachetable-pin-checkpoint.c +++ b/ft/tests/cachetable-pin-checkpoint.c @@ -274,8 +274,6 @@ static void *checkpoints(void *arg) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-pin-nonblocking-checkpoint-clean.c b/ft/tests/cachetable-pin-nonblocking-checkpoint-clean.c index 75f3fd37020..a99bc19b188 100644 --- a/ft/tests/cachetable-pin-nonblocking-checkpoint-clean.c +++ b/ft/tests/cachetable-pin-nonblocking-checkpoint-clean.c @@ -59,8 +59,6 @@ run_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-put-checkpoint.c b/ft/tests/cachetable-put-checkpoint.c index b1be5efedd0..6323de67359 100644 --- a/ft/tests/cachetable-put-checkpoint.c +++ b/ft/tests/cachetable-put-checkpoint.c @@ -402,8 +402,6 @@ static void *checkpoints(void *arg) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-simple-clone.c b/ft/tests/cachetable-simple-clone.c index 0339245ded6..182c73ea0ee 100644 --- a/ft/tests/cachetable-simple-clone.c +++ b/ft/tests/cachetable-simple-clone.c @@ -128,13 +128,11 @@ test_clean (enum cachetable_dirty dirty, BOOL cloneable) { } r = toku_cachetable_end_checkpoint( - ct, - NULL, - fake_ydb_lock, - fake_ydb_unlock, - NULL, - NULL - ); + ct, + NULL, + NULL, + NULL + ); assert_zero(r); check_flush = FALSE; diff --git a/ft/tests/cachetable-simple-clone2.c b/ft/tests/cachetable-simple-clone2.c index 553656da826..c103374f47d 100644 --- a/ft/tests/cachetable-simple-clone2.c +++ b/ft/tests/cachetable-simple-clone2.c @@ -75,12 +75,10 @@ test_clean (enum cachetable_dirty dirty, BOOL cloneable) { r = toku_cachetable_unpin(f1, make_blocknum(1), 1, dirty, make_pair_attr(8)); usleep(2*1024*1024); r = toku_cachetable_end_checkpoint( - ct, - NULL, - fake_ydb_lock, - fake_ydb_unlock, - NULL, - NULL + ct, + NULL, + NULL, + NULL ); assert_zero(r); diff --git a/ft/tests/cachetable-simple-maybe-get-pin.c b/ft/tests/cachetable-simple-maybe-get-pin.c index 4e51d2fc72f..abd27f8b0d3 100644 --- a/ft/tests/cachetable-simple-maybe-get-pin.c +++ b/ft/tests/cachetable-simple-maybe-get-pin.c @@ -58,8 +58,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-simple-pin-dep-nodes.c b/ft/tests/cachetable-simple-pin-dep-nodes.c index 88020fc71fd..0eee82193e5 100644 --- a/ft/tests/cachetable-simple-pin-dep-nodes.c +++ b/ft/tests/cachetable-simple-pin-dep-nodes.c @@ -147,8 +147,6 @@ cachetable_test (BOOL write_first, BOOL write_second, BOOL start_checkpoint) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-simple-pin-nonblocking.c b/ft/tests/cachetable-simple-pin-nonblocking.c index ee5fd835267..37d55bd5dca 100644 --- a/ft/tests/cachetable-simple-pin-nonblocking.c +++ b/ft/tests/cachetable-simple-pin-nonblocking.c @@ -113,8 +113,6 @@ run_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-simple-pin.c b/ft/tests/cachetable-simple-pin.c index 2dd1811c2a9..960e8df3bd0 100644 --- a/ft/tests/cachetable-simple-pin.c +++ b/ft/tests/cachetable-simple-pin.c @@ -94,8 +94,6 @@ run_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-simple-put-dep-nodes.c b/ft/tests/cachetable-simple-put-dep-nodes.c index 69547bb4263..dd9dcb70af0 100644 --- a/ft/tests/cachetable-simple-put-dep-nodes.c +++ b/ft/tests/cachetable-simple-put-dep-nodes.c @@ -155,8 +155,6 @@ cachetable_test (BOOL write_first, BOOL write_second, BOOL start_checkpoint) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-simple-unpin-remove-checkpoint.c b/ft/tests/cachetable-simple-unpin-remove-checkpoint.c index 8b6ff70f444..941523e8429 100644 --- a/ft/tests/cachetable-simple-unpin-remove-checkpoint.c +++ b/ft/tests/cachetable-simple-unpin-remove-checkpoint.c @@ -45,8 +45,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/cachetable-unpin-remove-and-checkpoint.c b/ft/tests/cachetable-unpin-remove-and-checkpoint.c index d36bb7870ca..687a15c9ada 100644 --- a/ft/tests/cachetable-unpin-remove-and-checkpoint.c +++ b/ft/tests/cachetable-unpin-remove-and-checkpoint.c @@ -16,8 +16,6 @@ static void *run_end_chkpt(void *arg) { int r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL ); diff --git a/ft/tests/test4302.c b/ft/tests/test4302.c index 08540364502..33ad5b09a75 100644 --- a/ft/tests/test4302.c +++ b/ft/tests/test4302.c @@ -155,8 +155,6 @@ cachetable_test (void) { r = toku_cachetable_end_checkpoint( ct, NULL, - fake_ydb_lock, - fake_ydb_unlock, NULL, NULL );