diff options
author | Michael Widenius <monty@mariadb.org> | 2019-01-14 15:46:49 +0200 |
---|---|---|
committer | Michael Widenius <monty@mariadb.org> | 2019-01-14 16:18:50 +0200 |
commit | aad0165ceab4fa4e756f5fd473ef9df003a447cb (patch) | |
tree | 1ed8c68e116b67a51b810e6c8b0c6b408ff23708 /mysql-test/main/backup_locks.test | |
parent | 3975e22d55834930be7b1939ae9a5d416fa0905a (diff) | |
download | mariadb-git-aad0165ceab4fa4e756f5fd473ef9df003a447cb.tar.gz |
Added support for BACKUP LOCK / BACKUP UNLOCK
Diffstat (limited to 'mysql-test/main/backup_locks.test')
-rw-r--r-- | mysql-test/main/backup_locks.test | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/mysql-test/main/backup_locks.test b/mysql-test/main/backup_locks.test new file mode 100644 index 00000000000..21b67100506 --- /dev/null +++ b/mysql-test/main/backup_locks.test @@ -0,0 +1,50 @@ +######################################################################## +# Tests BACKUP STAGE locking +######################################################################## + +--source include/have_innodb.inc +--source include/have_metadata_lock_info.inc +--source include/not_embedded.inc + +--echo # +--echo # Test lock taken +--echo # + +BACKUP LOCK test.t1; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP UNLOCK; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP LOCK t1; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP UNLOCK; +BACKUP LOCK non_existing.t1; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP UNLOCK; + +--echo # +--echo # Test that backup lock protects against ddl +--echo # + +connect (con1,localhost,root,,); + +connection default; +create table t1 (a int) engine=innodb; +insert into t1 values (1); +backup lock t1; +select * from t1; +connection con1; +--send drop table t1 +connection default; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock"; +--source include/wait_condition.inc +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +--error ER_LOCK_DEADLOCK +select * from t1; +backup unlock; +connection con1; +--reap +connection default; +disconnect con1; +show tables; |