diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/innodb/t/alter_algorithm2.test | |
parent | Initial commit. (diff) | |
download | mariadb-upstream.tar.xz mariadb-upstream.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/innodb/t/alter_algorithm2.test')
-rw-r--r-- | mysql-test/suite/innodb/t/alter_algorithm2.test | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/t/alter_algorithm2.test b/mysql-test/suite/innodb/t/alter_algorithm2.test new file mode 100644 index 00000000..cdece239 --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_algorithm2.test @@ -0,0 +1,63 @@ +--source include/have_innodb.inc +CREATE TABLE t1 (a INT)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); + +# alter_algorithm variable doesn't affect when ALTER stmt +# during PREPARE PHASE or CREATE PROCEDURE +# Only when execution/call happens, alter uses the alter_algorithm +# variable when user does not mention algorithm explicitly. + +--enable_info +SET alter_algorithm='INPLACE'; +PREPARE stmt FROM 'ALTER TABLE t1 ADD KEY idx(a)'; +PREPARE stmt1 FROM 'ALTER TABLE t1 DROP KEY idx'; +DELIMITER |; +CREATE OR REPLACE PROCEDURE p1() +BEGIN + ALTER TABLE t1 ADD KEY idx2(a); +END| + +CREATE OR REPLACE PROCEDURE p2() +BEGIN + ALTER TABLE t1 DROP KEY idx2; +END| +DELIMITER ;| + +SET alter_algorithm='COPY'; +EXECUTE stmt; +EXECUTE stmt1; +call p1(); +call p2(); + +SET alter_algorithm='NOCOPY'; +EXECUTE stmt; +EXECUTE stmt1; +call p1(); +call p2(); + +SET alter_algorithm='INSTANT'; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +EXECUTE stmt; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +call p1(); + +DROP TABLE t1; +DROP PROCEDURE p1; +DROP PROCEDURE p2; + +SET @save_allowed= @@GLOBAL.innodb_instant_alter_column_allowed; +SET GLOBAL innodb_instant_alter_column_allowed=never; + +CREATE TABLE t1(id INT PRIMARY KEY, + col1 INT UNSIGNED NOT NULL UNIQUE)ENGINE=InnoDB; +INSERT INTO t1 VALUES(1,1),(2,2),(3,3); +SET ALTER_ALGORITHM=INSTANT; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 DROP COLUMN col1; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=NOCOPY; +ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=DEFAULT; +ALTER TABLE t1 DROP PRIMARY KEY, ALGORITHM=DEFAULT; +DROP TABLE t1; +--disable_info +SET GLOBAL innodb_instant_alter_column_allowed=@save_allowed; |