Commit 1ce2303c authored by Yoni Fogel's avatar Yoni Fogel

Addresses #918

Merge 'convert to array on rebalancing root' change

git-svn-id: file:///svn/tokudb@4576 c7de825b-a66e-492c-adef-691d508d4ae1
parent 88b08c3d
......@@ -300,6 +300,14 @@ static inline void rebuild_subtree_from_idxs(OMT omt, node_idx *n_idxp, node_idx
static inline void rebalance(OMT omt, node_idx *n_idxp) {
node_idx idx = *n_idxp;
if (idx==omt->i.t.root) {
//Try to convert to an array.
//If this fails, (malloc) nothing will have changed.
//In the failure case we continue on to the standard rebalance
//algorithm.
int r = omt_convert_to_array(omt);
if (r==0) return;
}
OMT_NODE n = omt->i.t.nodes+idx;
fill_array_with_subtree_idxs(omt, omt->i.t.tmparray, idx);
rebuild_subtree_from_idxs(omt, n_idxp, omt->i.t.tmparray, n->weight);
......
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