diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-07-24 20:43:24 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-07-24 21:59:26 +0300 |
commit | 10727b69530da609c26d61294ec4f6870b62a09a (patch) | |
tree | a9c98e601a57f28c434034e242a7debd927b6927 /storage | |
parent | 10ee1b95b80ef1dc2fd3142e04f6031cc8be9e9d (diff) | |
download | mariadb-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')
-rw-r--r-- | storage/innobase/include/trx0trx.h | 9 | ||||
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 5 | ||||
-rw-r--r-- | storage/innobase/trx/trx0purge.cc | 3 | ||||
-rw-r--r-- | storage/innobase/trx/trx0trx.cc | 11 | ||||
-rw-r--r-- | storage/xtradb/include/trx0trx.h | 9 | ||||
-rw-r--r-- | storage/xtradb/lock/lock0lock.cc | 5 | ||||
-rw-r--r-- | storage/xtradb/trx/trx0purge.cc | 3 | ||||
-rw-r--r-- | storage/xtradb/trx/trx0trx.cc | 11 |
8 files changed, 30 insertions, 26 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); } diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h index f355ef4fcf4..448b2429126 100644 --- a/storage/xtradb/include/trx0trx.h +++ b/storage/xtradb/include/trx0trx.h @@ -917,10 +917,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/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index 27a857b26a8..061813cd8ab 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -2077,10 +2077,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/xtradb/trx/trx0purge.cc b/storage/xtradb/trx/trx0purge.cc index 16f985833b5..f4e4d2f42ea 100644 --- a/storage/xtradb/trx/trx0purge.cc +++ b/storage/xtradb/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/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc index 3e0d81df8b5..f0229cf7ff5 100644 --- a/storage/xtradb/trx/trx0trx.cc +++ b/storage/xtradb/trx/trx0trx.cc @@ -749,7 +749,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) { @@ -835,7 +836,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) { @@ -1106,8 +1108,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); } |