From e55956a5913f67a76ceee256ecaad6d774a649bc Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 21 Aug 2015 21:40:33 +0100 Subject: [PATCH 1/9] Another MDB_APPEND doc tweak Missed this in 7ce29b9edbdaf34b7aeb545324008ed4dff62952 --- libraries/liblmdb/lmdb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/liblmdb/lmdb.h b/libraries/liblmdb/lmdb.h index 762dba2ec2..bc332eba11 100644 --- a/libraries/liblmdb/lmdb.h +++ b/libraries/liblmdb/lmdb.h @@ -1442,7 +1442,7 @@ int mdb_cursor_get(MDB_cursor *cursor, MDB_val *key, MDB_val *data, * database. No key comparisons are performed. This option allows * fast bulk loading when keys are already known to be in the * correct order. Loading unsorted keys with this flag will cause - * data corruption. + * a #MDB_KEYEXIST error. *
  • #MDB_APPENDDUP - as above, but for sorted dup data. *
  • #MDB_MULTIPLE - store multiple contiguous data elements in a * single request. This flag may only be specified if the database From d7e4e206ad48878a3eba7dab61bbc7d3b6614944 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 21 Aug 2015 21:42:25 +0100 Subject: [PATCH 2/9] Return to release engineering --- libraries/liblmdb/CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/liblmdb/CHANGES b/libraries/liblmdb/CHANGES index bc39d82ab5..5ad64ecf39 100644 --- a/libraries/liblmdb/CHANGES +++ b/libraries/liblmdb/CHANGES @@ -1,5 +1,7 @@ LMDB 0.9 Change Log +LMDB 0.9.17 Release Engineering + LMDB 0.9.16 Release (2015/08/14) Fix cursor EOF bug (ITS#8190) Fix handling of subDB records (ITS#8181) From 9a8d38a9de1f03786da61a5515998afc3fa6db43 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 22 Aug 2015 14:00:12 +0100 Subject: [PATCH 3/9] Doc tweak - MDB_RESERVE / DUPSORT incompat For those people who insist on ignoring the obvious. --- libraries/liblmdb/lmdb.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/liblmdb/lmdb.h b/libraries/liblmdb/lmdb.h index bc332eba11..c5e5c9bf12 100644 --- a/libraries/liblmdb/lmdb.h +++ b/libraries/liblmdb/lmdb.h @@ -1280,7 +1280,8 @@ int mdb_get(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data); * the next update operation or the transaction ends. This saves * an extra memcpy if the data is being generated later. * LMDB does nothing else with this memory, the caller is expected - * to modify all of the space requested. + * to modify all of the space requested. This flag must not be + * specified if the database was opened with #MDB_DUPSORT. *
  • #MDB_APPEND - append the given key/data pair to the end of the * database. This option allows fast bulk loading when keys are * already known to be in the correct order. Loading unsorted keys @@ -1437,7 +1438,8 @@ int mdb_cursor_get(MDB_cursor *cursor, MDB_val *key, MDB_val *data, *
  • #MDB_RESERVE - reserve space for data of the given size, but * don't copy the given data. Instead, return a pointer to the * reserved space, which the caller can fill in later. This saves - * an extra memcpy if the data is being generated later. + * an extra memcpy if the data is being generated later. This flag + * must not be specified if the database was opened with #MDB_DUPSORT. *
  • #MDB_APPEND - append the given key/data pair to the end of the * database. No key comparisons are performed. This option allows * fast bulk loading when keys are already known to be in the From 7f151b113738e0f94d6477c8028f3318fc34a2d9 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Sun, 23 Aug 2015 11:12:45 +0200 Subject: [PATCH 4/9] ITS#7377 mdb_env_init_meta(): Catch calloc error --- libraries/liblmdb/mdb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index b5d59bcdb1..087f19837b 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -3553,6 +3553,9 @@ mdb_env_init_meta(MDB_env *env, MDB_meta *meta) mdb_env_init_meta0(env, meta); p = calloc(2, psize); + if (!p) + return ENOMEM; + p->mp_pgno = 0; p->mp_flags = P_META; *(MDB_meta *)METADATA(p) = *meta; From d84fae3fe31cde7e5ca874280e64d33bd289c261 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 6 Sep 2015 19:18:19 +0100 Subject: [PATCH 5/9] ITS#8237 fix ITS#7589 regression --- libraries/liblmdb/mdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 087f19837b..4e93abcad4 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -8167,7 +8167,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno psize = 0; if (newindx <= split_indx || newindx >= nkeys) { i = 0; j = 1; - k = newindx >= nkeys ? nkeys : split_indx+2; + k = newindx >= nkeys ? nkeys : split_indx+1+IS_LEAF(mp); } else { i = nkeys; j = -1; k = split_indx-1; From faeaa3ae8f4fd848c885fee266626f8668bf28ac Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 12 Sep 2015 23:08:14 +0100 Subject: [PATCH 6/9] ITS#7377, 8237 --- libraries/liblmdb/CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/liblmdb/CHANGES b/libraries/liblmdb/CHANGES index 5ad64ecf39..c44f47d38a 100644 --- a/libraries/liblmdb/CHANGES +++ b/libraries/liblmdb/CHANGES @@ -1,6 +1,8 @@ LMDB 0.9 Change Log LMDB 0.9.17 Release Engineering + Fix ITS#7377 catch calloc failure + Fix ITS#8237 regression from ITS#7589 LMDB 0.9.16 Release (2015/08/14) Fix cursor EOF bug (ITS#8190) From ddb7478e063610987908c5e669f7a7598d40a6c2 Mon Sep 17 00:00:00 2001 From: Luke Yeager Date: Fri, 18 Sep 2015 18:06:43 -0700 Subject: [PATCH 7/9] ITS#8256 Create install directories if needed --- libraries/liblmdb/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/liblmdb/Makefile b/libraries/liblmdb/Makefile index 2d0983eff0..62b52a9ad1 100644 --- a/libraries/liblmdb/Makefile +++ b/libraries/liblmdb/Makefile @@ -36,6 +36,10 @@ PROGS = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5 all: $(ILIBS) $(PROGS) install: $(ILIBS) $(IPROGS) $(IHDRS) + mkdir -p $(DESTDIR)$(prefix)/bin + mkdir -p $(DESTDIR)$(prefix)/lib + mkdir -p $(DESTDIR)$(prefix)/include + mkdir -p $(DESTDIR)$(prefix)/man/man1 for f in $(IPROGS); do cp $$f $(DESTDIR)$(prefix)/bin; done for f in $(ILIBS); do cp $$f $(DESTDIR)$(prefix)/lib; done for f in $(IHDRS); do cp $$f $(DESTDIR)$(prefix)/include; done From 4b01cb37278832548720cdf5a154fc9a44584be1 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 26 Sep 2015 16:50:28 +0100 Subject: [PATCH 8/9] ITS#8221 don't merge branch pages needlessly --- libraries/liblmdb/mdb.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 4e93abcad4..50d359ebb0 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -7685,17 +7685,23 @@ mdb_rebalance(MDB_cursor *mc) { MDB_node *node; int rc; - unsigned int ptop, minkeys; + unsigned int ptop, minkeys, thresh; MDB_cursor mn; indx_t oldki; - minkeys = 1 + (IS_BRANCH(mc->mc_pg[mc->mc_top])); + if (IS_BRANCH(mc->mc_pg[mc->mc_top])) { + minkeys = 1; + thresh = 1; + } else { + minkeys = 2; + thresh = FILL_THRESHOLD; + } DPRINTF(("rebalancing %s page %"Z"u (has %u keys, %.1f%% full)", IS_LEAF(mc->mc_pg[mc->mc_top]) ? "leaf" : "branch", mdb_dbg_pgno(mc->mc_pg[mc->mc_top]), NUMKEYS(mc->mc_pg[mc->mc_top]), (float)PAGEFILL(mc->mc_txn->mt_env, mc->mc_pg[mc->mc_top]) / 10)); - if (PAGEFILL(mc->mc_txn->mt_env, mc->mc_pg[mc->mc_top]) >= FILL_THRESHOLD && + if (PAGEFILL(mc->mc_txn->mt_env, mc->mc_pg[mc->mc_top]) >= thresh && NUMKEYS(mc->mc_pg[mc->mc_top]) >= minkeys) { DPRINTF(("no need to rebalance page %"Z"u, above fill threshold", mdb_dbg_pgno(mc->mc_pg[mc->mc_top]))); @@ -7829,8 +7835,7 @@ mdb_rebalance(MDB_cursor *mc) * move one key from it. Otherwise we should try to merge them. * (A branch page must never have less than 2 keys.) */ - 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]) >= thresh && NUMKEYS(mn.mc_pg[mn.mc_top]) > minkeys) { rc = mdb_node_move(&mn, mc); if (mc->mc_ki[ptop]) { oldki++; From bc7d3d9124b6de5d595f076c03b56b4fd8e575a5 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 27 Sep 2015 22:37:28 +0100 Subject: [PATCH 9/9] ITS#8221, #8256 --- libraries/liblmdb/CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/liblmdb/CHANGES b/libraries/liblmdb/CHANGES index c44f47d38a..a6304660bb 100644 --- a/libraries/liblmdb/CHANGES +++ b/libraries/liblmdb/CHANGES @@ -3,6 +3,9 @@ LMDB 0.9 Change Log LMDB 0.9.17 Release Engineering Fix ITS#7377 catch calloc failure Fix ITS#8237 regression from ITS#7589 + Fix ITS#8221 MDB_PAGE_FULL on delete/rebalance + Build + Create install dirs if needed (ITS#8256) LMDB 0.9.16 Release (2015/08/14) Fix cursor EOF bug (ITS#8190)