Commit 7445be89 authored by Aleksey Midenkov's avatar Aleksey Midenkov

IB: correct way of using start_time_micro [fixes #189]

parent f751b308
......@@ -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();
......
......@@ -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";
......
......@@ -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) {
......@@ -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) {
......@@ -1351,18 +1353,14 @@ trx_start_low(
}
}
if (trx->mysql_thd != NULL &&
(trx->start_time_micro = thd_query_start_micro(trx->mysql_thd))) {
trx->start_time = trx->start_time_micro / 1000000;
} else {
ut_usectime((ulong *)&trx->start_time,
(ulong *)&trx->start_time_micro);
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;
}
trx->start_time_micro += trx->start_time * 1000000;
}
trx->vtq_notify_on_commit = false;
......
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