diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-06-18 13:58:54 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-06-18 13:58:54 +0300 |
commit | c515b1d092c62f346e512b91e5e68311892fe128 (patch) | |
tree | 6cec2ad22507d67c865026c8f68c6aeb774459f1 /storage/innobase/trx/trx0trx.cc | |
parent | baff3ba6e32d68876ec91fe808de8872088a393b (diff) | |
parent | 205b0ce6ad21dbafe8def505307b4922398db5b2 (diff) | |
download | mariadb-git-c515b1d092c62f346e512b91e5e68311892fe128.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'storage/innobase/trx/trx0trx.cc')
-rw-r--r-- | storage/innobase/trx/trx0trx.cc | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 9c2c9a02536..51b9bd379a5 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -840,14 +840,9 @@ static trx_rseg_t* trx_assign_rseg_low() /* Choose a rollback segment evenly distributed between 0 and innodb_undo_logs-1 in a round-robin fashion, skipping those - undo tablespaces that are scheduled for truncation. - - Because rseg_slot is not protected by atomics or any mutex, race - conditions are possible, meaning that multiple transactions - that start modifications concurrently will write their undo - log to the same rollback segment. */ - static ulong rseg_slot; - ulint slot = rseg_slot++ % TRX_SYS_N_RSEGS; + undo tablespaces that are scheduled for truncation. */ + static Atomic_counter<unsigned> rseg_slot; + unsigned slot = rseg_slot++ % TRX_SYS_N_RSEGS; ut_d(if (trx_rseg_n_slots_debug) slot = 0); trx_rseg_t* rseg; @@ -926,11 +921,8 @@ trx_t::assign_temp_rseg() compile_time_assert(ut_is_2pow(TRX_SYS_N_RSEGS)); /* Choose a temporary rollback segment between 0 and 127 - in a round-robin fashion. Because rseg_slot is not protected by - atomics or any mutex, race conditions are possible, meaning that - multiple transactions that start modifications concurrently - will write their undo log to the same rollback segment. */ - static ulong rseg_slot; + in a round-robin fashion. */ + static Atomic_counter<unsigned> rseg_slot; trx_rseg_t* rseg = trx_sys.temp_rsegs[ rseg_slot++ & (TRX_SYS_N_RSEGS - 1)]; ut_ad(!rseg->is_persistent()); |