Commit 4abdd798 authored by Sergey Vojtovich's avatar Sergey Vojtovich

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.
parent 8023fc6d
...@@ -369,7 +369,7 @@ struct rw_trx_hash_element_t ...@@ -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 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; trx_t *trx;
ib_mutex_t mutex; ib_mutex_t mutex;
}; };
...@@ -929,9 +929,7 @@ class trx_sys_t ...@@ -929,9 +929,7 @@ class trx_sys_t
void assign_new_trx_no(trx_t *trx) void assign_new_trx_no(trx_t *trx)
{ {
trx->no= get_new_trx_id_no_refresh(); trx->no= get_new_trx_id_no_refresh();
my_atomic_store64_explicit(reinterpret_cast<int64*> trx->rw_trx_hash_element->no= trx->no;
(&trx->rw_trx_hash_element->no),
trx->no, MY_MEMORY_ORDER_RELAXED);
refresh_rw_trx_hash_version(); refresh_rw_trx_hash_version();
} }
...@@ -1151,8 +1149,7 @@ class trx_sys_t ...@@ -1151,8 +1149,7 @@ class trx_sys_t
{ {
if (element->id < arg->m_id) if (element->id < arg->m_id)
{ {
trx_id_t no= static_cast<trx_id_t>(my_atomic_load64_explicit( trx_id_t no= element->no;
reinterpret_cast<int64*>(&element->no), MY_MEMORY_ORDER_RELAXED));
arg->m_ids->push_back(element->id); arg->m_ids->push_back(element->id);
if (no < arg->m_no) if (no < arg->m_no)
arg->m_no= no; arg->m_no= no;
......
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