Commit 90377b80 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-17441 - InnoDB transition to C++11 atomics

trx_sys_t::m_max_trx_id transition to Atomic_counter. Since C++11 doesn't
seem to allow mixed (atomic and non-atomic) access to atomic variables,
we have to perform atomic initialisation.
parent 03e46163
...@@ -790,7 +790,7 @@ class trx_sys_t ...@@ -790,7 +790,7 @@ class trx_sys_t
The smallest number not yet assigned as a transaction id or transaction The smallest number not yet assigned as a transaction id or transaction
number. Accessed and updated with atomic operations. number. Accessed and updated with atomic operations.
*/ */
MY_ALIGNED(CACHE_LINE_SIZE) trx_id_t m_max_trx_id; MY_ALIGNED(CACHE_LINE_SIZE) Atomic_counter<trx_id_t> m_max_trx_id;
/** /**
...@@ -887,9 +887,7 @@ class trx_sys_t ...@@ -887,9 +887,7 @@ class trx_sys_t
trx_id_t get_max_trx_id() trx_id_t get_max_trx_id()
{ {
return static_cast<trx_id_t> return m_max_trx_id;
(my_atomic_load64_explicit(reinterpret_cast<int64*>(&m_max_trx_id),
MY_MEMORY_ORDER_RELAXED));
} }
...@@ -1195,8 +1193,7 @@ class trx_sys_t ...@@ -1195,8 +1193,7 @@ class trx_sys_t
trx_id_t get_new_trx_id_no_refresh() trx_id_t get_new_trx_id_no_refresh()
{ {
return static_cast<trx_id_t>(my_atomic_add64_explicit( return m_max_trx_id++;
reinterpret_cast<int64*>(&m_max_trx_id), 1, MY_MEMORY_ORDER_RELAXED));
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment