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

Proposed by Vlad Lesin on 2015-01-13
Status: Merged
Approved by: Laurynas Biveinis on 2015-01-13
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 2015-01-13 Approve on 2015-01-13
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.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'mysql-test/r/set_statement_and_max_statement_time.result'
2--- mysql-test/r/set_statement_and_max_statement_time.result 1970-01-01 00:00:00 +0000
3+++ mysql-test/r/set_statement_and_max_statement_time.result 2015-01-13 10:04:23 +0000
4@@ -0,0 +1,7 @@
5+#
6+# Test max statement time interruption.
7+# Note that if SLEEP() is interrupted, it returns 1.
8+#
9+SET STATEMENT max_statement_time = 10 FOR SELECT SLEEP(1000);
10+SLEEP(1000)
11+1
12
13=== added file 'mysql-test/t/set_statement_and_max_statement_time.test'
14--- mysql-test/t/set_statement_and_max_statement_time.test 1970-01-01 00:00:00 +0000
15+++ mysql-test/t/set_statement_and_max_statement_time.test 2015-01-13 10:04:23 +0000
16@@ -0,0 +1,14 @@
17+# The test for bug lp:1376934
18+# Set max_statement_time for statement context
19+# did not affect time limit for statement execution.
20+
21+--source include/have_statement_timeout.inc
22+--source include/not_embedded.inc
23+
24+
25+--echo #
26+--echo # Test max statement time interruption.
27+--echo # Note that if SLEEP() is interrupted, it returns 1.
28+--echo #
29+
30+SET STATEMENT max_statement_time = 10 FOR SELECT SLEEP(1000);
31
32=== modified file 'sql/sql_parse.cc'
33--- sql/sql_parse.cc 2014-12-16 06:00:17 +0000
34+++ sql/sql_parse.cc 2015-01-13 10:04:23 +0000
35@@ -2607,6 +2607,7 @@
36 bool have_table_map_for_update= FALSE;
37 #endif
38 struct system_variables *per_query_variables_backup;
39+ bool reset_timer= false;
40
41 DBUG_ENTER("mysql_execute_command");
42 DBUG_ASSERT(!lex->describe || is_explainable_query(lex->sql_command));
43@@ -2819,8 +2820,6 @@
44 } /* endif unlikely slave */
45 #endif
46
47- bool reset_timer= set_statement_timer(thd);
48-
49 status_var_increment(thd->status_var.com_stat[lex->sql_command]);
50
51 Opt_trace_start ots(thd, all_tables, lex->sql_command, &lex->var_list,
52@@ -2933,6 +2932,8 @@
53 }
54 }
55
56+ reset_timer= set_statement_timer(thd);
57+
58 switch (lex->sql_command) {
59
60 case SQLCOM_SHOW_STATUS:

Subscribers

People subscribed via source and target branches