mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-29 18:53:14 +00:00
Check for correct thread before ending batch transaction
This commit is contained in:
parent
eaf8470b29
commit
3ff54bdd7a
1 changed files with 7 additions and 0 deletions
|
@ -2292,6 +2292,9 @@ void BlockchainLMDB::batch_commit()
|
||||||
throw0(DB_ERROR("batch transaction not in progress"));
|
throw0(DB_ERROR("batch transaction not in progress"));
|
||||||
if (m_write_batch_txn == nullptr)
|
if (m_write_batch_txn == nullptr)
|
||||||
throw0(DB_ERROR("batch transaction not in progress"));
|
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();
|
check_open();
|
||||||
|
|
||||||
LOG_PRINT_L3("batch transaction: committing...");
|
LOG_PRINT_L3("batch transaction: committing...");
|
||||||
|
@ -2316,6 +2319,8 @@ void BlockchainLMDB::batch_stop()
|
||||||
throw0(DB_ERROR("batch transaction not in progress"));
|
throw0(DB_ERROR("batch transaction not in progress"));
|
||||||
if (m_write_batch_txn == nullptr)
|
if (m_write_batch_txn == nullptr)
|
||||||
throw0(DB_ERROR("batch transaction not in progress"));
|
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();
|
check_open();
|
||||||
LOG_PRINT_L3("batch transaction: committing...");
|
LOG_PRINT_L3("batch transaction: committing...");
|
||||||
TIME_MEASURE_START(time1);
|
TIME_MEASURE_START(time1);
|
||||||
|
@ -2338,6 +2343,8 @@ void BlockchainLMDB::batch_abort()
|
||||||
throw0(DB_ERROR("batch transactions not enabled"));
|
throw0(DB_ERROR("batch transactions not enabled"));
|
||||||
if (! m_batch_active)
|
if (! m_batch_active)
|
||||||
throw0(DB_ERROR("batch transaction not in progress"));
|
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();
|
check_open();
|
||||||
// for destruction of batch transaction
|
// for destruction of batch transaction
|
||||||
m_write_txn = nullptr;
|
m_write_txn = nullptr;
|
||||||
|
|
Loading…
Reference in a new issue