Commit 74241678 authored by Rich Prohaska's avatar Rich Prohaska

remove cursor count from the brt node. closes #310

git-svn-id: file:///svn/tokudb@1914 c7de825b-a66e-492c-adef-691d508d4ae1
parent fb4bb998
...@@ -39,7 +39,6 @@ struct brtnode_nonleaf_childinfo { ...@@ -39,7 +39,6 @@ struct brtnode_nonleaf_childinfo {
DISKOFF diskoff; DISKOFF diskoff;
FIFO htable; FIFO htable;
unsigned int n_bytes_in_buffer; /* How many bytes are in each buffer (including overheads for the disk-representation) */ unsigned int n_bytes_in_buffer; /* How many bytes are in each buffer (including overheads for the disk-representation) */
unsigned int n_cursors;
#endif #endif
}; };
...@@ -92,7 +91,6 @@ struct brtnode { ...@@ -92,7 +91,6 @@ struct brtnode {
#define BRTNODE_CHILD_DISKOFF(node,i) ((node)->u.n.children[i]) #define BRTNODE_CHILD_DISKOFF(node,i) ((node)->u.n.children[i])
FIFO buffers[TREE_FANOUT+1]; FIFO buffers[TREE_FANOUT+1];
unsigned int n_bytes_in_buffer[TREE_FANOUT+1]; /* how many bytes are in each buffer (including overheads) */ unsigned int n_bytes_in_buffer[TREE_FANOUT+1]; /* how many bytes are in each buffer (including overheads) */
unsigned int n_cursors[TREE_FANOUT+1];
#endif #endif
} n; } n;
struct leaf { struct leaf {
......
...@@ -284,7 +284,6 @@ int toku_deserialize_brtnode_from (int fd, DISKOFF off, BRTNODE *brtnode, int fl ...@@ -284,7 +284,6 @@ int toku_deserialize_brtnode_from (int fd, DISKOFF off, BRTNODE *brtnode, int fl
result->u.n.children[i]=0; result->u.n.children[i]=0;
result->u.n.buffers[i]=0; result->u.n.buffers[i]=0;
result->u.n.n_bytes_in_buffer[i]=0; result->u.n.n_bytes_in_buffer[i]=0;
result->u.n.n_cursors[i]=0;
} }
u_int32_t subtree_fingerprint = rbuf_int(&rc); u_int32_t subtree_fingerprint = rbuf_int(&rc);
u_int32_t check_subtree_fingerprint = 0; u_int32_t check_subtree_fingerprint = 0;
......
...@@ -54,7 +54,6 @@ void toku_brtnode_free (BRTNODE *nodep) { ...@@ -54,7 +54,6 @@ void toku_brtnode_free (BRTNODE *nodep) {
if (node->u.n.buffers[i]) { if (node->u.n.buffers[i]) {
toku_fifo_free(&node->u.n.buffers[i]); toku_fifo_free(&node->u.n.buffers[i]);
} }
assert(node->u.n.n_cursors[i] == 0);
} }
} else { } else {
if (node->u.l.buffer) // The buffer may have been freed already, in some cases. if (node->u.l.buffer) // The buffer may have been freed already, in some cases.
...@@ -270,7 +269,6 @@ static void initialize_brtnode (BRT t, BRTNODE n, DISKOFF nodename, int height) ...@@ -270,7 +269,6 @@ static void initialize_brtnode (BRT t, BRTNODE n, DISKOFF nodename, int height)
// n->u.n.children[i] = 0; // n->u.n.children[i] = 0;
// n->u.n.buffers[i] = 0; // n->u.n.buffers[i] = 0;
n->u.n.n_bytes_in_buffer[i] = 0; n->u.n.n_bytes_in_buffer[i] = 0;
n->u.n.n_cursors[i] = 0; // This one is simpler to initialize properly
} }
n->u.n.n_bytes_in_buffers = 0; n->u.n.n_bytes_in_buffers = 0;
} else { } else {
...@@ -321,7 +319,6 @@ static void delete_node (BRT t, BRTNODE node) { ...@@ -321,7 +319,6 @@ static void delete_node (BRT t, BRTNODE node) {
toku_fifo_free(&node->u.n.buffers[i]); toku_fifo_free(&node->u.n.buffers[i]);
} }
node->u.n.n_bytes_in_buffer[0]=0; node->u.n.n_bytes_in_buffer[0]=0;
assert(node->u.n.n_cursors[i] == 0);
} }
node->u.n.n_bytes_in_buffers = 0; node->u.n.n_bytes_in_buffers = 0;
node->u.n.totalchildkeylens=0; node->u.n.totalchildkeylens=0;
...@@ -615,11 +612,9 @@ static int handle_split_of_child (BRT t, BRTNODE node, int childnum, ...@@ -615,11 +612,9 @@ static int handle_split_of_child (BRT t, BRTNODE node, int childnum,
node->u.n.buffers[cnum] = node->u.n.buffers[cnum-1]; node->u.n.buffers[cnum] = node->u.n.buffers[cnum-1];
BRTNODE_CHILD_SUBTREE_FINGERPRINTS(node, cnum) = BRTNODE_CHILD_SUBTREE_FINGERPRINTS(node, cnum-1); BRTNODE_CHILD_SUBTREE_FINGERPRINTS(node, cnum) = BRTNODE_CHILD_SUBTREE_FINGERPRINTS(node, cnum-1);
node->u.n.n_bytes_in_buffer[cnum] = node->u.n.n_bytes_in_buffer[cnum-1]; node->u.n.n_bytes_in_buffer[cnum] = node->u.n.n_bytes_in_buffer[cnum-1];
node->u.n.n_cursors[cnum] = node->u.n.n_cursors[cnum-1];
} }
BRTNODE_CHILD_DISKOFF(node, childnum) = childa->thisnodename; BRTNODE_CHILD_DISKOFF(node, childnum) = childa->thisnodename;
BRTNODE_CHILD_DISKOFF(node, childnum+1) = childb->thisnodename; BRTNODE_CHILD_DISKOFF(node, childnum+1) = childb->thisnodename;
node->u.n.n_cursors[childnum+1] = 0;
fixup_child_fingerprint(node, childnum, childa, t, txn); fixup_child_fingerprint(node, childnum, childa, t, txn);
fixup_child_fingerprint(node, childnum+1, childb, t, txn); fixup_child_fingerprint(node, childnum+1, childb, t, txn);
r=toku_fifo_create(&node->u.n.buffers[childnum]); assert(r==0); // ??? SHould handle this error case r=toku_fifo_create(&node->u.n.buffers[childnum]); assert(r==0); // ??? SHould handle this error case
...@@ -999,19 +994,6 @@ static int brt_nonleaf_put_cmd_child (BRT t, BRTNODE node, BRT_CMD *cmd, ...@@ -999,19 +994,6 @@ static int brt_nonleaf_put_cmd_child (BRT t, BRTNODE node, BRT_CMD *cmd,
int debug, TOKUTXN txn, unsigned int childnum, int can_push, int *do_push_down) { int debug, TOKUTXN txn, unsigned int childnum, int can_push, int *do_push_down) {
//verify_local_fingerprint_nonleaf(node); //verify_local_fingerprint_nonleaf(node);
/* non-buffering mode when cursors are open on this child */
if (node->u.n.n_cursors[childnum] > 0) {
assert(node->u.n.n_bytes_in_buffer[childnum] == 0);
int r = brt_nonleaf_put_cmd_child_node(t, node, cmd, did_split, nodea, nodeb, splitk, debug, txn, childnum, 0);
//if (*did_split) {
// verify_local_fingerprint_nonleaf(*nodea);
// verify_local_fingerprint_nonleaf(*nodeb);
//} else {
// verify_local_fingerprint_nonleaf(node);
//}
return r;
}
/* try to push the cmd to the subtree if the buffer is empty and pushes are enabled */ /* try to push the cmd to the subtree if the buffer is empty and pushes are enabled */
if (node->u.n.n_bytes_in_buffer[childnum] == 0 && can_push && toku_brt_do_push_cmd) { if (node->u.n.n_bytes_in_buffer[childnum] == 0 && can_push && toku_brt_do_push_cmd) {
int r = brt_nonleaf_put_cmd_child_node(t, node, cmd, did_split, nodea, nodeb, splitk, debug, txn, childnum, 1); int r = brt_nonleaf_put_cmd_child_node(t, node, cmd, did_split, nodea, nodeb, splitk, debug, txn, childnum, 1);
......
...@@ -235,7 +235,6 @@ void toku_recover_addchild (struct logtype_addchild *le) { ...@@ -235,7 +235,6 @@ void toku_recover_addchild (struct logtype_addchild *le) {
BRTNODE_CHILD_DISKOFF(node,i) = BRTNODE_CHILD_DISKOFF(node, i-1); BRTNODE_CHILD_DISKOFF(node,i) = BRTNODE_CHILD_DISKOFF(node, i-1);
node->u.n.buffers[i] = node->u.n.buffers[i-1]; node->u.n.buffers[i] = node->u.n.buffers[i-1];
node->u.n.n_bytes_in_buffer[i] = node->u.n.n_bytes_in_buffer[i-1]; node->u.n.n_bytes_in_buffer[i] = node->u.n.n_bytes_in_buffer[i-1];
node->u.n.n_cursors[i] = node->u.n.n_cursors[i-1];
if (i!=(unsigned int)node->u.n.n_children) { if (i!=(unsigned int)node->u.n.n_children) {
node->u.n.childkeys [i]= node->u.n.childkeys [i-1]; node->u.n.childkeys [i]= node->u.n.childkeys [i-1];
} }
...@@ -245,7 +244,6 @@ void toku_recover_addchild (struct logtype_addchild *le) { ...@@ -245,7 +244,6 @@ void toku_recover_addchild (struct logtype_addchild *le) {
node->u.n.children [le->childnum] = -1; node->u.n.children [le->childnum] = -1;
int r= toku_fifo_create(&node->u.n.buffers[le->childnum]); assert(r==0); int r= toku_fifo_create(&node->u.n.buffers[le->childnum]); assert(r==0);
node->u.n.n_bytes_in_buffer[le->childnum] = 0; node->u.n.n_bytes_in_buffer[le->childnum] = 0;
node->u.n.n_cursors[le->childnum] = 0;
node->u.n.n_children++; node->u.n.n_children++;
node->log_lsn = le->lsn; node->log_lsn = le->lsn;
r = toku_cachetable_unpin(cf, le->diskoff, 1, toku_serialize_brtnode_size(node)); r = toku_cachetable_unpin(cf, le->diskoff, 1, toku_serialize_brtnode_size(node));
......
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