aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Chu <highlandsun@gmail.com>2017-01-15 07:50:56 -0800
committerHoward Chu <hyc@symas.com>2017-01-15 15:51:57 +0000
commit3ff54bdd7a8b5e08e4e8ac17b7fff23ad3a82312 (patch)
tree38d4dc823adafcd83ebc339d5a57cff8d9000a72
parentMust wait for previous batch to finish before starting new one (diff)
downloadmonero-3ff54bdd7a8b5e08e4e8ac17b7fff23ad3a82312.tar.xz
Check for correct thread before ending batch transaction
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp
index 0c6a0cfae..e7a3f36c0 100644
--- a/src/blockchain_db/lmdb/db_lmdb.cpp
+++ b/src/blockchain_db/lmdb/db_lmdb.cpp
@@ -2292,6 +2292,9 @@ void BlockchainLMDB::batch_commit()
throw0(DB_ERROR("batch transaction not in progress"));
if (m_write_batch_txn == nullptr)
throw0(DB_ERROR("batch transaction not in progress"));
+ if (m_writer != boost::this_thread::get_id())
+ return; // batch txn owned by other thread
+
check_open();
LOG_PRINT_L3("batch transaction: committing...");
@@ -2316,6 +2319,8 @@ void BlockchainLMDB::batch_stop()
throw0(DB_ERROR("batch transaction not in progress"));
if (m_write_batch_txn == nullptr)
throw0(DB_ERROR("batch transaction not in progress"));
+ if (m_writer != boost::this_thread::get_id())
+ return; // batch txn owned by other thread
check_open();
LOG_PRINT_L3("batch transaction: committing...");
TIME_MEASURE_START(time1);
@@ -2338,6 +2343,8 @@ void BlockchainLMDB::batch_abort()
throw0(DB_ERROR("batch transactions not enabled"));
if (! m_batch_active)
throw0(DB_ERROR("batch transaction not in progress"));
+ if (m_writer != boost::this_thread::get_id())
+ return; // batch txn owned by other thread
check_open();
// for destruction of batch transaction
m_write_txn = nullptr;