mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 23:04:20 +01:00
sequential insert leaf split at 1/4 of the original node. addresses #1195
git-svn-id: file:///svn/toku/tokudb.1195@7641 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
6bfb7722fd
commit
656daf1a7b
1 changed files with 7 additions and 4 deletions
11
newbrt/brt.c
11
newbrt/brt.c
|
@ -727,8 +727,6 @@ brtleaf_split (TOKULOGGER logger, FILENUM filenum, BRT t, BRTNODE node, BRTNODE
|
||||||
|
|
||||||
u_int32_t n_leafentries = toku_omt_size(node->u.l.buffer);
|
u_int32_t n_leafentries = toku_omt_size(node->u.l.buffer);
|
||||||
u_int32_t break_at = 0;
|
u_int32_t break_at = 0;
|
||||||
node->u.l.seqinsert = 0;
|
|
||||||
// Don't mess around with splitting specially for sequential insertions any more.
|
|
||||||
{
|
{
|
||||||
OMTVALUE *MALLOC_N(n_leafentries, leafentries);
|
OMTVALUE *MALLOC_N(n_leafentries, leafentries);
|
||||||
assert(leafentries);
|
assert(leafentries);
|
||||||
|
@ -739,10 +737,15 @@ brtleaf_split (TOKULOGGER logger, FILENUM filenum, BRT t, BRTNODE node, BRTNODE
|
||||||
u_int32_t sumlesizes=0;
|
u_int32_t sumlesizes=0;
|
||||||
for (i=0; i<n_leafentries; i++) sumlesizes += leafentry_disksize(leafentries[i]);
|
for (i=0; i<n_leafentries; i++) sumlesizes += leafentry_disksize(leafentries[i]);
|
||||||
u_int32_t sumsofar=0;
|
u_int32_t sumsofar=0;
|
||||||
for (i=0; i<n_leafentries; i++) {
|
// split in half if not sequentially inserted
|
||||||
|
// otherwise put 1/4 in the new node (current minimum size given the node fusing algorithm)
|
||||||
|
u_int32_t f = 2; // 1/2
|
||||||
|
if (node->u.l.seqinsert*2 >= n_leafentries) f = 4; // 1/4
|
||||||
|
node->u.l.seqinsert = 0;
|
||||||
|
for (i=n_leafentries-1; i>0; i--) {
|
||||||
assert(toku_mempool_inrange(&node->u.l.buffer_mempool, leafentries[i], leafentry_memsize(leafentries[i])));
|
assert(toku_mempool_inrange(&node->u.l.buffer_mempool, leafentries[i], leafentry_memsize(leafentries[i])));
|
||||||
sumsofar += leafentry_disksize(leafentries[i]);
|
sumsofar += leafentry_disksize(leafentries[i]);
|
||||||
if (sumsofar*2 >= sumlesizes) {
|
if (sumsofar*f >= sumlesizes) {
|
||||||
break_at = i;
|
break_at = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue