ITS#7829 Simplify last commit

incre
Hallvard Furuseth 11 years ago
parent fca18d2586
commit 2764360a7b
  1. 11
      libraries/liblmdb/mdb.c

@ -7464,24 +7464,21 @@ mdb_rebalance(MDB_cursor *mc)
minkeys = 1 + (IS_BRANCH(mn.mc_pg[mn.mc_top])); minkeys = 1 + (IS_BRANCH(mn.mc_pg[mn.mc_top]));
if (PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) >= FILL_THRESHOLD && NUMKEYS(mn.mc_pg[mn.mc_top]) > minkeys) { if (PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) >= FILL_THRESHOLD && NUMKEYS(mn.mc_pg[mn.mc_top]) > minkeys) {
rc = mdb_node_move(&mn, mc); rc = mdb_node_move(&mn, mc);
if (mc->mc_ki[ptop] == 0) { if (mc->mc_ki[ptop]) {
mc->mc_ki[mc->mc_top] = oldki; oldki++;
} else {
mc->mc_ki[mc->mc_top] = oldki + 1;
} }
} else { } else {
if (mc->mc_ki[ptop] == 0) { if (mc->mc_ki[ptop] == 0) {
rc = mdb_page_merge(&mn, mc); rc = mdb_page_merge(&mn, mc);
mc->mc_ki[mc->mc_top] = oldki;
} else { } else {
unsigned int nkeys = NUMKEYS(mn.mc_pg[mn.mc_top]); oldki += NUMKEYS(mn.mc_pg[mn.mc_top]);
mn.mc_ki[mn.mc_top] += mc->mc_ki[mn.mc_top] + 1; mn.mc_ki[mn.mc_top] += mc->mc_ki[mn.mc_top] + 1;
rc = mdb_page_merge(mc, &mn); rc = mdb_page_merge(mc, &mn);
mc->mc_pg[mc->mc_top] = mn.mc_pg[mn.mc_top]; mc->mc_pg[mc->mc_top] = mn.mc_pg[mn.mc_top];
mc->mc_ki[mc->mc_top] = oldki + nkeys;
} }
mc->mc_flags &= ~C_EOF; mc->mc_flags &= ~C_EOF;
} }
mc->mc_ki[mc->mc_top] = oldki;
return rc; return rc;
} }

Loading…
Cancel
Save