Skip to content

Commit 149ba49

Browse files
committed
Bug#21021670 - MISLEADING WARNING WHEN PER-QUERY STATEMENT TIME IS EXCEEDED
Issue here is, error reported on exceeding statement time contains session variable "max_statement_time" in it. This error message is misleading when max_statement_time is *not* set and timeout value is set at statement level. The timeout value can be set either at session level using max_statement_time variable or at statement level. If execution of statement takes more than timeout value then following error is reported, "Query execution was interrupted, max_statement_time exceeded". When session variable max_statement_time is not set and timeout value is set at statement level then error message with max_statement_time in it on timeout is misleading. Fix: Modified error message so that max_statement_time is not used in it. Now on error following error message is reported, "Query execution was interrupted, maximum statement execution time exceeded"
1 parent e1ef4b7 commit 149ba49

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

mysql-test/r/max_statement_time.result

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ INSERT INTO t1 SELECT * FROM t1;
9292
INSERT INTO t1 SELECT * FROM t1;
9393
SET @@SESSION.max_statement_time= 2;
9494
SELECT *, SLEEP(0.5) from t1;
95-
ERROR HY000: Query execution was interrupted, max_statement_time exceeded
95+
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
9696
LOCK TABLE t1 WRITE;
9797
SELECT * FROM t1;
98-
ERROR HY000: Query execution was interrupted, max_statement_time exceeded
98+
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
9999
SELECT MAX_STATEMENT_TIME=1 * FROM t1;
100-
ERROR HY000: Query execution was interrupted, max_statement_time exceeded
100+
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
101101
UNLOCK TABLES;
102102
CREATE TABLE t2 SELECT * FROM t1;
103103
ALTER TABLE t2 ADD c VARCHAR(200) default 'new_col';
@@ -117,9 +117,9 @@ PREPARE stmt1 FROM "SELECT *, SLEEP(0.5) FROM t1 WHERE b= 'new_string'";
117117
PREPARE stmt2 FROM "SELECT MAX_STATEMENT_TIME=2 *, SLEEP(0.5) FROM t1 WHERE b= 'new_string'";
118118
PREPARE stmt3 FROM "SELECT MAX_STATEMENT_TIME=3600000 count(*) FROM t1";
119119
EXECUTE stmt1;
120-
ERROR HY000: Query execution was interrupted, max_statement_time exceeded
120+
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
121121
EXECUTE stmt2;
122-
ERROR HY000: Query execution was interrupted, max_statement_time exceeded
122+
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
123123
EXECUTE stmt3;
124124
count(*)
125125
4096
@@ -148,7 +148,7 @@ END|
148148
INSERT INTO t2 VALUES (1, 'string1', 'string2');
149149
SET @@SESSION.max_statement_time= 2;
150150
SELECT f1();
151-
ERROR HY000: Query execution was interrupted, max_statement_time exceeded
151+
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
152152
SELECT MAX_STATEMENT_TIME=60000 f2();
153153
f2()
154154
1

mysql-test/r/opt_hint_timeout.result

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ INSERT INTO t1 SELECT * FROM t1;
1515
INSERT INTO t1 SELECT * FROM t1;
1616
INSERT INTO t1 SELECT * FROM t1;
1717
SELECT /*+ MAX_EXECUTION_TIME(1) */ * FROM t1 a, t1 b;
18-
ERROR HY000: Query execution was interrupted, max_statement_time exceeded
18+
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
1919
EXPLAIN SELECT /*+ MAX_EXECUTION_TIME(10) MAX_EXECUTION_TIME(100) */ * FROM t1;
2020
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2121
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2048 100.00 NULL
@@ -37,13 +37,13 @@ SELECT /*+ MAX_EXECUTION_TIME(4294967296) */ 1 FROM t1;
3737
Warnings:
3838
Warning 1064 Unsupported MAX_EXECUTION_TIME near ') */ 1 FROM t1' at line 1
3939
SELECT /*+ MAX_EXECUTION_TIME(1) */ *, SLEEP(1000) FROM t1;
40-
ERROR HY000: Query execution was interrupted, max_statement_time exceeded
40+
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
4141
SELECT /*+ MAX_EXECUTION_TIME(1) */ *, SLEEP(1000) FROM t1 UNION SELECT 1, 2, 3;
42-
ERROR HY000: Query execution was interrupted, max_statement_time exceeded
42+
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
4343
(SELECT /*+ MAX_EXECUTION_TIME(1) */ *, SLEEP(1000) FROM t1) UNION (SELECT 1, 2, 3);
44-
ERROR HY000: Query execution was interrupted, max_statement_time exceeded
44+
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
4545
((SELECT /*+ MAX_EXECUTION_TIME(1) */ *, SLEEP(1000) FROM t1));
46-
ERROR HY000: Query execution was interrupted, max_statement_time exceeded
46+
ERROR HY000: Query execution was interrupted, maximum statement execution time exceeded
4747

4848
# only SELECT statements supports the MAX_EXECUTION_TIME hint (warning):
4949

sql/share/errmsg-utf8.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7143,7 +7143,7 @@ ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS
71437143
eng "CHANGE MASTER TO with a MASTER_LOG_FILE clause but no MASTER_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file."
71447144

71457145
ER_QUERY_TIMEOUT
7146-
eng "Query execution was interrupted, max_statement_time exceeded"
7146+
eng "Query execution was interrupted, maximum statement execution time exceeded"
71477147

71487148
ER_NON_RO_SELECT_DISABLE_TIMER
71497149
eng "Select is not a read only statement, disabling timer"

0 commit comments

Comments
 (0)