Tweak prev commit

If somehow "need" is larger than the list size, don't
try to fake out the dirty list.
vmware
Howard Chu 11 years ago
parent 7b1db13050
commit 45c4ed1805
  1. 7
      libraries/liblmdb/mdb.c

@ -1479,7 +1479,6 @@ mdb_page_spill(MDB_cursor *m0, MDB_val *key, MDB_val *data)
* better than 1/2, 1/4, or 1/10. * better than 1/2, 1/4, or 1/10.
*/ */
k = 0; k = 0;
need *= 100;
if (need < MDB_IDL_UM_MAX / 8) if (need < MDB_IDL_UM_MAX / 8)
need = MDB_IDL_UM_MAX / 8; need = MDB_IDL_UM_MAX / 8;
@ -1519,22 +1518,27 @@ mdb_page_spill(MDB_cursor *m0, MDB_val *key, MDB_val *data)
*/ */
{ {
MDB_ID2 old; MDB_ID2 old;
if (i) {
k = dl[0].mid - i + 1; k = dl[0].mid - i + 1;
old = dl[i-1]; old = dl[i-1];
dl[i-1].mid = k; dl[i-1].mid = k;
txn->mt_u.dirty_list = &dl[i-1]; txn->mt_u.dirty_list = &dl[i-1];
}
rc = mdb_page_flush(txn); rc = mdb_page_flush(txn);
if (i) {
/* reset back to the real list */ /* reset back to the real list */
dl[0].mid -= k; dl[0].mid -= k;
dl[0].mid += dl[i-1].mid; dl[0].mid += dl[i-1].mid;
dl[i-1] = old; dl[i-1] = old;
txn->mt_u.dirty_list = dl; txn->mt_u.dirty_list = dl;
} }
}
mdb_cursorpages_mark(m0, P_DIRTY|P_KEEP); mdb_cursorpages_mark(m0, P_DIRTY|P_KEEP);
if (i) {
/* Reset any dirty root pages we kept that page_flush didn't see */ /* Reset any dirty root pages we kept that page_flush didn't see */
for (i=0; i<txn->mt_numdbs; i++) { for (i=0; i<txn->mt_numdbs; i++) {
if (txn->mt_dbflags[i] & DB_DIRTY) { if (txn->mt_dbflags[i] & DB_DIRTY) {
@ -1547,6 +1551,7 @@ mdb_page_spill(MDB_cursor *m0, MDB_val *key, MDB_val *data)
dp->mp_flags ^= P_KEEP; dp->mp_flags ^= P_KEEP;
} }
} }
}
done: done:
if (rc == 0) { if (rc == 0) {

Loading…
Cancel
Save