mariadb/mysql-test/t/timeout.test
Sergey Vojtovich 8026cd6202 MDEV-11379, MDEV-11388 - [WAIT n|NOWAIT]
Extended syntax so that it is now possible to set lock_wait_timeout for the
following statements:
SELECT ... FOR UPDATE [WAIT n|NOWAIT]
SELECT ... LOCK IN SHARED MODE [WAIT n|NOWAIT]
LOCK TABLE ... [WAIT n|NOWAIT]
CREATE ... INDEX ON tbl_name (index_col_name, ...) [WAIT n|NOWAIT] ...
ALTER TABLE tbl_name [WAIT n|NOWAIT] ...
OPTIMIZE TABLE tbl_name [WAIT n|NOWAIT]
DROP INDEX ... [WAIT n|NOWAIT]
TRUNCATE TABLE tbl_name [WAIT n|NOWAIT]
RENAME TABLE tbl_name [WAIT n|NOWAIT] ...
DROP TABLE tbl_name [WAIT n|NOWAIT] ...

Valid range of lock_wait_timeout and innodb_lock_wait_timeout was extended so
that 0 is acceptable value (means no wait).

This is amended AliSQL patch. We prefer Oracle syntax for [WAIT n|NOWAIT]
instead of original [WAIT [n]|NO_WAIT].
2017-03-22 19:08:24 +04:00

60 lines
1.7 KiB
Text

--echo #
--echo # MDEV-11379 - AliSQL: [Feature] Issue#8: SELECT FOR UPDATE WAIT
--echo # MDEV-11388 - AliSQL: [Feature] Issue#15 DDL FAST FAIL
--echo #
CREATE TABLE t1(a INT, b TEXT, c MULTIPOLYGON NOT NULL);
CREATE INDEX i1 ON t1(a) WAIT 1;
CREATE FULLTEXT INDEX i2 ON t1(b) WAIT 1;
CREATE SPATIAL INDEX i3 ON t1(c) WAIT 1;
ALTER TABLE t1 WAIT 1 COMMENT='test';
OPTIMIZE TABLE t1 WAIT 1;
DROP INDEX i1 ON t1 WAIT 1;
TRUNCATE TABLE t1 WAIT 1;
RENAME TABLE t1 WAIT 1 TO t2;
RENAME TABLE t2 NOWAIT TO t1;
connect(con1, localhost, root,,);
LOCK TABLE t1 WRITE WAIT 31536001;
connection default;
--error ER_LOCK_WAIT_TIMEOUT
CREATE INDEX i1 ON t1(a) WAIT 0;
--error ER_LOCK_WAIT_TIMEOUT
CREATE INDEX i1 ON t1(a) NOWAIT;
--error ER_LOCK_WAIT_TIMEOUT
CREATE FULLTEXT INDEX i2 ON t1(b) WAIT 0;
--error ER_LOCK_WAIT_TIMEOUT
CREATE FULLTEXT INDEX i2 ON t1(b) NOWAIT;
--error ER_LOCK_WAIT_TIMEOUT
CREATE SPATIAL INDEX i3 ON t1(c) WAIT 0;
--error ER_LOCK_WAIT_TIMEOUT
CREATE SPATIAL INDEX i3 ON t1(c) NOWAIT;
--error ER_LOCK_WAIT_TIMEOUT
ALTER TABLE t1 WAIT 0 COMMENT='test';
--error ER_LOCK_WAIT_TIMEOUT
ALTER TABLE t1 NOWAIT COMMENT='test';
OPTIMIZE TABLE t1 WAIT 0;
OPTIMIZE TABLE t1 NOWAIT;
--error ER_LOCK_WAIT_TIMEOUT
DROP INDEX i1 ON t1 WAIT 0;
--error ER_LOCK_WAIT_TIMEOUT
DROP INDEX i1 ON t1 NOWAIT;
--error ER_LOCK_WAIT_TIMEOUT
TRUNCATE TABLE t1 WAIT 0;
--error ER_LOCK_WAIT_TIMEOUT
TRUNCATE TABLE t1 NOWAIT;
--error ER_LOCK_WAIT_TIMEOUT
RENAME TABLE t1 WAIT 0 TO t2;
--error ER_LOCK_WAIT_TIMEOUT
RENAME TABLE t1 NOWAIT TO t2;
--error ER_LOCK_WAIT_TIMEOUT
DROP TABLE t1 WAIT 0;
--error ER_LOCK_WAIT_TIMEOUT
DROP TABLE t1 NOWAIT;
--error ER_LOCK_WAIT_TIMEOUT
LOCK TABLE t1 WRITE WAIT 0;
--error ER_LOCK_WAIT_TIMEOUT
LOCK TABLE t1 WRITE NOWAIT;
disconnect con1;
DROP TABLE t1 WAIT 1;