diff options
-rw-r--r-- | common/storage_lmdb.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index b60f707..f7d38a1 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp | |||
@@ -955,14 +955,16 @@ public: | |||
955 | if (!(env = sEnvironments.value(fullPath))) { | 955 | if (!(env = sEnvironments.value(fullPath))) { |
956 | int rc = 0; | 956 | int rc = 0; |
957 | if ((rc = mdb_env_create(&env))) { | 957 | if ((rc = mdb_env_create(&env))) { |
958 | SinkWarningCtx(logCtx) << "mdb_env_create: " << rc << " " << mdb_strerror(rc); | 958 | SinkErrorCtx(logCtx) << "mdb_env_create: " << rc << " " << mdb_strerror(rc); |
959 | qCritical() << "mdb_env_create: " << rc << " " << mdb_strerror(rc); | ||
960 | env = nullptr; | 959 | env = nullptr; |
960 | throw std::runtime_error("Fatal error while creating db."); | ||
961 | } else { | 961 | } else { |
962 | //Limit large enough to accomodate all our named dbs. This only starts to matter if the number gets large, otherwise it's just a bunch of extra entries in the main table. | 962 | //Limit large enough to accomodate all our named dbs. This only starts to matter if the number gets large, otherwise it's just a bunch of extra entries in the main table. |
963 | mdb_env_set_maxdbs(env, 50); | 963 | mdb_env_set_maxdbs(env, 50); |
964 | if (const int rc = mdb_env_set_mapsize(env, mapsize())) { | 964 | if (const int rc = mdb_env_set_mapsize(env, mapsize())) { |
965 | SinkWarningCtx(logCtx) << "mdb_env_set_mapsize: " << rc << ":" << mdb_strerror(rc); | 965 | SinkErrorCtx(logCtx) << "mdb_env_set_mapsize: " << rc << ":" << mdb_strerror(rc); |
966 | Q_ASSERT(false); | ||
967 | throw std::runtime_error("Fatal error while creating db."); | ||
966 | } | 968 | } |
967 | const bool readOnly = (mode == ReadOnly); | 969 | const bool readOnly = (mode == ReadOnly); |
968 | unsigned int flags = MDB_NOTLS; | 970 | unsigned int flags = MDB_NOTLS; |
@@ -973,7 +975,9 @@ public: | |||
973 | if (readOnly) { | 975 | if (readOnly) { |
974 | SinkLogCtx(logCtx) << "Tried to open non-existing db: " << fullPath; | 976 | SinkLogCtx(logCtx) << "Tried to open non-existing db: " << fullPath; |
975 | } else { | 977 | } else { |
976 | SinkWarningCtx(logCtx) << "mdb_env_open: " << rc << ":" << mdb_strerror(rc); | 978 | SinkErrorCtx(logCtx) << "mdb_env_open: " << rc << ":" << mdb_strerror(rc); |
979 | Q_ASSERT(false); | ||
980 | throw std::runtime_error("Fatal error while creating db."); | ||
977 | } | 981 | } |
978 | mdb_env_close(env); | 982 | mdb_env_close(env); |
979 | env = 0; | 983 | env = 0; |