mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-33655 Remove alter_algorithm
Remove alter_algorithm but keep the variable as no-op (with a warning). The reasons for removing alter_algorithm are: - alter_algorithm was introduced as a replacement for the old_alter_table that was used to force the usage of the original alter table algorithm (copy) in the cases where the new alter algorithm did not work. The new option was added as a way to force the usage of a specific algorithm when it should instead have made it possible to disable algorithms that would not work for some reason. - alter_algorithm introduced some cases where ALTER TABLE would not work without specifying the ALGORITHM=XXX option together with ALTER TABLE. - Having different values of alter_algorithm on master and slave could cause slave to stop unexpectedly. - ALTER TABLE FORCE, as used by mariadb-upgrade, would not always work if alter_algorithm was set for the server. - As part of the MDEV-33449 "improving repair of tables" it become clear that alter- algorithm made it harder to provide a better and more consistent ALTER TABLE FORCE and REPAIR TABLE and it would be better to remove it.
This commit is contained in:
@@ -2,13 +2,7 @@
|
||||
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 |;
|
||||
@@ -23,24 +17,11 @@ BEGIN
|
||||
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;
|
||||
@@ -51,9 +32,8 @@ 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;
|
||||
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=INSTANT;
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=NOCOPY;
|
||||
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=DEFAULT;
|
||||
|
Reference in New Issue
Block a user