Some issues with kill_idle_transaction implementation at InnoDB level
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.1 |
Won't Fix
|
Undecided
|
Unassigned | |||
5.5 |
Won't Fix
|
High
|
Laurynas Biveinis | |||
5.6 |
Fix Released
|
High
|
Laurynas Biveinis | |||
5.7 |
Fix Released
|
High
|
Laurynas Biveinis |
Bug Description
Looking at following:
if (trx->state == TRX_ACTIVE
&& trx->mysql_thd
&& innobase_
ib_int64_t start_time = innobase_
ulong thd_id = innobase_
if (trx->last_
trx-
trx-
} else if (difftime(now, trx->idle_start)
> srv_kill_
/* kill the session */
mutex_
innobase_
goto rescan_idle;
}
}
a) It exits the kernel_mutex before killing the thread.
i)Is it not possible that thread state can change (from sleep to
running) after mutex is exited?
ii)If it is not possible to kill thread with kernel_mutex is held,
then it is not better to scan the trx list fully and then kill them at
once since thd_kill holds mutexes as well.
b) Is
if (trx->last_
trx-
trx-
required since thd->start_time (used by innobase_
means the time the thread was in that state (in this case IDLE), so
doesn't thd->start_time > srv_... should state if it was idle that long?
c) Another issue (not sure if it can be fixed), is that this
runs every second in error thread, is it possible to not skip the
idle code for every few iterations (so as to run it every 60
seconds or configurable time) since otherwise the overhead of
this can be high.
tags: | added: xtradb |
tags: | added: kill-idle-trx |
summary: |
- About kill_idle_transactions + Some issues with kill_idle_transaction implementation at InnoDB level |
@Raghavendra,
Also implementation of innobase_thd_kill (actually thd_kill in sql_class.cc) is copy-paste from sql_parse.cc. And it does scan the list of THD to find one with matching ID. But we know THD already (it is trx->mysql_thd).
and there is also bug #907719