From b0a6dbcc70f9504a4764ea26b104cc43c2456dc4 Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Thu, 22 Mar 2018 19:13:11 +0000 Subject: [PATCH 1/9] Return to engineering --- libraries/liblmdb/CHANGES | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/liblmdb/CHANGES b/libraries/liblmdb/CHANGES index 5d921dcb39..98ed23034f 100644 --- a/libraries/liblmdb/CHANGES +++ b/libraries/liblmdb/CHANGES @@ -1,6 +1,8 @@ LMDB 0.9 Change Log -LMDB 0.9.22 Release (2018-03-22) +LMDB 0.9.23 Engineering + +LMDB 0.9.22 Release (2018/03/22) Fix MDB_DUPSORT alignment bug (ITS#8819) Fix regression with new db from 0.9.19 (ITS#8760) Fix liblmdb to build on Solaris (ITS#8612) From 3b01bbbc67389b63e6623da99d397283729e70e7 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 2 May 2018 17:05:29 +0100 Subject: [PATCH 2/9] ITS#8844 use getpid() in mdb_env_close0() --- 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 d9e7c5e1eb..0662f2d8bf 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -5063,7 +5063,7 @@ mdb_env_close0(MDB_env *env, int excl) if (env->me_fd != INVALID_HANDLE_VALUE) (void) close(env->me_fd); if (env->me_txns) { - MDB_PID_T pid = env->me_pid; + MDB_PID_T pid = getpid(); /* Clearing readers is done in this function because * me_txkey with its destructor must be disabled first. * From 9e859dd1ca27ccf035701e0ae7fe39b9274ea8f9 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 2 Apr 2018 18:01:19 +0100 Subject: [PATCH 3/9] ITS#8831 move flag init into readhdr Avoid stomping on flags from 1st readhr invocation --- libraries/liblmdb/mdb_load.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/liblmdb/mdb_load.c b/libraries/liblmdb/mdb_load.c index cf1d42e93b..0f177f1ec2 100644 --- a/libraries/liblmdb/mdb_load.c +++ b/libraries/liblmdb/mdb_load.c @@ -68,6 +68,7 @@ static void readhdr(void) { char *ptr; + flags = 0; while (fgets(dbuf.mv_data, dbuf.mv_size, stdin) != NULL) { lineno++; if (!strncmp(dbuf.mv_data, "VERSION=", STRLENOF("VERSION="))) { @@ -374,7 +375,6 @@ int main(int argc, char *argv[]) while(!Eof) { MDB_val key, data; int batch = 0; - flags = 0; if (!dohdr) { dohdr = 1; From 1f33a6d9109792c0a2c88793092264080fe856b0 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 22 Jun 2018 16:30:13 +0100 Subject: [PATCH 4/9] ITS#8756 remove loose pg from dirty list in freelist_save --- libraries/liblmdb/mdb.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 0662f2d8bf..e12af4482a 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -3094,10 +3094,41 @@ mdb_freelist_save(MDB_txn *txn) * we may be unable to return them to me_pghead. */ MDB_page *mp = txn->mt_loose_pgs; + MDB_ID2 *dl = txn->mt_u.dirty_list; + unsigned x; if ((rc = mdb_midl_need(&txn->mt_free_pgs, txn->mt_loose_count)) != 0) return rc; - for (; mp; mp = NEXT_LOOSE_PAGE(mp)) + for (; mp; mp = NEXT_LOOSE_PAGE(mp)) { mdb_midl_xappend(txn->mt_free_pgs, mp->mp_pgno); + /* must also remove from dirty list */ + if (txn->mt_flags & MDB_TXN_WRITEMAP) { + for (x=1; x<=dl[0].mid; x++) + if (dl[x].mid == mp->mp_pgno) + break; + mdb_tassert(txn, x <= dl[0].mid); + } else { + x = mdb_mid2l_search(dl, mp->mp_pgno); + mdb_tassert(txn, dl[x].mid == mp->mp_pgno); + } + dl[x].mptr = NULL; + mdb_dpage_free(env, mp); + } + { + /* squash freed slots out of the dirty list */ + unsigned y; + for (y=1; dl[y].mptr && y <= dl[0].mid; y++); + if (y <= dl[0].mid) { + for(x=y, y++;;) { + while (!dl[y].mptr && y <= dl[0].mid) y++; + if (y > dl[0].mid) break; + dl[x++] = dl[y++]; + } + dl[0].mid = x-1; + } else { + /* all slots freed */ + dl[0].mid = 0; + } + } txn->mt_loose_pgs = NULL; txn->mt_loose_count = 0; } From 1105d2043e264fa57441833ab41d8f61c91c23d6 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 29 Aug 2018 01:25:01 +0100 Subject: [PATCH 5/9] ITS#8908 DOC: GET_MULTIPLE etc don't return the key Unnecessary since these are DUPs, the key will always be the same --- libraries/liblmdb/lmdb.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/liblmdb/lmdb.h b/libraries/liblmdb/lmdb.h index 32a278e362..e2db9ddef3 100644 --- a/libraries/liblmdb/lmdb.h +++ b/libraries/liblmdb/lmdb.h @@ -370,7 +370,7 @@ typedef enum MDB_cursor_op { MDB_GET_BOTH, /**< Position at key/data pair. Only for #MDB_DUPSORT */ MDB_GET_BOTH_RANGE, /**< position at key, nearest data. Only for #MDB_DUPSORT */ MDB_GET_CURRENT, /**< Return key/data at current cursor position */ - MDB_GET_MULTIPLE, /**< Return key and up to a page of duplicate data items + MDB_GET_MULTIPLE, /**< Return up to a page of duplicate data items from current cursor position. Move cursor to prepare for #MDB_NEXT_MULTIPLE. Only for #MDB_DUPFIXED */ MDB_LAST, /**< Position at last key/data item */ @@ -379,7 +379,7 @@ typedef enum MDB_cursor_op { MDB_NEXT, /**< Position at next data item */ MDB_NEXT_DUP, /**< Position at next data item of current key. Only for #MDB_DUPSORT */ - MDB_NEXT_MULTIPLE, /**< Return key and up to a page of duplicate data items + MDB_NEXT_MULTIPLE, /**< Return up to a page of duplicate data items from next cursor position. Move cursor to prepare for #MDB_NEXT_MULTIPLE. Only for #MDB_DUPFIXED */ MDB_NEXT_NODUP, /**< Position at first data item of next key */ @@ -390,7 +390,7 @@ typedef enum MDB_cursor_op { MDB_SET, /**< Position at specified key */ MDB_SET_KEY, /**< Position at specified key, return key + data */ MDB_SET_RANGE, /**< Position at first key greater than or equal to specified key. */ - MDB_PREV_MULTIPLE /**< Position at previous page and return key and up to + MDB_PREV_MULTIPLE /**< Position at previous page and return up to a page of duplicate data items. Only for #MDB_DUPFIXED */ } MDB_cursor_op; From 3bec2a82283ca6f7c54a56d518860bd01f651873 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 10 Sep 2018 16:24:51 +0100 Subject: [PATCH 6/9] Fix ITS#8756, 8831, 8844, 8908 --- libraries/liblmdb/CHANGES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/liblmdb/CHANGES b/libraries/liblmdb/CHANGES index 98ed23034f..f51f186e78 100644 --- a/libraries/liblmdb/CHANGES +++ b/libraries/liblmdb/CHANGES @@ -1,6 +1,11 @@ LMDB 0.9 Change Log LMDB 0.9.23 Engineering + ITS#8756 Fix loose pages in dirty list + ITS#8831 Fix mdb_load flag init + ITS#8844 Fix mdb_env_close in forked process + Documentation + ITS#8908 GET_MULTIPLE etc don't change passed in key LMDB 0.9.22 Release (2018/03/22) Fix MDB_DUPSORT alignment bug (ITS#8819) From 246e7e77c85b106d8788bcb1651320e2e30f8b81 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 15 May 2018 10:53:13 +0100 Subject: [PATCH 7/9] ITS#8857 document mdb_cursor_del does not invalidate the cursor --- libraries/liblmdb/lmdb.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/liblmdb/lmdb.h b/libraries/liblmdb/lmdb.h index e2db9ddef3..baa5cec51b 100644 --- a/libraries/liblmdb/lmdb.h +++ b/libraries/liblmdb/lmdb.h @@ -1510,6 +1510,10 @@ int mdb_cursor_put(MDB_cursor *cursor, MDB_val *key, MDB_val *data, /** @brief Delete current key/data pair * * This function deletes the key/data pair to which the cursor refers. + * This does not invalidate the cursor, so operations such as MDB_NEXT + * can still be used on it. + * Both MDB_NEXT and MDB_GET_CURRENT will return the same record after + * this operation. * @param[in] cursor A cursor handle returned by #mdb_cursor_open() * @param[in] flags Options for this operation. This parameter * must be set to 0 or one of the values described here. From ea4c969a2473085302c4d6d97476ae3594fc27ba Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 10 Sep 2018 19:06:45 +0100 Subject: [PATCH 8/9] ITS#8857 mdb_cursor_del --- libraries/liblmdb/CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/liblmdb/CHANGES b/libraries/liblmdb/CHANGES index f51f186e78..bcdca6b0a5 100644 --- a/libraries/liblmdb/CHANGES +++ b/libraries/liblmdb/CHANGES @@ -5,6 +5,7 @@ LMDB 0.9.23 Engineering ITS#8831 Fix mdb_load flag init ITS#8844 Fix mdb_env_close in forked process Documentation + ITS#8857 mdb_cursor_del doesn't invalidate cursor ITS#8908 GET_MULTIPLE etc don't change passed in key LMDB 0.9.22 Release (2018/03/22) From 2a5eaad6919ce6941dec4f0d5cce370707a00ba7 Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Wed, 19 Dec 2018 15:51:03 +0000 Subject: [PATCH 9/9] Release 0.9.23 --- libraries/liblmdb/CHANGES | 2 +- libraries/liblmdb/lmdb.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/liblmdb/CHANGES b/libraries/liblmdb/CHANGES index bcdca6b0a5..b1e9fa8e2b 100644 --- a/libraries/liblmdb/CHANGES +++ b/libraries/liblmdb/CHANGES @@ -1,6 +1,6 @@ LMDB 0.9 Change Log -LMDB 0.9.23 Engineering +LMDB 0.9.23 Release (2018/12/19) ITS#8756 Fix loose pages in dirty list ITS#8831 Fix mdb_load flag init ITS#8844 Fix mdb_env_close in forked process diff --git a/libraries/liblmdb/lmdb.h b/libraries/liblmdb/lmdb.h index baa5cec51b..fdf0d68141 100644 --- a/libraries/liblmdb/lmdb.h +++ b/libraries/liblmdb/lmdb.h @@ -200,7 +200,7 @@ typedef int mdb_filehandle_t; /** Library minor version */ #define MDB_VERSION_MINOR 9 /** Library patch version */ -#define MDB_VERSION_PATCH 22 +#define MDB_VERSION_PATCH 23 /** Combine args a,b,c into a single integer for easy version comparisons */ #define MDB_VERINT(a,b,c) (((a) << 24) | ((b) << 16) | (c)) @@ -210,7 +210,7 @@ typedef int mdb_filehandle_t; MDB_VERINT(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH) /** The release date of this library version */ -#define MDB_VERSION_DATE "March 21, 2018" +#define MDB_VERSION_DATE "December 19, 2018" /** A stringifier for the version info */ #define MDB_VERSTR(a,b,c,d) "LMDB " #a "." #b "." #c ": (" d ")"