mirror of
https://github.com/MariaDB/server.git
synced 2025-02-12 00:15:35 +01:00
![Monty](/assets/img/avatar_default.png)
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.
43 lines
1.1 KiB
Text
43 lines
1.1 KiB
Text
--source include/have_innodb.inc
|
|
CREATE TABLE t1 (a INT)ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES(1);
|
|
|
|
--enable_info
|
|
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 ;|
|
|
|
|
EXECUTE stmt;
|
|
EXECUTE stmt1;
|
|
call p1();
|
|
call p2();
|
|
|
|
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);
|
|
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
|
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;
|
|
ALTER TABLE t1 DROP PRIMARY KEY, ALGORITHM=DEFAULT;
|
|
DROP TABLE t1;
|
|
--disable_info
|
|
SET GLOBAL innodb_instant_alter_column_allowed=@save_allowed;
|