summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-07-24 20:43:24 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-07-24 21:59:26 +0300
commit10727b69530da609c26d61294ec4f6870b62a09a (patch)
treea9c98e601a57f28c434034e242a7debd927b6927 /storage/innobase
parent10ee1b95b80ef1dc2fd3142e04f6031cc8be9e9d (diff)
downloadmariadb-git-10727b69530da609c26d61294ec4f6870b62a09a.tar.gz
Always initialize trx_t::start_time_micro
This affects the function has_higher_priority() for internal or recovered transactions.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/include/trx0trx.h9
-rw-r--r--storage/innobase/lock/lock0lock.cc5
-rw-r--r--storage/innobase/trx/trx0purge.cc3
-rw-r--r--storage/innobase/trx/trx0trx.cc11
4 files changed, 15 insertions, 13 deletions
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index 69b6fcdf809..0291140a982 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -867,10 +867,11 @@ struct trx_t{
when trx->in_rw_trx_list. Initially
set to TRX_ID_MAX. */
- time_t start_time; /*!< time the trx state last time became
- TRX_STATE_ACTIVE */
- ib_uint64_t start_time_micro; /*!< start time of transaction in
- microseconds */
+ /** wall-clock time of the latest transition to TRX_STATE_ACTIVE;
+ used for diagnostic purposes only */
+ time_t start_time;
+ /** microsecond_interval_timer() of transaction start */
+ ulonglong start_time_micro;
trx_id_t id; /*!< transaction id */
XID xid; /*!< X/Open XA transaction
identification to identify a
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index be645afa32a..c0933ee7fdf 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -2279,10 +2279,7 @@ If neither of them is wait lock, the first one has higher priority.
If only one of them is a wait lock, it has lower priority.
Otherwise, the one with an older transaction has higher priority.
@returns true if lock1 has higher priority, false otherwise. */
-bool
-has_higher_priority(
- lock_t *lock1,
- lock_t *lock2)
+static bool has_higher_priority(lock_t *lock1, lock_t *lock2)
{
if (lock1 == NULL) {
return false;
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 3616ce1b004..bd61bc85961 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -146,7 +146,8 @@ trx_purge_sys_create(
here only because the query threads code requires it. It is otherwise
quite unnecessary. We should get rid of it eventually. */
purge_sys->trx->id = 0;
- purge_sys->trx->start_time = ut_time();
+ purge_sys->trx->start_time = time(NULL);
+ purge_sys->trx->start_time_micro = microsecond_interval_timer();
purge_sys->trx->state = TRX_STATE_ACTIVE;
purge_sys->trx->op_info = "purge trx";
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index ef12f118711..884e2fa887d 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -570,7 +570,8 @@ trx_resurrect_insert(
/* trx_start_low() is not called with resurrect, so need to initialize
start time here.*/
if (trx->state != TRX_STATE_COMMITTED_IN_MEMORY) {
- trx->start_time = ut_time();
+ trx->start_time = time(NULL);
+ trx->start_time_micro = microsecond_interval_timer();
}
if (undo->dict_operation) {
@@ -656,7 +657,8 @@ trx_resurrect_update(
start time here.*/
if (trx->state == TRX_STATE_ACTIVE
|| trx->state == TRX_STATE_PREPARED) {
- trx->start_time = ut_time();
+ trx->start_time = time(NULL);
+ trx->start_time_micro = microsecond_interval_timer();
}
if (undo->dict_operation) {
@@ -907,8 +909,9 @@ trx_start_low(
trx->start_time = ut_time();
- trx->start_time_micro =
- trx->mysql_thd ? thd_query_start_micro(trx->mysql_thd) : 0;
+ trx->start_time_micro = trx->mysql_thd
+ ? thd_query_start_micro(trx->mysql_thd)
+ : microsecond_interval_timer();
MONITOR_INC(MONITOR_TRX_ACTIVE);
}