Commit 70298def authored by Yoni Fogel's avatar Yoni Fogel

refs #5461 Crash (rare) bugfix in cachetable when unpinnning a node that is pinned by 256k readers.

Also some minor cleanup based on code review

git-svn-id: file:///svn/toku/tokudb@47735 c7de825b-a66e-492c-adef-691d508d4ae1
parent 3bd32d9f
......@@ -1936,7 +1936,7 @@ cachetable_unpin_internal(
if (attr.is_valid) {
p->attr = attr;
}
bool read_lock_grabbed = p->value_rwlock.readers();
bool read_lock_grabbed = p->value_rwlock.readers() != 0;
unpin_pair(p, read_lock_grabbed);
pair_unlock(p);
......@@ -2121,6 +2121,10 @@ try_again:
pair_lock(p);
// grab expensive write lock, because we are about to do a fetch
// off disk
// No one can access this pair because
// we hold the write list lock and we just injected
// the pair into the cachetable. Therefore, this lock acquisition
// will not block.
p->value_rwlock.write_lock(true);
pair_unlock(p);
run_unlockers(unlockers); // we hold the write list_lock.
......@@ -2247,7 +2251,7 @@ int toku_cachetable_get_and_pin_nonblocking (
CACHEKEY key,
uint32_t fullhash,
void**value,
long* UU(sizep),
long* sizep,
CACHETABLE_WRITE_CALLBACK write_callback,
CACHETABLE_FETCH_CALLBACK fetch_callback,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK pf_req_callback,
......
......@@ -362,8 +362,8 @@ int toku_cachetable_get_and_pin_nonblocking_batched (
long *sizep,
CACHETABLE_WRITE_CALLBACK write_callback,
CACHETABLE_FETCH_CALLBACK fetch_callback,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK pf_req_callback __attribute__((unused)),
CACHETABLE_PARTIAL_FETCH_CALLBACK pf_callback __attribute__((unused)),
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK pf_req_callback,
CACHETABLE_PARTIAL_FETCH_CALLBACK pf_callback,
pair_lock_type lock_type,
void *read_extraargs, // parameter for fetch_callback, pf_req_callback, and pf_callback
UNLOCKERS unlockers
......
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