Skip to content

Commit

Permalink
IB: correct way of using start_time_micro [fixes #189]
Browse files Browse the repository at this point in the history
  • Loading branch information
midenok committed May 11, 2017
1 parent f751b30 commit 7445be8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion storage/innobase/row/row0ins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3985,7 +3985,7 @@ void vers_notify_vtq(trx_t* trx)

timeval begin_ts, commit_ts;
begin_ts.tv_sec = trx->start_time;
begin_ts.tv_usec = trx->start_time_micro;
begin_ts.tv_usec = trx->start_time_micro % 1000000;

mutex_enter(&trx_sys->mutex);
trx_id_t commit_id = trx_sys_get_new_trx_id();
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/trx/trx0purge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ trx_purge_graph_build(sess_t* sess)
trx->id = 0;
ut_usectime((ulong *)&trx->start_time,
(ulong *)&trx->start_time_micro);
trx->start_time_micro += trx->start_time * 1000000;
trx->state = TRX_STATE_ACTIVE;
trx->op_info = "purge trx";

Expand Down
20 changes: 9 additions & 11 deletions storage/innobase/trx/trx0trx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ trx_resurrect_insert(

ut_usectime((ulong *)&trx->start_time,
(ulong *)&trx->start_time_micro);
trx->start_time_micro += trx->start_time * 1000000;
}

if (undo->dict_operation) {
Expand Down Expand Up @@ -983,6 +984,7 @@ trx_resurrect_update(
|| trx->state == TRX_STATE_PREPARED) {
ut_usectime((ulong *)&trx->start_time,
(ulong *)&trx->start_time_micro);
trx->start_time_micro += trx->start_time * 1000000;
}

if (undo->dict_operation) {
Expand Down Expand Up @@ -1351,18 +1353,14 @@ trx_start_low(
}
}

ut_usectime((ulong *)&trx->start_time,
(ulong *)&trx->start_time_micro);
if (trx->mysql_thd != NULL &&
(trx->start_time_micro = thd_query_start_micro(trx->mysql_thd))) {
trx->start_time = trx->start_time_micro / 1000000;

if (trx->mysql_thd != NULL) {
time_t start_time = thd_start_time_in_secs(trx->mysql_thd);
ib_uint64_t start_utime = thd_query_start_micro(trx->mysql_thd);
if (start_time < trx->start_time ||
(start_time == trx->start_time && start_utime < trx->start_time_micro))
{
trx->start_time = start_time;
trx->start_time_micro = start_utime;
}
} else {
ut_usectime((ulong *)&trx->start_time,
(ulong *)&trx->start_time_micro);
trx->start_time_micro += trx->start_time * 1000000;
}

trx->vtq_notify_on_commit = false;
Expand Down

0 comments on commit 7445be8

Please sign in to comment.