-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log all statements in transaction with same id, lp:897715 #1243
Conversation
@@ -2082,6 +2082,18 @@ bool MYSQL_QUERY_LOG::write(THD *thd, ulonglong current_utime, | |||
#if defined(ENABLED_PROFILING) | |||
thd->profiling.print_current(&log_file); | |||
#endif | |||
if ((thd->variables.log_slow_verbosity & (1ULL << SLOG_V_MICROTIME)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this attached to microtime verbosity?
if (!(thd->server_status & SERVER_STATUS_IN_TRANS)) | ||
thd->trx_start_utime= 0; | ||
if (my_b_printf(&log_file, | ||
"# Trx_id: %s\n", buf) == (uint) -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We end up with two trx ids, innodb one, and thread id. Probably it's better to implement the InnoDB trx id for "COMMIT", and nothing for "BEGIN" (maybe in some cases BEGIN gets InnoDB trx id - what about "WITH CONSISTENT SNAPSHOT"?)
d51c97a
to
e9666ff
Compare
http://jenkins.percona.com/job/percona-server-5.6-param/1535/
both timestamp based and Innodb_trx_id producing different numbers for base session and for consistent snapshot. |
e9666ff
to
7344017
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide an example of a slow query log with changed output?
@@ -2431,6 +2431,7 @@ class THD :public MDL_context_owner, | |||
default values only if (innodb_was_used==TRUE) | |||
*/ | |||
ulonglong innodb_trx_id; | |||
ulonglong saved_innodb_trx_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming it is needed, then it probably needs some sort of initialisation/reset in THD or it looks like some of the reads will be uninitialized
8469096
to
1f53377
Compare
http://jenkins.percona.com/job/percona-server-5.6-param/1541/
Test queries: create table t(c int) engine=innodb;
select 1;
begin;
select 2;
select * from t;
select 3;
commit;
select 4; Slow log example
|
@@ -2083,7 +2083,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, ulonglong current_utime, | |||
thd->profiling.print_current(&log_file); | |||
#endif | |||
if ((thd->variables.log_slow_verbosity & (1ULL << SLOG_V_INNODB)) | |||
&& thd->innodb_was_used) | |||
&& (thd->innodb_was_used || thd->innodb_trx_id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove thd->innodb_was_used check?
1f53377
to
e1981bf
Compare
http://jenkins.percona.com/job/percona-server-5.6-param/1579/
|
https://bugs.launchpad.net/percona-server/+bug/897715
http://jenkins.percona.com/job/percona-server-5.6-param/
I have considered to use thread_id + statement start time as a uniq identifier.
Only explicit transactions are tracked.
I'm not sure if additional flag is required for log_slow_verbosity or existing one (e.g. microtime) could be used.
It could be also implemented for 5.5 in the same way.
This kind of functionality will be useful with:
Mysql 5.7 has thd->get_transaction()->sequence_number but it always empty.