mariadb/mysql-test/main/backup_priv.test
Monty c53aab974b Added syntax and implementation for BACKUP STAGE's
Part of MDEV-5336 Implement LOCK FOR BACKUP

- Changed check of Global_only_lock to also include BACKUP lock.
- We store latest MDL_BACKUP_DDL lock in thd->mdl_backup_ticket to be able
  to downgrade lock during copy_data_between_tables()
2018-12-09 22:12:27 +02:00

52 lines
1.4 KiB
Text

--source include/have_innodb.inc
--source include/not_embedded.inc
--source include/have_metadata_lock_info.inc
--echo #
--echo # Test privileges for BACKUP STAGES
--echo #
set sql_mode="";
GRANT RELOAD ON *.* TO user1@localhost;
GRANT CREATE, DROP ON *.* TO user2@localhost;
--connect(con1, localhost, user1)
BACKUP STAGE START;
BACKUP STAGE END;
--echo # change_user must release backup lock
BACKUP STAGE START;
BACKUP STAGE FLUSH;
SELECT lock_mode FROM information_schema.metadata_lock_info WHERE lock_type='Backup lock';
change_user user2;
SELECT lock_mode FROM information_schema.metadata_lock_info WHERE lock_type='Backup lock';
--disconnect con1
--source include/wait_until_disconnected.inc
--connection default
--echo # A very low privileged user (-> con4) cannot acquire the backup lock
--connect(con1, localhost, user2)
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP STAGE START;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP STAGE FLUSH;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP STAGE BLOCK_DDL;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP STAGE BLOCK_COMMIT;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP STAGE END;
--disconnect con1
--source include/wait_until_disconnected.inc
--connection default
DROP USER user1@localhost, user2@localhost;
--echo #
--echo # Test using BACKUP STAGES in a SP
--echo #
--error ER_SP_BADSTATEMENT
create procedure foo42()
BACKUP STAGE START;