Skip to content

Commit

Permalink
DDL recovery for high-level indexes
Browse files Browse the repository at this point in the history
Covers CREATE, DROP and RENAME.
  • Loading branch information
svoj committed Oct 2, 2024
1 parent 6651768 commit 5bea61a
Show file tree
Hide file tree
Showing 8 changed files with 282 additions and 19 deletions.
123 changes: 123 additions & 0 deletions mysql-test/suite/atomic/create_table.result
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,77 @@ t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
query: CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
crash point: ddl_log_create_before_create_frm
t2.MYD
t2.MYI
t2.frm
crash point: storage_engine_middle_of_create
"No crash!"
t1#i#00.MYD
t1#i#00.MYI
t1.MYD
t1.MYI
t1.frm
t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
crash point: ddl_log_create_before_create_table
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_create_table
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_drop
"No crash!"
t1#i#00.MYD
t1#i#00.MYI
t1.MYD
t1.MYI
t1.frm
t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
crash point: ddl_log_create_before_binlog
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_prepare_eof
"No crash!"
t1#i#00.MYD
t1#i#00.MYI
t1.MYD
t1.MYI
t1.frm
t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
crash point: ddl_log_create_after_binlog
t1#i#00.MYD
t1#i#00.MYI
t1.MYD
t1.MYI
t1.frm
t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
crash point: ddl_log_create_log_complete
"No crash!"
t1#i#00.MYD
t1#i#00.MYI
t1.MYD
t1.MYI
t1.frm
t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
query: CREATE OR REPLACE TABLE t2 (a int)
crash point: ddl_log_create_before_create_frm
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */
Expand Down Expand Up @@ -348,6 +419,58 @@ t1.ibd
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
query: CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
crash point: ddl_log_create_before_create_frm
t2.frm
t2.ibd
crash point: storage_engine_middle_of_create
"No crash!"
t1#i#00.ibd
t1.frm
t1.ibd
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
crash point: ddl_log_create_before_create_table
t2.frm
t2.ibd
crash point: ddl_log_create_after_create_table
t2.frm
t2.ibd
crash point: ddl_log_create_after_drop
"No crash!"
t1#i#00.ibd
t1.frm
t1.ibd
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
crash point: ddl_log_create_before_binlog
t2.frm
t2.ibd
crash point: ddl_log_create_after_prepare_eof
"No crash!"
t1#i#00.ibd
t1.frm
t1.ibd
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
crash point: ddl_log_create_after_binlog
t1#i#00.ibd
t1.frm
t1.ibd
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
crash point: ddl_log_create_log_complete
"No crash!"
t1#i#00.ibd
t1.frm
t1.ibd
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))
query: CREATE OR REPLACE TABLE t2 (a int)
crash point: ddl_log_create_before_create_frm
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */
Expand Down
3 changes: 2 additions & 1 deletion mysql-test/suite/atomic/create_table.test
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ if ($engine_count == "")
let $crash_count=9;
let $crash_points='ddl_log_create_before_create_frm', 'storage_engine_middle_of_create', 'ddl_log_create_before_create_table', 'ddl_log_create_after_create_table', 'ddl_log_create_after_drop', 'ddl_log_create_before_binlog', 'ddl_log_create_after_prepare_eof', 'ddl_log_create_after_binlog', 'ddl_log_create_log_complete';

