Skip to content
Permalink
Browse files
MDEV-17441 - InnoDB transition to C++11 atomics
rw_trx_hash_element_t::no 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 8023fc6 commit 4abdd79
Showing 1 changed file with 3 additions and 6 deletions.
@@ -369,7 +369,7 @@ struct rw_trx_hash_element_t


trx_id_t id; /* lf_hash_init() relies on this to be first in the struct */
trx_id_t no;
Atomic_counter<trx_id_t> no;
trx_t *trx;
ib_mutex_t mutex;
};
@@ -929,9 +929,7 @@ class trx_sys_t
void assign_new_trx_no(trx_t *trx)
{
trx->no= get_new_trx_id_no_refresh();
my_atomic_store64_explicit(reinterpret_cast<int64*>
(&trx->rw_trx_hash_element->no),
trx->no, MY_MEMORY_ORDER_RELAXED);
trx->rw_trx_hash_element->no= trx->no;
refresh_rw_trx_hash_version();
}

@@ -1151,8 +1149,7 @@ class trx_sys_t
{
if (element->id < arg->m_id)
{
trx_id_t no= static_cast<trx_id_t>(my_atomic_load64_explicit(
reinterpret_cast<int64*>(&element->no), MY_MEMORY_ORDER_RELAXED));
trx_id_t no= element->no;
arg->m_ids->push_back(element->id);
if (no < arg->m_no)
arg->m_no= no;

0 comments on commit 4abdd79

Please sign in to comment.