[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: [LMDB] Problem with extending size on Windows
- To: Howard Chu <hyc@symas.com>
- Subject: Re: [LMDB] Problem with extending size on Windows
- From: Alain <alpic80@gmail.com>
- Date: Thu, 5 Dec 2013 17:58:30 -0500
- Cc: openldap-technical@openldap.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=k5WbHMBfRGWBh0lg+etVFjXTHKBmhxpI91xRb8jxYTY=; b=0MQ7dG+dtdDmpwalvaePicchmXgig+6dUxLdfwywpSDsr8NZGqawUdyl7paZ19wLzj T/3y+UbNrnO+yNZHp0FlOaK1HHVxjiaAMFDueywA1C2HHR0HL7X+llxSf7ayj7FdLhTE xRc2NcFkiRKLmsFktbTfmV+hi7utIvzxtzEHXayPBHp244CsGAOVeOPXKJNfeGfOwwxP m56aOgKAf1bqmVMjRvwfbe3fN6KcttYN/nhpq9hj+CXQ9BEiJXSIeCXlSBvJeaosOc3J pLxZPJR+R+xRk45sdJgjoS63RFq0UWSRd18eKH7H1uc8OBwYXRDreBHMZUR0CWmqCLwW VrbA==
- In-reply-to: <52A0C5D9.8020802@symas.com>
- References: <CACokUm+Pr=VJCsHhxw=ap82kf=2qxEZGSt-PSv2m+0nKdQZfyQ@mail.gmail.com> <52A0C5D9.8020802@symas.com>
Howard,
Here is the current diff file with all the changes discussed.
I am using version
f39bceb
from November 12.
Alain
--- ../../lmdb-git/liblmdb/mdb.c 2013-11-12 11:10:33.000000000 -0500
+++ mdb.c 2013-12-05 17:55:12.287682300 -0500
@@ -326,8 +326,13 @@
* Requires double parenthesis around 2 or more args.
*/
# define DPRINTF(args) ((void) ((mdb_debug) && DPRINTF0 args))
+#ifdef _MSC_VER //MS C++ doesn't support __func__
+# define DPRINTF0(fmt, ...) \
+ fprintf(stderr, "%s:%d " fmt "\n", __FUNCTION__, __LINE__, __VA_ARGS__)
+#else
# define DPRINTF0(fmt, ...) \
fprintf(stderr, "%s:%d " fmt "\n", __func__, __LINE__, __VA_ARGS__)
+#endif
#else
# define DPRINTF(args) ((void) 0)
#endif
@@ -2945,8 +2950,11 @@
mdb_cursors_close(txn, 0);
if (!txn->mt_u.dirty_list[0].mid &&
- !(txn->mt_flags & (MDB_TXN_DIRTY|MDB_TXN_SPILLS)))
+ !(txn->mt_flags & (MDB_TXN_DIRTY|MDB_TXN_SPILLS))) {
+ DPRINTF(("nothing to commit txn %"Z"u %p on mdbenv %p, root page %"Z"u",
+ txn->mt_txnid, (void*)txn, (void*)env, txn->mt_dbs[MAIN_DBI].md_root));
goto done;
+ }
DPRINTF(("committing txn %"Z"u %p on mdbenv %p, root page %"Z"u",
txn->mt_txnid, (void*)txn, (void*)env, txn->mt_dbs[MAIN_DBI].md_root));
@@ -3304,9 +3312,9 @@
* Just allocate the maxsize right now.
*/
if (newsize) {
- if (SetFilePointer(env->me_fd, sizelo, &sizehi, 0) != (DWORD)sizelo
+ if ((SetFilePointer(env->me_fd, sizelo, &sizehi, 0) == INVALID_SET_FILE_POINTER && GetLastError() != ERROR_SUCCESS)
|| !SetEndOfFile(env->me_fd)
- || SetFilePointer(env->me_fd, 0, NULL, 0) != 0)
+ || (SetFilePointer(env->me_fd, 0, NULL, 0) == INVALID_SET_FILE_POINTER && GetLastError() != ERROR_SUCCESS))
return ErrCode();
}
mh = CreateFileMapping(env->me_fd, NULL, flags & MDB_WRITEMAP ?
@@ -3470,7 +3478,7 @@
env->me_mapsize = minsize;
}
- rc = mdb_env_map(env, meta.mm_address, newenv);
+ rc = mdb_env_map(env, meta.mm_address, newenv || env->me_mapsize != meta.mm_mapsize);
if (rc)
return rc;
@@ -5352,6 +5360,8 @@
if (rc) {
if (op == MDB_GET_BOTH || rc > 0)
return MDB_NOTFOUND;
+ data->mv_data = d2.mv_data;
+ data->mv_size = d2.mv_size;
rc = 0;
}