More for big MDB_MAXKEYSIZE with MDB_DUPSORT.

With mdb_cursor_put(new key, data item big enough to need a sub-DB):
- Track cursors as when adding other nodes.  The "!do_sub" is now
  unneeded.  Before ITS#7861 it distinguished inserting key from data.
- Set MDB_TXN_ERROR if an empty sub-DB was created.  I.e. adding
  key:subDB succeeded, but inserting the data item failed.
incre
Hallvard Furuseth 11 years ago
parent b37b2a651f
commit 64a02e2279
  1. 7
      libraries/liblmdb/mdb.c

@ -6170,7 +6170,7 @@ new_sub:
} else { } else {
/* There is room already in this leaf page. */ /* There is room already in this leaf page. */
rc = mdb_node_add(mc, mc->mc_ki[mc->mc_top], key, rdata, 0, nflags); rc = mdb_node_add(mc, mc->mc_ki[mc->mc_top], key, rdata, 0, nflags);
if (rc == 0 && !do_sub && insert_key) { if (rc == 0 && insert_key) {
/* Adjust other cursors pointing to mp */ /* Adjust other cursors pointing to mp */
MDB_cursor *m2, *m3; MDB_cursor *m2, *m3;
MDB_dbi dbi = mc->mc_dbi; MDB_dbi dbi = mc->mc_dbi;
@ -6245,7 +6245,10 @@ put_sub:
/* Increment count unless we just replaced an existing item. */ /* Increment count unless we just replaced an existing item. */
if (insert_data) if (insert_data)
mc->mc_db->md_entries++; mc->mc_db->md_entries++;
if (!rc && insert_key) { if (insert_key) {
/* Invalidate txn if we created an empty sub-DB */
if (rc)
goto bad_sub;
/* If we succeeded and the key didn't exist before, /* If we succeeded and the key didn't exist before,
* make sure the cursor is marked valid. * make sure the cursor is marked valid.
*/ */

Loading…
Cancel
Save