]> git.sur5r.net Git - openldap/commitdiff
Merge remote-tracking branch 'origin/mdb.RE/0.9' into OPENLDAP_REL_ENG_2_4
authorQuanah Gibson-Mount <quanah@openldap.org>
Fri, 29 Jan 2016 01:15:30 +0000 (19:15 -0600)
committerQuanah Gibson-Mount <quanah@openldap.org>
Fri, 29 Jan 2016 01:15:30 +0000 (19:15 -0600)
libraries/liblmdb/CHANGES
libraries/liblmdb/lmdb.h
libraries/liblmdb/mdb.c
libraries/liblmdb/midl.c

index 6892dde1ef8cb7330f1f004a4039af57dd89d745..0c1295d3bd3102a281a9a376485e1fd3c651bfe9 100644 (file)
@@ -3,12 +3,17 @@ LMDB 0.9 Change Log
 LMDB 0.9.18 Release Engineering
        Fix robust mutex detection on glibc 2.10-11 (ITS#8330)
        Fix page_search_root assert on FreeDB (ITS#8336)
+       Fix MDB_APPENDDUP vs. rewrite(single item) (ITS#8334)
+       Fix mdb_copy of large files on Windows
+       Fix subcursor move after delete (ITS#8355)
+       Fix mdb_midl_shirnk off-by-one (ITS#8363)
        Check for utf8_to_utf16 failures (ITS#7992)
        Catch strdup failure in mdb_dbi_open
        Build
                Additional makefile var tweaks (ITS#8169)
        Documentation
                Add Getting Started page
+               Update WRITEMAP description
        
 
 LMDB 0.9.17 Release (2015/11/30)
index 8323af5ec0bd653693f9d541650da89da02f7302..0855da8e46e0f8553717d2d9dcc95ce482042cb7 100644 (file)
@@ -529,9 +529,11 @@ int  mdb_env_create(MDB_env **env);
         *              allowed. LMDB will still modify the lock file - except on read-only
         *              filesystems, where LMDB does not use locks.
         *      <li>#MDB_WRITEMAP
-        *              Use a writeable memory map unless MDB_RDONLY is set. This is faster
-        *              and uses fewer mallocs, but loses protection from application bugs
+        *              Use a writeable memory map unless MDB_RDONLY is set. This uses
+        *              fewer mallocs but loses protection from application bugs
         *              like wild pointer writes and other bad updates into the database.
+        *              This may be slightly faster for DBs that fit entirely in RAM, but
+        *              is slower for DBs larger than RAM.
         *              Incompatible with nested transactions.
         *              Do not mix processes with and without MDB_WRITEMAP on the same
         *              environment.  This can defeat durability (#mdb_env_sync etc).
index a624cba3c4f0418c9ab142b1d7032e78b8985ea6..319ba0aa541d2345312935bc44ae9fcf025e628d 100644 (file)
@@ -198,7 +198,7 @@ typedef SSIZE_T     ssize_t;
 #define ESECT
 #endif
 
-#ifdef _MSC_VER
+#ifdef _WIN32
 #define CALL_CONV WINAPI
 #else
 #define CALL_CONV
@@ -1271,7 +1271,7 @@ typedef struct MDB_ntxn {
 #endif
 
        /** max bytes to write in one call */
-#define MAX_WRITE              (0x80000000U >> (sizeof(ssize_t) == 4))
+#define MAX_WRITE              (0x40000000U >> (sizeof(ssize_t) == 4))
 
        /** Check \b txn and \b dbi arguments to a function */
 #define TXN_DBI_EXIST(txn, dbi, validity) \
@@ -5668,8 +5668,10 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
 
        DPRINTF(("cursor_next: top page is %"Z"u in cursor %p",
                mdb_dbg_pgno(mp), (void *) mc));
-       if (mc->mc_flags & C_DEL)
+       if (mc->mc_flags & C_DEL) {
+               mc->mc_flags ^= C_DEL;
                goto skip;
+       }
 
        if (mc->mc_ki[mc->mc_top] + 1u >= NUMKEYS(mp)) {
                DPUTS("=====> move to next sibling page");
@@ -5748,6 +5750,8 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
        DPRINTF(("cursor_prev: top page is %"Z"u in cursor %p",
                mdb_dbg_pgno(mp), (void *) mc));
 
+       mc->mc_flags &= ~(C_EOF|C_DEL);
+
        if (mc->mc_ki[mc->mc_top] == 0)  {
                DPUTS("=====> move to prev sibling page");
                if ((rc = mdb_cursor_sibling(mc, 0)) != MDB_SUCCESS) {
@@ -5759,8 +5763,6 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op)
        } else
                mc->mc_ki[mc->mc_top]--;
 
-       mc->mc_flags &= ~C_EOF;
-
        DPRINTF(("==> cursor points to page %"Z"u with %u keys, key index %u",
            mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top]));
 
@@ -6491,7 +6493,7 @@ more:
 #endif
                                /* does data match? */
                                if (!dcmp(data, &olddata)) {
-                                       if (flags & MDB_NODUPDATA)
+                                       if (flags & (MDB_NODUPDATA|MDB_APPENDDUP))
                                                return MDB_KEYEXIST;
                                        /* overwrite it */
                                        goto current;
@@ -9157,7 +9159,7 @@ mdb_env_copyfd0(MDB_env *env, HANDLE fd)
        MDB_txn *txn = NULL;
        mdb_mutexref_t wmutex = NULL;
        int rc;
-       size_t wsize;
+       size_t wsize, w3;
        char *ptr;
 #ifdef _WIN32
        DWORD len, w2;
@@ -9216,15 +9218,15 @@ mdb_env_copyfd0(MDB_env *env, HANDLE fd)
        if (rc)
                goto leave;
 
-       w2 = txn->mt_next_pgno * env->me_psize;
+       w3 = txn->mt_next_pgno * env->me_psize;
        {
                size_t fsize = 0;
                if ((rc = mdb_fsize(env->me_fd, &fsize)))
                        goto leave;
-               if (w2 > fsize)
-                       w2 = fsize;
+               if (w3 > fsize)
+                       w3 = fsize;
        }
-       wsize = w2 - wsize;
+       wsize = w3 - wsize;
        while (wsize > 0) {
                if (wsize > MAX_WRITE)
                        w2 = MAX_WRITE;
index 57a9d4920e94d9c555dc6bcdac407af7195e2fd1..5c6d841a7adcaeb713df9a21f6bdecec014cb564 100644 (file)
@@ -120,7 +120,7 @@ void mdb_midl_shrink( MDB_IDL *idp )
 {
        MDB_IDL ids = *idp;
        if (*(--ids) > MDB_IDL_UM_MAX &&
-               (ids = realloc(ids, (MDB_IDL_UM_MAX+1) * sizeof(MDB_ID))))
+               (ids = realloc(ids, (MDB_IDL_UM_MAX+2) * sizeof(MDB_ID))))
        {
                *ids++ = MDB_IDL_UM_MAX;
                *idp = ids;