let $statement_count=6;
let $statement_count=7;
let $statements='CREATE TABLE t1 (a int)',
'CREATE TABLE t1 (a blob not null, VECTOR INDEX(a))',
'CREATE OR REPLACE TABLE t2 (a int)',
'CREATE TABLE t1 LIKE const_table',
'CREATE OR REPLACE TABLE t2 LIKE const_table',
Expand Down
62 changes: 62 additions & 0 deletions mysql-test/suite/atomic/drop_table.result
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
call mtr.add_suppression("InnoDB: .* does not exist in the InnoDB internal");
RESET MASTER;
"engine: myisam crash point: ddl_log_drop_before_delete_hlindex position: 1"
t2#i#00.MYD
t2#i#00.MYI
t2.MYD
t2.MYI
t2.TRG
t2.frm
t2_trg.TRN
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */
"engine: myisam crash point: ddl_log_drop_before_delete_hlindex position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: myisam crash point: ddl_log_drop_before_delete_table position: 1"
t2#i#00.MYD
t2#i#00.MYI
t2.MYD
t2.MYI
t2.TRG
Expand All @@ -10,6 +23,8 @@ master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated
"engine: myisam crash point: ddl_log_drop_before_delete_table position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: myisam crash point: ddl_log_drop_after_delete_table position: 1"
t2#i#00.MYD
t2#i#00.MYI
t2.MYD
t2.MYI
t2.TRG
Expand All @@ -19,6 +34,8 @@ master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated
"engine: myisam crash point: ddl_log_drop_after_delete_table position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: myisam crash point: ddl_log_drop_before_drop_trigger position: 1"
t2#i#00.MYD
t2#i#00.MYI
t2.MYD
t2.MYI
t2.TRG
Expand All @@ -28,6 +45,8 @@ master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated
"engine: myisam crash point: ddl_log_drop_before_drop_trigger position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: myisam crash point: ddl_log_drop_before_drop_trigger2 position: 1"
t2#i#00.MYD
t2#i#00.MYI
t2.MYD
t2.MYI
t2.TRG
Expand All @@ -37,6 +56,8 @@ master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated
"engine: myisam crash point: ddl_log_drop_before_drop_trigger2 position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: myisam crash point: ddl_log_drop_after_drop_trigger position: 1"
t2#i#00.MYD
t2#i#00.MYI
t2.MYD
t2.MYI
t2.TRG
Expand All @@ -55,6 +76,15 @@ master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by s
"engine: myisam crash point: ddl_log_drop_after_binlog position: 2"
"No crash!"
master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by server */
"engine: aria crash point: ddl_log_drop_before_delete_hlindex position: 1"
t2.MAD
t2.MAI
t2.TRG
t2.frm
t2_trg.TRN
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */
"engine: aria crash point: ddl_log_drop_before_delete_hlindex position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: aria crash point: ddl_log_drop_before_delete_table position: 1"
t2.MAD
t2.MAI
Expand Down Expand Up @@ -110,6 +140,15 @@ master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by s
"engine: aria crash point: ddl_log_drop_after_binlog position: 2"
"No crash!"
master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by server */
"engine: aria_notrans crash point: ddl_log_drop_before_delete_hlindex position: 1"
t2.MAD
t2.MAI
t2.TRG
t2.frm
t2_trg.TRN
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */
"engine: aria_notrans crash point: ddl_log_drop_before_delete_hlindex position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: aria_notrans crash point: ddl_log_drop_before_delete_table position: 1"
t2.MAD
t2.MAI
Expand Down Expand Up @@ -165,7 +204,17 @@ master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by s
"engine: aria_notrans crash point: ddl_log_drop_after_binlog position: 2"
"No crash!"
master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by server */
"engine: innodb crash point: ddl_log_drop_before_delete_hlindex position: 1"
t2#i#00.ibd
t2.TRG
t2.frm
t2.ibd
t2_trg.TRN
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */
"engine: innodb crash point: ddl_log_drop_before_delete_hlindex position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: innodb crash point: ddl_log_drop_before_delete_table position: 1"
t2#i#00.ibd
t2.TRG
t2.frm
t2.ibd
Expand All @@ -174,6 +223,7 @@ master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated
"engine: innodb crash point: ddl_log_drop_before_delete_table position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: innodb crash point: ddl_log_drop_after_delete_table position: 1"
t2#i#00.ibd
t2.TRG
t2.frm
t2.ibd
Expand All @@ -182,6 +232,7 @@ master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated
"engine: innodb crash point: ddl_log_drop_after_delete_table position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: innodb crash point: ddl_log_drop_before_drop_trigger position: 1"
t2#i#00.ibd
t2.TRG
t2.frm
t2.ibd
Expand All @@ -190,6 +241,7 @@ master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated
"engine: innodb crash point: ddl_log_drop_before_drop_trigger position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: innodb crash point: ddl_log_drop_before_drop_trigger2 position: 1"
t2#i#00.ibd
t2.TRG
t2.frm
t2.ibd
Expand All @@ -198,6 +250,7 @@ master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated
"engine: innodb crash point: ddl_log_drop_before_drop_trigger2 position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: innodb crash point: ddl_log_drop_after_drop_trigger position: 1"
t2#i#00.ibd
t2.TRG
t2.frm
t2.ibd
Expand All @@ -215,6 +268,15 @@ master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by s
"engine: innodb crash point: ddl_log_drop_after_binlog position: 2"
"No crash!"
master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by server */
"engine: csv crash point: ddl_log_drop_before_delete_hlindex position: 1"
t2.CSM
t2.CSV
t2.TRG
t2.frm
t2_trg.TRN
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */
"engine: csv crash point: ddl_log_drop_before_delete_hlindex position: 2"
master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by ddl recovery */
"engine: csv crash point: ddl_log_drop_before_delete_table position: 1"
t2.CSM
t2.CSV
Expand Down
15 changes: 11 additions & 4 deletions mysql-test/suite/atomic/drop_table.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
let $engine_count=5;
let $engines='myisam','aria','aria_notrans','innodb','csv';

let $crash_count=7;
let $crash_points='ddl_log_drop_before_delete_table', 'ddl_log_drop_after_delete_table', 'ddl_log_drop_before_drop_trigger', 'ddl_log_drop_before_drop_trigger2', 'ddl_log_drop_after_drop_trigger', 'ddl_log_drop_before_binlog', 'ddl_log_drop_after_binlog';
let $crash_count=8;
let $crash_points='ddl_log_drop_before_delete_hlindex', 'ddl_log_drop_before_delete_table', 'ddl_log_drop_after_delete_table', 'ddl_log_drop_before_drop_trigger', 'ddl_log_drop_before_drop_trigger2', 'ddl_log_drop_after_drop_trigger', 'ddl_log_drop_before_binlog', 'ddl_log_drop_after_binlog';

# Number of drops in the tested statement
let $drops=2;
Expand All @@ -36,15 +36,22 @@ while ($e < $engine_count)
let $engine=`select ELT($e, $engines)`;
let $default_engine=$engine;
let $extra_option=;
let $vector=, v blob not null default x'e360d63ebe554f3fcdbc523f4522193f5236083d', vector index(v);

if ($engine == "aria")
{
let $extra_option=transactional=1;
let $vector=;
}
if ($engine == "aria_notrans")
{
let $default_engine="aria";
let $extra_option=transactional=0;
let $vector=;
}
if ($engine == "csv")
{
let $vector=;
}

let $c=0;
Expand All @@ -58,9 +65,9 @@ while ($e < $engine_count)
inc $r;
--eval set @@default_storage_engine=$default_engine
--eval create table t1 (a int not null) $extra_option;
--eval create table t2 (b int not null) $extra_option;
--eval create table t2 (b int not null $vector) $extra_option;
insert into t1 values(1);
insert into t2 values(2);
insert into t2 (b) values(2);
flush tables;

delimiter |;
Expand Down
Loading

0 comments on commit 5bea61a

Please sign in to comment.