Commit 1ead590a authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4281], grab fdlock around reading of fd in bring_node_fully_into_memory

git-svn-id: file:///svn/toku/tokudb@37884 c7de825b-a66e-492c-adef-691d508d4ae1
parent 34f96b56
......@@ -144,13 +144,18 @@ toku_brt_header_suppress_rollbacks(struct brt_header *h, TOKUTXN txn) {
h->root_that_created_or_locked_when_empty = rootid;
}
static bool is_entire_node_in_memory(BRTNODE node) {
for (int i = 0; i < node->n_children; i++) {
if(BP_STATE(node,i) != PT_AVAIL) {
return false;
}
}
return true;
}
void
toku_assert_entire_node_in_memory(BRTNODE node) {
for (int i = 0; i < node->n_children; i++) {
assert(BP_STATE(node,i) == PT_AVAIL);
}
assert(is_entire_node_in_memory(node));
}
static u_int32_t
......@@ -1941,11 +1946,14 @@ toku_bnc_flush_to_child(
void bring_node_fully_into_memory(BRTNODE node, struct brt_header* h)
{
struct brtnode_fetch_extra bfe;
PAIR_ATTR attr;
int fd = toku_cachefile_fd(h->cf);
fill_bfe_for_full_read(&bfe, h);
toku_brtnode_pf_callback(node, &bfe, fd, &attr);
if (!is_entire_node_in_memory(node)) {
struct brtnode_fetch_extra bfe;
PAIR_ATTR attr;
int fd = toku_cachefile_get_and_pin_fd(h->cf);
fill_bfe_for_full_read(&bfe, h);
toku_brtnode_pf_callback(node, &bfe, fd, &attr);
toku_cachefile_unpin_fd(h->cf);
}
}
static void
......
......@@ -471,10 +471,6 @@ cachefile_refup (CACHEFILE cf) {
cf->refcount++;
}
int toku_cachefile_fd(CACHEFILE cf) {
return cf->fd;
}
// What cachefile goes with particular iname (iname relative to env)?
// The transaction that is adding the reference might not have a reference
// to the brt, therefore the cachefile might be closing.
......
......@@ -60,10 +60,6 @@ int toku_cachefile_of_iname_in_env (CACHETABLE ct, const char *iname_in_env, CAC
// Return the filename
char * toku_cachefile_fname_in_cwd (CACHEFILE cf);
// return the fd
int toku_cachefile_fd(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,
......
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