From: Hallvard Furuseth Date: Fri, 30 May 2014 08:47:56 +0000 (+0200) Subject: More for big MDB_MAXKEYSIZE with MDB_DUPSORT. X-Git-Tag: accepted/tizen/5.0/unified/20181102.030725~417 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=64a02e22799da289314001e16bfc6d2e89f63601;p=platform%2Fupstream%2Flmdb.git 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. --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 91fc570..94c7ffc 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -6170,7 +6170,7 @@ new_sub: } else { /* There is room already in this leaf page. */ 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 */ MDB_cursor *m2, *m3; MDB_dbi dbi = mc->mc_dbi; @@ -6245,7 +6245,10 @@ put_sub: /* Increment count unless we just replaced an existing item. */ if (insert_data) 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, * make sure the cursor is marked valid. */