Commit 6e4e5048 authored by Rich Prohaska's avatar Rich Prohaska

treak the seq insert algorithm. addresses #1003

git-svn-id: file:///svn/tokudb@5091 c7de825b-a66e-492c-adef-691d508d4ae1
parent d1b0c14f
...@@ -437,7 +437,7 @@ static int brtleaf_split (TOKULOGGER logger, FILENUM filenum, BRT t, BRTNODE nod ...@@ -437,7 +437,7 @@ static int brtleaf_split (TOKULOGGER logger, FILENUM filenum, BRT t, BRTNODE nod
assert(r == 0); assert(r == 0);
LEAFENTRY le = v; LEAFENTRY le = v;
node_size -= OMT_ITEM_OVERHEAD + leafentry_disksize(le); node_size -= OMT_ITEM_OVERHEAD + leafentry_disksize(le);
if (node_size <= node->nodesize) if (node_size <= node->nodesize && (n_leafentries - break_at) >= 2)
break; break;
break_at -= 1; break_at -= 1;
} }
...@@ -1603,10 +1603,22 @@ static int brt_leaf_put_cmd (BRT t, BRTNODE node, BRT_CMD cmd, ...@@ -1603,10 +1603,22 @@ static int brt_leaf_put_cmd (BRT t, BRTNODE node, BRT_CMD cmd,
r = brt_leaf_apply_cmd_once(t, node, cmd, logger, idx, storeddata); r = brt_leaf_apply_cmd_once(t, node, cmd, logger, idx, storeddata);
if (r!=0) return r; if (r!=0) return r;
if (idx == toku_omt_size(node->u.l.buffer)-1)
// if the insertion point is within a window of the right edge of
// the leaf then it is sequential
// window = min(32, number of leaf entries/16)
u_int32_t s = toku_omt_size(node->u.l.buffer);
u_int32_t w = s / 16;
if (w == 0) w = 1;
if (w > 32) w = 32;
// within the window?
if (s - idx <= w) {
node->u.l.seqinsert += 1; node->u.l.seqinsert += 1;
else if (node->u.l.seqinsert > 0) } else {
node->u.l.seqinsert -= 1; node->u.l.seqinsert = 0;
}
break; break;
case BRT_DELETE_BOTH: case BRT_DELETE_BOTH:
case BRT_ABORT_BOTH: case BRT_ABORT_BOTH:
......
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