summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2020-05-25 22:25:03 +0400
committerSergey Vojtovich <svoj@mariadb.org>2020-05-25 22:25:03 +0400
commit6a2e4b84ed4c2ae82de5cd9394351a98ca50d7e4 (patch)
treed25f4b84e7d821a7b920566ff00dd9c16f685aa6
parent66963a3781e08a27d1c7878bb641e4819c2b078e (diff)
downloadmariadb-git-bb-10.5-svoj-MDEV-22593.tar.gz
MDEV-22697 - InnoDB: remove trx->nobb-10.5-svoj-MDEV-22593
trx->no is duplicated by trx->rw_trx_hash_element->no for no good reason. The latter is preferred for performance reasons: allows to avoid taking trx->rw_trx_hash_element->mutex when snapshotting.
-rw-r--r--storage/innobase/include/trx0sys.h12
-rw-r--r--storage/innobase/include/trx0trx.h9
-rw-r--r--storage/innobase/trx/trx0purge.cc8
-rw-r--r--storage/innobase/trx/trx0trx.cc11
4 files changed, 16 insertions, 24 deletions
diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h
index a2f63905e30..ea42d80088a 100644
--- a/storage/innobase/include/trx0sys.h
+++ b/storage/innobase/include/trx0sys.h
@@ -363,6 +363,13 @@ struct rw_trx_hash_element_t
trx_id_t id; /* lf_hash_init() relies on this to be first in the struct */
+
+ /**
+ Transaction serialization number.
+
+ Assigned shortly before the transaction is moved to COMMITTED_IN_MEMORY
+ state. Initially set to TRX_ID_MAX.
+ */
Atomic_counter<trx_id_t> no;
trx_t *trx;
ib_mutex_t mutex;
@@ -930,8 +937,7 @@ public:
*/
void assign_new_trx_no(trx_t *trx)
{
- trx->no= get_new_trx_id_no_refresh();
- trx->rw_trx_hash_element->no= trx->no;
+ trx->rw_trx_hash_element->no= get_new_trx_id_no_refresh();
refresh_rw_trx_hash_version();
}
@@ -955,7 +961,7 @@ public:
@param[in,out] caller_trx used to get access to rw_trx_hash_pins
@param[out] ids array to store registered transaction identifiers
@param[out] max_trx_id variable to store m_max_trx_id value
- @param[out] mix_trx_no variable to store min(trx->no) value
+ @param[out] mix_trx_no variable to store min(no) value
*/
void snapshot_ids(trx_t *caller_trx, trx_ids_t *ids, trx_id_t *max_trx_id,
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index cb590886473..2e6883e44aa 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -734,15 +734,6 @@ public:
trx_id_t id; /*!< transaction id */
- trx_id_t no; /*!< transaction serialization number:
- max trx id shortly before the
- transaction is moved to
- COMMITTED_IN_MEMORY state.
- Accessed exclusively by trx owner
- thread. Should be removed in favour of
- trx->rw_trx_hash_element->no.
- Initially set to TRX_ID_MAX. */
-
/** State of the trx from the point of view of concurrency control
and the valid state transitions.
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 702d6081d0d..80c80ab61e8 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -210,7 +210,7 @@ void
trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr)
{
DBUG_PRINT("trx", ("commit(" TRX_ID_FMT "," TRX_ID_FMT ")",
- trx->id, trx->no));
+ trx->id, trx->rw_trx_hash_element->no));
ut_ad(undo == trx->rsegs.m_redo.undo
|| undo == trx->rsegs.m_redo.old_insert);
trx_rseg_t* rseg = trx->rsegs.m_redo.rseg;
@@ -301,7 +301,8 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr)
+ TRX_UNDO_HISTORY_NODE), mtr);
mtr->write<8,mtr_t::MAYBE_NOP>(*undo_page,
- undo_header + TRX_UNDO_TRX_NO, trx->no);
+ undo_header + TRX_UNDO_TRX_NO,
+ trx->rw_trx_hash_element->no);
/* This is needed for upgrading old undo log pages from
before MariaDB 10.3.1. */
if (UNIV_UNLIKELY(!mach_read_from_2(undo_header
@@ -313,7 +314,8 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr)
if (rseg->last_page_no == FIL_NULL) {
rseg->last_page_no = undo->hdr_page_no;
rseg->last_offset = undo->hdr_offset;
- rseg->set_last_trx_no(trx->no, undo == trx->rsegs.m_redo.undo);
+ rseg->set_last_trx_no(trx->rw_trx_hash_element->no,
+ undo == trx->rsegs.m_redo.undo);
rseg->needs_purge = true;
}
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 80aa716e7e1..79778c0d02d 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -104,8 +104,6 @@ trx_init(
/*=====*/
trx_t* trx)
{
- trx->no = TRX_ID_MAX;
-
trx->state = TRX_STATE_NOT_STARTED;
trx->is_recovered = false;
@@ -677,7 +675,6 @@ static void trx_resurrect(trx_undo_t *undo, trx_rseg_t *rseg,
trx->state= state;
ut_d(trx->start_file= __FILE__);
ut_d(trx->start_line= __LINE__);
- ut_ad(trx->no == TRX_ID_MAX);
if (is_old_insert)
trx->rsegs.m_redo.old_insert= undo;
@@ -966,11 +963,6 @@ trx_start_low(
trx->xid->null();
#endif /* WITH_WSREP */
- /* The initial value for trx->no: TRX_ID_MAX is used in
- read_view_open_now: */
-
- trx->no = TRX_ID_MAX;
-
ut_a(ib_vector_is_empty(trx->autoinc_locks));
ut_a(trx->lock.table_locks.empty());
@@ -1046,7 +1038,8 @@ trx_serialise(trx_t* trx)
already in the rollback segment. User threads only
produce events when a rollback segment is empty. */
if (rseg->last_page_no == FIL_NULL) {
- purge_sys.purge_queue.push(TrxUndoRsegs(trx->no, *rseg));
+ purge_sys.purge_queue.push(TrxUndoRsegs(trx->rw_trx_hash_element->no,
+ *rseg));
mutex_exit(&purge_sys.pq_mutex);
}
}