Commit a0cff67f 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 ff70c77e
...@@ -144,13 +144,18 @@ toku_brt_header_suppress_rollbacks(struct brt_header *h, TOKUTXN txn) { ...@@ -144,13 +144,18 @@ toku_brt_header_suppress_rollbacks(struct brt_header *h, TOKUTXN txn) {
h->root_that_created_or_locked_when_empty = rootid; 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 void
toku_assert_entire_node_in_memory(BRTNODE node) { toku_assert_entire_node_in_memory(BRTNODE node) {
for (int i = 0; i < node->n_children; i++) { assert(is_entire_node_in_memory(node));
assert(BP_STATE(node,i) == PT_AVAIL);
}
} }
static u_int32_t static u_int32_t
...@@ -1941,11 +1946,14 @@ toku_bnc_flush_to_child( ...@@ -1941,11 +1946,14 @@ toku_bnc_flush_to_child(
void bring_node_fully_into_memory(BRTNODE node, struct brt_header* h) void bring_node_fully_into_memory(BRTNODE node, struct brt_header* h)
{ {
if (!is_entire_node_in_memory(node)) {
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
PAIR_ATTR attr; PAIR_ATTR attr;
int fd = toku_cachefile_fd(h->cf); int fd = toku_cachefile_get_and_pin_fd(h->cf);
fill_bfe_for_full_read(&bfe, h); fill_bfe_for_full_read(&bfe, h);
toku_brtnode_pf_callback(node, &bfe, fd, &attr); toku_brtnode_pf_callback(node, &bfe, fd, &attr);
toku_cachefile_unpin_fd(h->cf);
}
} }
static void static void
......
...@@ -471,10 +471,6 @@ cachefile_refup (CACHEFILE cf) { ...@@ -471,10 +471,6 @@ cachefile_refup (CACHEFILE cf) {
cf->refcount++; cf->refcount++;
} }
int toku_cachefile_fd(CACHEFILE cf) {
return cf->fd;
}
// What cachefile goes with particular iname (iname relative to env)? // What cachefile goes with particular iname (iname relative to env)?
// The transaction that is adding the reference might not have a reference // The transaction that is adding the reference might not have a reference
// to the brt, therefore the cachefile might be closing. // 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 ...@@ -60,10 +60,6 @@ int toku_cachefile_of_iname_in_env (CACHETABLE ct, const char *iname_in_env, CAC
// Return the filename // Return the filename
char * toku_cachefile_fname_in_cwd (CACHEFILE cf); 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 // TODO: #1510 Add comments on how these behave
int toku_cachetable_begin_checkpoint (CACHETABLE ct, TOKULOGGER); int toku_cachetable_begin_checkpoint (CACHETABLE ct, TOKULOGGER);
int toku_cachetable_end_checkpoint(CACHETABLE ct, TOKULOGGER logger, 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