Revert "ITS#7772 Reduce spurious sub-page growth."

This reverts commit 75494c08b4,
which must await a fix to ITS#7771 (DUPSORT cursor tracking).
vmware
Hallvard Furuseth 11 years ago
parent 3f241365d5
commit 98f3bc88bf
  1. 20
      libraries/liblmdb/mdb.c

@ -5912,7 +5912,7 @@ more:
* it. mp: new (sub-)page. offset: growth in page * it. mp: new (sub-)page. offset: growth in page
* size. xdata: node data with new page or DB. * size. xdata: node data with new page or DB.
*/ */
ssize_t i, offset = 0; unsigned i, offset = 0;
mp = fp = xdata.mv_data = env->me_pbuf; mp = fp = xdata.mv_data = env->me_pbuf;
mp->mp_pgno = mc->mc_pg[mc->mc_top]->mp_pgno; mp->mp_pgno = mc->mc_pg[mc->mc_top]->mp_pgno;
@ -5968,17 +5968,17 @@ more:
fp = olddata.mv_data; fp = olddata.mv_data;
switch (flags) { switch (flags) {
default: default:
i = -(ssize_t)SIZELEFT(fp);
if (!(mc->mc_db->md_flags & MDB_DUPFIXED)) { if (!(mc->mc_db->md_flags & MDB_DUPFIXED)) {
offset = i += (ssize_t) EVEN( offset = EVEN(NODESIZE + sizeof(indx_t) +
sizeof(indx_t) + NODESIZE + data->mv_size); data->mv_size);
} else { break;
i += offset = fp->mp_pad;
offset *= 4; /* space for 4 more */
} }
if (i > 0) offset = fp->mp_pad;
if (SIZELEFT(fp) < offset) {
offset *= 4; /* space for 4 more */
break; break;
/* FALLTHRU: Sub-page is big enough */ }
/* FALLTHRU: Big enough MDB_DUPFIXED sub-page */
case MDB_CURRENT: case MDB_CURRENT:
fp->mp_flags |= P_DIRTY; fp->mp_flags |= P_DIRTY;
COPY_PGNO(fp->mp_pgno, mp->mp_pgno); COPY_PGNO(fp->mp_pgno, mp->mp_pgno);
@ -6027,7 +6027,7 @@ prep_subDB:
} else { } else {
memcpy((char *)mp + mp->mp_upper, (char *)fp + fp->mp_upper, memcpy((char *)mp + mp->mp_upper, (char *)fp + fp->mp_upper,
olddata.mv_size - fp->mp_upper); olddata.mv_size - fp->mp_upper);
for (i = NUMKEYS(fp); --i >= 0; ) for (i=0; i<NUMKEYS(fp); i++)
mp->mp_ptrs[i] = fp->mp_ptrs[i] + offset; mp->mp_ptrs[i] = fp->mp_ptrs[i] + offset;
} }
} }

Loading…
Cancel
Save