From 44c2907afefcff9e8e35306e77663415630b7563 Mon Sep 17 00:00:00 2001 From: Neil Mayhew Date: Fri, 20 May 2016 14:26:51 -0600 Subject: [PATCH] Fix incorrect use of LMDB flags MDB_DUPSORT should be used when the database is opened. Using it with mdb_put causes an "Invalid argument" error and therefore a crash in the generator. --- source/datacache.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/datacache.d b/source/datacache.d index 03e1bbf1..ba5cd508 100644 --- a/source/datacache.d +++ b/source/datacache.d @@ -144,7 +144,7 @@ public: rc = txn.mdb_dbi_open ("metadata_yaml", MDB_CREATE, &dbDataYaml); checkError (rc, "open metadata (yaml) database"); - rc = txn.mdb_dbi_open ("statistics", MDB_CREATE | MDB_INTEGERKEY, &dbStats); + rc = txn.mdb_dbi_open ("statistics", MDB_CREATE | MDB_INTEGERKEY | MDB_DUPSORT, &dbStats); checkError (rc, "open statistics database"); rc = txn.mdb_txn_commit (); @@ -564,7 +564,7 @@ public: scope (success) commitTransaction (txn); scope (failure) quitTransaction (txn); - auto res = txn.mdb_put (dbStats, &dbkey, &dbvalue, MDB_APPENDDUP | MDB_DUPSORT); + auto res = txn.mdb_put (dbStats, &dbkey, &dbvalue, MDB_APPENDDUP); checkError (res, "mdb_put (stats)"); }