Add mdb_flags variable to LMDB database open
This commit is contained in:
parent
260cc56fae
commit
cb862cb81a
|
@ -637,6 +637,7 @@ BlockchainLMDB::BlockchainLMDB(bool batch_transactions)
|
||||||
|
|
||||||
void BlockchainLMDB::open(const std::string& filename)
|
void BlockchainLMDB::open(const std::string& filename)
|
||||||
{
|
{
|
||||||
|
int mdb_flags = 0;
|
||||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||||
|
|
||||||
if (m_open)
|
if (m_open)
|
||||||
|
@ -675,7 +676,7 @@ void BlockchainLMDB::open(const std::string& filename)
|
||||||
size_t mapsize = 1LL << 34;
|
size_t mapsize = 1LL << 34;
|
||||||
if (auto result = mdb_env_set_mapsize(m_env, mapsize))
|
if (auto result = mdb_env_set_mapsize(m_env, mapsize))
|
||||||
throw0(DB_ERROR(std::string("Failed to set max memory map size: ").append(mdb_strerror(result)).c_str()));
|
throw0(DB_ERROR(std::string("Failed to set max memory map size: ").append(mdb_strerror(result)).c_str()));
|
||||||
if (auto result = mdb_env_open(m_env, filename.c_str(), 0, 0644))
|
if (auto result = mdb_env_open(m_env, filename.c_str(), mdb_flags, 0644))
|
||||||
throw0(DB_ERROR(std::string("Failed to open lmdb environment: ").append(mdb_strerror(result)).c_str()));
|
throw0(DB_ERROR(std::string("Failed to open lmdb environment: ").append(mdb_strerror(result)).c_str()));
|
||||||
|
|
||||||
// get a read/write MDB_txn
|
// get a read/write MDB_txn
|
||||||
|
|
Loading…
Reference in New Issue