Skip to content

Commit

Permalink
MYSQL-15: Implement server-side statement timeout support
Browse files Browse the repository at this point in the history
Extend testing of the maximum execution time for statements.
  • Loading branch information
Davi Arnaut committed Mar 6, 2012
1 parent d17ccb9 commit 69580d9
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
27 changes: 27 additions & 0 deletions mysql-test/r/max_statement_time.result
Expand Up @@ -124,3 +124,30 @@ UPDATE t1 SET a = 2;
ERROR 70100: Query execution was interrupted, max_statement_time exceeded
ROLLBACK;
DROP TABLE t1;

# Test interaction with lock waits.

CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET @@SESSION.max_statement_time = 500;
LOCK TABLES t1 WRITE;
LOCK TABLES t1 READ;
ERROR 70100: Query execution was interrupted, max_statement_time exceeded
UNLOCK TABLES;
BEGIN;
SELECT * FROM t1;
a
1
ALTER TABLE t1 ADD COLUMN b INT;
ERROR 70100: Query execution was interrupted, max_statement_time exceeded
ROLLBACK;
SELECT GET_LOCK('lock', 1);
GET_LOCK('lock', 1)
1
SELECT GET_LOCK('lock', 1);
GET_LOCK('lock', 1)
NULL
SELECT RELEASE_LOCK('lock');
RELEASE_LOCK('lock')
1
DROP TABLE t1;
Empty file.
16 changes: 16 additions & 0 deletions mysql-test/suite/randgen/t/max_statement_time.test
@@ -0,0 +1,16 @@
--source include/have_statement_timeout.inc
--source suite/randgen/include/setup_rqg.inc

let RQG_LOG_FILE = $RQG_LOG_DIR/rqg_example.log;

exec perl $RQG_HOME/gentest.pl
--dsn=dbi:mysql:host=127.0.0.1:port=$MASTER_MYPORT:user=root:database=test
--logconf=$MYSQLTEST_VARDIR/std_data/randgen/log.conf
--gendata=$RQG_HOME/conf/twitter/max_statement_time.zz
--grammar=$RQG_HOME/conf/twitter/max_statement_time.yy
--engine=$RQG_ENGINE
--queries=100K
--threads=25
--duration=600;

--source suite/randgen/include/cleanup.inc
38 changes: 38 additions & 0 deletions mysql-test/t/max_statement_time.test
Expand Up @@ -179,3 +179,41 @@ disconnect con1;
connection default;
ROLLBACK;
DROP TABLE t1;

--echo
--echo # Test interaction with lock waits.
--echo

CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);

connect (con1,localhost,root,,test,,);
SET @@SESSION.max_statement_time = 500;

connection default;
LOCK TABLES t1 WRITE;

connection con1;
--error ER_QUERY_TIMEOUT
LOCK TABLES t1 READ;

connection default;
UNLOCK TABLES;
BEGIN;
SELECT * FROM t1;

connection con1;
--error ER_QUERY_TIMEOUT
ALTER TABLE t1 ADD COLUMN b INT;

connection default;
ROLLBACK;
SELECT GET_LOCK('lock', 1);

connection con1;
SELECT GET_LOCK('lock', 1);

disconnect con1;
connection default;
SELECT RELEASE_LOCK('lock');
DROP TABLE t1;

0 comments on commit 69580d9

Please sign in to comment.