Merge lp:~vlad-lesin/percona-server/5.6-bug-1376934 into lp:percona-server/5.6

Proposed by Vlad Lesin
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: 726
Merged at revision: 728
Proposed branch: lp:~vlad-lesin/percona-server/5.6-bug-1376934
Merge into: lp:percona-server/5.6
Diff against target: 60 lines (+24/-2)
3 files modified
mysql-test/r/set_statement_and_max_statement_time.result (+7/-0)
mysql-test/t/set_statement_and_max_statement_time.test (+14/-0)
sql/sql_parse.cc (+3/-2)
To merge this branch: bzr merge lp:~vlad-lesin/percona-server/5.6-bug-1376934
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+246271@code.launchpad.net

Description of the change

Per query variable setting for max_statement_time failed because statement timer was set before statement variable was set.

The current solution is in moving set_statement_timer() call to the place after the code which sets statement variables value.

To post a comment you must log in.
Revision history for this message
Vlad Lesin (vlad-lesin) wrote :
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'mysql-test/r/set_statement_and_max_statement_time.result'
--- mysql-test/r/set_statement_and_max_statement_time.result 1970-01-01 00:00:00 +0000
+++ mysql-test/r/set_statement_and_max_statement_time.result 2015-01-13 10:04:23 +0000
@@ -0,0 +1,7 @@
1#
2# Test max statement time interruption.
3# Note that if SLEEP() is interrupted, it returns 1.
4#
5SET STATEMENT max_statement_time = 10 FOR SELECT SLEEP(1000);
6SLEEP(1000)
71
08
=== added file 'mysql-test/t/set_statement_and_max_statement_time.test'
--- mysql-test/t/set_statement_and_max_statement_time.test 1970-01-01 00:00:00 +0000
+++ mysql-test/t/set_statement_and_max_statement_time.test 2015-01-13 10:04:23 +0000
@@ -0,0 +1,14 @@
1# The test for bug lp:1376934
2# Set max_statement_time for statement context
3# did not affect time limit for statement execution.
4
5--source include/have_statement_timeout.inc
6--source include/not_embedded.inc
7
8
9--echo #
10--echo # Test max statement time interruption.
11--echo # Note that if SLEEP() is interrupted, it returns 1.
12--echo #
13
14SET STATEMENT max_statement_time = 10 FOR SELECT SLEEP(1000);
015
=== modified file 'sql/sql_parse.cc'
--- sql/sql_parse.cc 2014-12-16 06:00:17 +0000
+++ sql/sql_parse.cc 2015-01-13 10:04:23 +0000
@@ -2607,6 +2607,7 @@
2607 bool have_table_map_for_update= FALSE;2607 bool have_table_map_for_update= FALSE;
2608#endif2608#endif
2609 struct system_variables *per_query_variables_backup;2609 struct system_variables *per_query_variables_backup;
2610 bool reset_timer= false;
26102611
2611 DBUG_ENTER("mysql_execute_command");2612 DBUG_ENTER("mysql_execute_command");
2612 DBUG_ASSERT(!lex->describe || is_explainable_query(lex->sql_command));2613 DBUG_ASSERT(!lex->describe || is_explainable_query(lex->sql_command));
@@ -2819,8 +2820,6 @@
2819 } /* endif unlikely slave */2820 } /* endif unlikely slave */
2820#endif2821#endif
28212822
2822 bool reset_timer= set_statement_timer(thd);
2823
2824 status_var_increment(thd->status_var.com_stat[lex->sql_command]);2823 status_var_increment(thd->status_var.com_stat[lex->sql_command]);
28252824
2826 Opt_trace_start ots(thd, all_tables, lex->sql_command, &lex->var_list,2825 Opt_trace_start ots(thd, all_tables, lex->sql_command, &lex->var_list,
@@ -2933,6 +2932,8 @@
2933 }2932 }
2934 }2933 }
29352934
2935 reset_timer= set_statement_timer(thd);
2936
2936 switch (lex->sql_command) {2937 switch (lex->sql_command) {
29372938
2938 case SQLCOM_SHOW_STATUS:2939 case SQLCOM_SHOW_STATUS:

Subscribers

People subscribed via source and target branches