One more...
Howard Chu wrote:
Howard Chu wrote:
OK, this is an updated MDB patch, with a bit of documentation added as well.
Based on the postfix-2.10-20121007 source.
Of course I screwed up the update. Needs this addition:
diff --git a/src/global/mkmap_mdb.c b/src/global/mkmap_mdb.c
index d55c7a7..c22eecf 100644
--- a/src/global/mkmap_mdb.c
+++ b/src/global/mkmap_mdb.c
@@ -82,6 +82,8 @@ MKMAP *mkmap_mdb_open(const char *path)
* Fill in the generic members.
*/
mkmap->open = dict_mdb_open;
+ mkmap->after_open = 0;
+ mkmap->after_close = 0;
/*
* MDB uses MVCC so it needs no special lock management here.
My apologies for sending an inadequately tested patch. This is also needed for
read-only access/enumeration to work:
diff --git a/src/util/dict_mdb.c b/src/util/dict_mdb.c
index fea9af5..b9d4e4a 100644
--- a/src/util/dict_mdb.c
+++ b/src/util/dict_mdb.c
@@ -460,7 +460,7 @@ DICT *dict_mdb_open(const char *path, int open_flags,
int dict_flags)
if ((status = mdb_env_open(env, mdb_path, env_flags, 0644)))
msg_fatal("env_open %s: %s", mdb_path, mdb_strerror(status));
- if ((status = mdb_txn_begin(env, NULL, 0, &txn)))
+ if ((status = mdb_txn_begin(env, NULL, env_flags & MDB_RDONLY, &txn)))
msg_fatal("txn_begin %s: %s", mdb_path, mdb_strerror(status));
/* mdb_open requires a txn, but since the default DB always exists
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/