mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
ALTER TABLE fixes for high-level indexes (iii)
quick_rm_table() expects .frm to exist when it removes high-level indexes. For cases like ALTER TABLE t1 RENAME TO t2, ENGINE=other_engine .frm was removed earlier. Another option would be removing high-level indexes explicitly before the first quick_rm_table() and skipping high-level indexes for subsequent quick_rm_table(NO_FRM_RENAME). But this suggested order may also help with ddl log recovery. That is if we crash before high-level indexes are removed, .frm is going to exist.
This commit is contained in:
committed by
Sergei Golubchik
parent
7aa6bb3aa3
commit
ca17b68bb6
@@ -394,7 +394,7 @@
|
|||||||
create vector index if not exists v on t1(v);
|
create vector index if not exists v on t1(v);
|
||||||
# CHANGE/MODIFY/DROP COLUMN (vector)
|
# CHANGE/MODIFY/DROP COLUMN (vector)
|
||||||
alter table t1 modify column v int;
|
alter table t1 modify column v int;
|
||||||
@@ -666,34 +666,6 @@
|
@@ -666,62 +666,6 @@
|
||||||
alter table t1 alter key if exists v ignored;
|
alter table t1 alter key if exists v ignored;
|
||||||
alter table t1 alter key if exists v not ignored;
|
alter table t1 alter key if exists v not ignored;
|
||||||
# ENGINE
|
# ENGINE
|
||||||
@@ -425,6 +425,34 @@
|
|||||||
- `v` blob NOT NULL,
|
- `v` blob NOT NULL,
|
||||||
- PRIMARY KEY (`id`),
|
- PRIMARY KEY (`id`),
|
||||||
- VECTOR KEY `v` (`v`)
|
- VECTOR KEY `v` (`v`)
|
||||||
|
-) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||||
|
-alter table t1 rename to t2, engine=myisam;
|
||||||
|
-db.opt
|
||||||
|
-t2#i#01.MYD
|
||||||
|
-t2#i#01.MYI
|
||||||
|
-t2.MYD
|
||||||
|
-t2.MYI
|
||||||
|
-t2.frm
|
||||||
|
-show create table t2;
|
||||||
|
-Table Create Table
|
||||||
|
-t2 CREATE TABLE `t2` (
|
||||||
|
- `id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
- `v` blob NOT NULL,
|
||||||
|
- PRIMARY KEY (`id`),
|
||||||
|
- VECTOR KEY `v` (`v`)
|
||||||
|
-) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||||
|
-alter table t2 rename to t1, engine=innodb;
|
||||||
|
-db.opt
|
||||||
|
-t1#i#01.ibd
|
||||||
|
-t1.frm
|
||||||
|
-t1.ibd
|
||||||
|
-show create table t1;
|
||||||
|
-Table Create Table
|
||||||
|
-t1 CREATE TABLE `t1` (
|
||||||
|
- `id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
- `v` blob NOT NULL,
|
||||||
|
- PRIMARY KEY (`id`),
|
||||||
|
- VECTOR KEY `v` (`v`)
|
||||||
-) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
-) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||||
# CHANGE/MODIFY/DROP COLUMN (vector)
|
# CHANGE/MODIFY/DROP COLUMN (vector)
|
||||||
alter table t1 modify column v int;
|
alter table t1 modify column v int;
|
||||||
|
@@ -781,6 +781,34 @@ t1 CREATE TABLE `t1` (
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
VECTOR KEY `v` (`v`)
|
VECTOR KEY `v` (`v`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||||
|
alter table t1 rename to t2, engine=myisam;
|
||||||
|
db.opt
|
||||||
|
t2#i#01.MYD
|
||||||
|
t2#i#01.MYI
|
||||||
|
t2.MYD
|
||||||
|
t2.MYI
|
||||||
|
t2.frm
|
||||||
|
show create table t2;
|
||||||
|
Table Create Table
|
||||||
|
t2 CREATE TABLE `t2` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`v` blob NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
VECTOR KEY `v` (`v`)
|
||||||
|
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||||
|
alter table t2 rename to t1, engine=innodb;
|
||||||
|
db.opt
|
||||||
|
t1#i#01.ibd
|
||||||
|
t1.frm
|
||||||
|
t1.ibd
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`v` blob NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
VECTOR KEY `v` (`v`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
|
||||||
# CHANGE/MODIFY/DROP COLUMN (vector)
|
# CHANGE/MODIFY/DROP COLUMN (vector)
|
||||||
alter table t1 modify column v int;
|
alter table t1 modify column v int;
|
||||||
ERROR HY000: Incorrect arguments to VECTOR INDEX
|
ERROR HY000: Incorrect arguments to VECTOR INDEX
|
||||||
|
@@ -352,6 +352,12 @@ show create table t1;
|
|||||||
alter table t1 engine=innodb;
|
alter table t1 engine=innodb;
|
||||||
list_files $datadir/test;
|
list_files $datadir/test;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
|
alter table t1 rename to t2, engine=myisam;
|
||||||
|
list_files $datadir/test;
|
||||||
|
show create table t2;
|
||||||
|
alter table t2 rename to t1, engine=innodb;
|
||||||
|
list_files $datadir/test;
|
||||||
|
show create table t1;
|
||||||
}
|
}
|
||||||
|
|
||||||
--echo # CHANGE/MODIFY/DROP COLUMN (vector)
|
--echo # CHANGE/MODIFY/DROP COLUMN (vector)
|
||||||
|
@@ -11931,10 +11931,6 @@ alter_copy:
|
|||||||
thd->push_internal_handler(&errors_to_warnings);
|
thd->push_internal_handler(&errors_to_warnings);
|
||||||
error_handler_pushed=1;
|
error_handler_pushed=1;
|
||||||
|
|
||||||
quick_rm_table(thd, old_db_type, &alter_ctx.db, &backup_name,
|
|
||||||
FN_IS_TMP | (engine_changed ? NO_HA_TABLE | NO_PAR_TABLE: 0));
|
|
||||||
|
|
||||||
debug_crash_here("ddl_log_alter_after_delete_backup");
|
|
||||||
if (engine_changed)
|
if (engine_changed)
|
||||||
{
|
{
|
||||||
/* the .frm file was removed but not the original table */
|
/* the .frm file was removed but not the original table */
|
||||||
@@ -11942,6 +11938,11 @@ alter_copy:
|
|||||||
NO_FRM_RENAME | (engine_changed ? 0 : FN_IS_TMP));
|
NO_FRM_RENAME | (engine_changed ? 0 : FN_IS_TMP));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug_crash_here("ddl_log_alter_after_delete_backup");
|
||||||
|
|
||||||
|
quick_rm_table(thd, old_db_type, &alter_ctx.db, &backup_name,
|
||||||
|
FN_IS_TMP | (engine_changed ? NO_HA_TABLE | NO_PAR_TABLE: 0));
|
||||||
|
|
||||||
debug_crash_here("ddl_log_alter_after_drop_original_table");
|
debug_crash_here("ddl_log_alter_after_drop_original_table");
|
||||||
if (binlog_as_create_select)
|
if (binlog_as_create_select)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user