Skip to content
Permalink
Browse files
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.
  • Loading branch information
Sergey Vojtovich committed Dec 27, 2018
1 parent 03e4616 commit 90377b8
Showing 1 changed file with 3 additions and 6 deletions.
@@ -790,7 +790,7 @@ class trx_sys_t
The smallest number not yet assigned as a transaction id or transaction
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

trx_id_t get_max_trx_id()
{
return static_cast<trx_id_t>
(my_atomic_load64_explicit(reinterpret_cast<int64*>(&m_max_trx_id),
MY_MEMORY_ORDER_RELAXED));
return m_max_trx_id;
}


@@ -1195,8 +1193,7 @@ class trx_sys_t

trx_id_t get_new_trx_id_no_refresh()
{
return static_cast<trx_id_t>(my_atomic_add64_explicit(
reinterpret_cast<int64*>(&m_max_trx_id), 1, MY_MEMORY_ORDER_RELAXED));
return m_max_trx_id++;
}
};

0 comments on commit 90377b8

Please sign in to comment.