From f67cd267cfded13ce5dbf235e2c91036b8d52cfb Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Thu, 11 Dec 2014 00:53:25 +0100 Subject: keep the databases separate otherwise, to keep all the dbs in the same file we need to call mdb_env_set_maxdbs before mdb_env_open ... and even then the docs say: "Currently a moderate number of slots are cheap but a huge number gets expensive: 7-120 words per transaction, and every mdb_dbi_open() does a linear search of the opened slots." Ugh. that and the mem mapping probably gets screwed oever .. whatever. this way hawd works again :) --- common/storage_lmdb.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index 9832853..d5c70eb 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp @@ -36,14 +36,15 @@ Storage::Private::Private(const QString &s, const QString &n, AccessMode m) readTransaction(false), firstOpen(true) { + const QString fullPath(storageRoot + '/' + name); QDir dir; - dir.mkdir(storageRoot); + dir.mkdir(fullPath); //create file if (mdb_env_create(&env)) { // TODO: handle error } else { - int rc = mdb_env_open(env, storageRoot.toStdString().data(), 0, 0664); + int rc = mdb_env_open(env, fullPath.toStdString().data(), 0, 0664); if (rc) { std::cerr << "mdb_env_open: " << rc << " " << mdb_strerror(rc) << std::endl; @@ -335,13 +336,13 @@ void Storage::readAll(const std::functionstorageRoot + "/data.mdb"); + QFileInfo info(d->storageRoot + '/' + d->name + "/data.mdb"); return info.size(); } void Storage::removeFromDisk() const { - QDir dir(d->storageRoot); + QDir dir(d->storageRoot + '/' + d->name); dir.remove("data.mdb"); dir.remove("lock.mdb"); } -- cgit v1.2.3