Suspicious logic in XtraDB extra slow log stats collection
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS |
Fix Released
|
Medium
|
Alexey Kopytov | ||
5.1 |
Won't Fix
|
Medium
|
Unassigned | ||
5.5 |
Fix Released
|
Medium
|
Alexey Kopytov |
Bug Description
innobase_trx_init() enables stats collection just based on the log_slow_
#ifdef EXTENDED_SLOWLOG
if (thd_log_
trx->take_stats = TRUE;
} else {
trx->take_stats = FALSE;
}
#else
trx->take_stats = FALSE;
#endif
Then all the code that wants to update stats check if both the slow log is enabled and trx->take_stats is TRUE:
if (innobase_
{
ut_usectime(
finish_time = (ib_uint64_t)sec * 1000000 + ms;
trx-
}
Why don't we check if the slow log is enabled before setting trx->take_stats? The only downside is a rather pathological case when we have long running transactions, and want to collect stats for them with log_slow_
The upside is that we would also remove calls to to innobase_
Related branches
- Laurynas Biveinis (community): Approve
- Stewart Smith (community): Needs Fixing
- Sergei Glushchenko (community): Approve (g2)
-
Diff: 217 lines (+26/-24)5 files modifiedPercona-Server/storage/innobase/buf/buf0buf.c (+16/-14)
Percona-Server/storage/innobase/lock/lock0lock.c (+2/-2)
Percona-Server/storage/innobase/os/os0file.c (+3/-3)
Percona-Server/storage/innobase/srv/srv0srv.c (+2/-2)
Percona-Server/storage/innobase/trx/trx0trx.c (+3/-3)
tags: | added: slow-extended |
The pathological case has its inverse case: when we want to stop collecting stats and have some long running transactions.
The change not to support this is more than reasonable IMHO.