diff options
author | Riccardo Spagni <ric@spagni.net> | 2015-12-08 20:10:30 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2015-12-08 20:10:34 +0200 |
commit | 1fc1bfb677d7d97e4ba255e4ec0822d2a34642b1 (patch) | |
tree | f28333292477c73fe5a5e358a539490090639726 /src | |
parent | Merge pull request #522 (diff) | |
parent | db_bdb: support for libdb without DB_FORCESYNC (diff) | |
download | monero-1fc1bfb677d7d97e4ba255e4ec0822d2a34642b1.tar.xz |
Merge pull request #523
8620b31 db_bdb: support for libdb without DB_FORCESYNC (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r-- | src/blockchain_db/berkeleydb/db_bdb.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/blockchain_db/berkeleydb/db_bdb.cpp b/src/blockchain_db/berkeleydb/db_bdb.cpp index 7bf35db0b..18bd674d3 100644 --- a/src/blockchain_db/berkeleydb/db_bdb.cpp +++ b/src/blockchain_db/berkeleydb/db_bdb.cpp @@ -964,7 +964,41 @@ void BlockchainBDB::close() // FIXME: not yet thread safe!!! Use with care. m_open = false; + + // DB_FORCESYNC is only available on newer version of libdb. + // The libdb doc says using the DB_FORCESYNC flag to DB_ENV->close + // is "similar to calling the DB->close(0) method to close each + // database handle". So this is what we do here as a fallback. +#ifdef DB_FORCESYNC m_env->close(DB_FORCESYNC); +#else + m_blocks->close(0); + m_block_heights->close(0); + m_block_hashes->close(0); + m_block_timestamps->close(0); + m_block_sizes->close(0); + m_block_diffs->close(0); + m_block_coins->close(0); + + m_txs->close(0); + m_tx_unlocks->close(0); + m_tx_heights->close(0); + m_tx_outputs->close(0); + + m_output_txs->close(0); + m_output_indices->close(0); + m_output_amounts->close(0); + m_output_keys->close(0); + + m_spent_keys->close(0); + + m_hf_starting_heights->close(0); + m_hf_versions->close(0); + + m_properties->close(0); + + m_env->close(0); +#endif } void BlockchainBDB::sync() |