mirror of
https://github.com/MariaDB/server.git
synced 2025-02-07 06:12:18 +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.
57 lines
1.7 KiB
Text
57 lines
1.7 KiB
Text
CREATE TABLE t1 (a INT)ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES(1);
|
|
PREPARE stmt FROM 'ALTER TABLE t1 ADD KEY idx(a)';
|
|
affected rows: 0
|
|
info: Statement prepared
|
|
PREPARE stmt1 FROM 'ALTER TABLE t1 DROP KEY idx';
|
|
affected rows: 0
|
|
info: Statement prepared
|
|
CREATE OR REPLACE PROCEDURE p1()
|
|
BEGIN
|
|
ALTER TABLE t1 ADD KEY idx2(a);
|
|
END|
|
|
affected rows: 0
|
|
CREATE OR REPLACE PROCEDURE p2()
|
|
BEGIN
|
|
ALTER TABLE t1 DROP KEY idx2;
|
|
END|
|
|
affected rows: 0
|
|
EXECUTE stmt;
|
|
affected rows: 0
|
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
|
EXECUTE stmt1;
|
|
affected rows: 0
|
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
|
call p1();
|
|
affected rows: 0
|
|
call p2();
|
|
affected rows: 0
|
|
DROP TABLE t1;
|
|
affected rows: 0
|
|
DROP PROCEDURE p1;
|
|
affected rows: 0
|
|
DROP PROCEDURE p2;
|
|
affected rows: 0
|
|
SET @save_allowed= @@GLOBAL.innodb_instant_alter_column_allowed;
|
|
affected rows: 0
|
|
SET GLOBAL innodb_instant_alter_column_allowed=never;
|
|
affected rows: 0
|
|
CREATE TABLE t1(id INT PRIMARY KEY,
|
|
col1 INT UNSIGNED NOT NULL UNIQUE)ENGINE=InnoDB;
|
|
affected rows: 0
|
|
INSERT INTO t1 VALUES(1,1),(2,2),(3,3);
|
|
affected rows: 3
|
|
info: Records: 3 Duplicates: 0 Warnings: 0
|
|
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=INSTANT;
|
|
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
|
|
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=NOCOPY;
|
|
ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
|
|
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=DEFAULT;
|
|
affected rows: 0
|
|
info: Records: 0 Duplicates: 0 Warnings: 0
|
|
ALTER TABLE t1 DROP PRIMARY KEY, ALGORITHM=DEFAULT;
|
|
affected rows: 3
|
|
info: Records: 3 Duplicates: 0 Warnings: 0
|
|
DROP TABLE t1;
|
|
affected rows: 0
|
|
SET GLOBAL innodb_instant_alter_column_allowed=@save_allowed;
|