diff options
author | Howard Chu <highlandsun@gmail.com> | 2016-12-26 14:29:46 -0800 |
---|---|---|
committer | Howard Chu <hyc@symas.com> | 2017-01-14 22:43:06 +0000 |
commit | 0693cff9251f91a05dd96b2f8910faea29cb29ce (patch) | |
tree | 51bc874f688229a4a1b582134521aaa674caf6a6 /src/blockchain_db/lmdb/db_lmdb.cpp | |
parent | add tx hash to time stats (diff) | |
download | monero-0693cff9251f91a05dd96b2f8910faea29cb29ce.tar.xz |
Use batch transactions when syncing
Faster throughput while avoiding corruption. I.e., makes
running with --db-sync-mode safe more tolerable.
Diffstat (limited to 'src/blockchain_db/lmdb/db_lmdb.cpp')
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 1ad9876ac..7a6fbf1df 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -2234,15 +2234,15 @@ bool BlockchainLMDB::for_all_outputs(std::function<bool(uint64_t amount, const c } // batch_num_blocks: (optional) Used to check if resize needed before batch transaction starts. -void BlockchainLMDB::batch_start(uint64_t batch_num_blocks) +bool BlockchainLMDB::batch_start(uint64_t batch_num_blocks) { LOG_PRINT_L3("BlockchainLMDB::" << __func__); if (! m_batch_transactions) throw0(DB_ERROR("batch transactions not enabled")); if (m_batch_active) - throw0(DB_ERROR("batch transaction already in progress")); + return false; if (m_write_batch_txn != nullptr) - throw0(DB_ERROR("batch transaction already in progress")); + return false; if (m_write_txn) throw0(DB_ERROR("batch transaction attempted, but m_write_txn already in use")); check_open(); @@ -2268,6 +2268,7 @@ void BlockchainLMDB::batch_start(uint64_t batch_num_blocks) memset(&m_wcursors, 0, sizeof(m_wcursors)); LOG_PRINT_L3("batch transaction: begin"); + return true; } void BlockchainLMDB::batch_commit() |