summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-03-18 12:41:08 +0200
committerSergei Golubchik <serg@mariadb.org>2021-05-19 22:54:13 +0200
commit7762ee5dbec5c336628c06bbe950837257276e57 (patch)
tree44a1ad7add7ac4fca8b63ad257a9ca08b08303a1
parent3c578b0a960ce3f625b8e24c4c7605cec74e0154 (diff)
downloadmariadb-git-7762ee5dbec5c336628c06bbe950837257276e57.tar.gz
MDEV-25180 Atomic ALTER TABLE
MDEV-25604 Atomic DDL: Binlog event written upon recovery does not have default database The purpose of this task is to ensure that ALTER TABLE is atomic even if the MariaDB server would be killed at any point of the alter table. This means that either the ALTER TABLE succeeds (including that triggers, the status tables and the binary log are updated) or things should be reverted to their original state. If the server crashes before the new version is fully up to date and commited, it will revert to the original table and remove all temporary files and tables. If the new version is commited, crash recovery will use the new version, and update triggers, the status tables and the binary log. The one execption is ALTER TABLE .. RENAME .. where no changes are done to table definition. This one will work as RENAME and roll back unless the whole statement completed, including updating the binary log (if enabled). Other changes: - Added handlerton->check_version() function to allow the ddl recovery code to check, in case of inplace alter table, if the table in the storage engine is of the new or old version. - Added handler->table_version() so that an engine can report the current version of the table. This should be changed each time the table definition changes. - Added ha_signal_ddl_recovery_done() and handlerton::signal_ddl_recovery_done() to inform all handlers when ddl recovery has been done. (Needed by InnoDB). - Added handlerton call inplace_alter_table_committed, to signal engine that ddl_log has been closed for the alter table query. - Added new handerton flag HTON_REQUIRES_NOTIFY_TABLEDEF_CHANGED_AFTER_COMMIT to signal when we should call hton->notify_tabledef_changed() during mysql_inplace_alter_table. This was required as MyRocks and InnoDB needed the call at different times. - Added function server_uuid_value() to be able to generate a temporary xid when ddl recovery writes the query to the binary log. This is needed to be able to handle crashes during ddl log recovery. - Moved freeing of the frm definition to end of mysql_alter_table() to remove duplicate code and have a common exit strategy. ------- InnoDB part of atomic ALTER TABLE (Implemented by Marko Mäkelä) innodb_check_version(): Compare the saved dict_table_t::def_trx_id to determine whether an ALTER TABLE operation was committed. We must correctly recover dict_table_t::def_trx_id for this to work. Before purge removes any trace of DB_TRX_ID from system tables, it will make an effort to load the user table into the cache, so that the dict_table_t::def_trx_id can be recovered. ha_innobase::table_version(): return garbage, or the trx_id that would be used for committing an ALTER TABLE operation. In InnoDB, table names starting with #sql-ib will remain special: they will be dropped on startup. This may be revisited later in MDEV-18518 when we implement proper undo logging and rollback for creating or dropping multiple tables in a transaction. Table names starting with #sql will retain some special meaning: dict_table_t::parse_name() will not consider such names for MDL acquisition, and dict_table_rename_in_cache() will treat such names specially when handling FOREIGN KEY constraints. Simplify InnoDB DROP INDEX. Prevent purge wakeup To ensure that dict_table_t::def_trx_id will be recovered correctly in case the server is killed before ddl_log_complete(), we will block the purge of any history in SYS_TABLES, SYS_INDEXES, SYS_COLUMNS between ha_innobase::commit_inplace_alter_table(commit=true) (purge_sys.stop_SYS()) and purge_sys.resume_SYS(). The completion callback purge_sys.resume_SYS() must be between ddl_log_complete() and MDL release. -------- MyRocks support for atomic ALTER TABLE (Implemented by Sergui Petrunia) Implement these SE API functions: - ha_rocksdb::table_version() - hton->check_version = rocksdb_check_versionMyRocks data dictionary now stores table version for each table. (Absence of table version record is interpreted as table_version=0, that is, which means no upgrade changes are needed) - For inplace alter table of a partitioned table, call the underlying handlerton when checking if the table is ok. This assumes that the partition engine commits all changes at once.
-rw-r--r--mysql-test/include/have_rocksdb.inc4
-rw-r--r--mysql-test/include/have_rocksdb.opt1
-rw-r--r--mysql-test/suite/atomic/alter_table.opt1
-rw-r--r--mysql-test/suite/atomic/alter_table.result3134
-rw-r--r--mysql-test/suite/atomic/alter_table.test183
-rw-r--r--mysql-test/suite/atomic/alter_table_aria.result1740
-rw-r--r--mysql-test/suite/atomic/alter_table_aria.test7
-rw-r--r--mysql-test/suite/atomic/alter_table_big_query.result34
-rw-r--r--mysql-test/suite/atomic/alter_table_big_query.test109
-rw-r--r--mysql-test/suite/atomic/alter_table_rocksdb.result1763
-rw-r--r--mysql-test/suite/atomic/alter_table_rocksdb.test6
-rw-r--r--mysql-test/suite/atomic/alter_table_trigger.result131
-rw-r--r--mysql-test/suite/atomic/alter_table_trigger.test140
-rw-r--r--mysql-test/suite/encryption/t/innodb-encryption-alter.test4
-rw-r--r--mysql-test/suite/innodb/r/alter_copy.result5
-rw-r--r--mysql-test/suite/innodb/r/alter_crash.result1
-rw-r--r--mysql-test/suite/innodb/r/alter_foreign_crash.result9
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-tempfile.result6
-rw-r--r--mysql-test/suite/innodb/t/alter_copy.test9
-rw-r--r--mysql-test/suite/innodb/t/alter_crash.test28
-rw-r--r--mysql-test/suite/innodb/t/alter_foreign_crash.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-tempfile.test2
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_crash.test1
-rw-r--r--mysql-test/suite/innodb_fts/t/crash_recovery.test47
-rw-r--r--mysql-test/suite/s3/partition.result2
-rw-r--r--sql/ddl_log.cc1008
-rw-r--r--sql/ddl_log.h56
-rw-r--r--sql/ha_partition.cc2
-rw-r--r--sql/handler.cc28
-rw-r--r--sql/handler.h84
-rw-r--r--sql/item_func.cc10
-rw-r--r--sql/item_func.h1
-rw-r--r--sql/mysqld.cc7
-rw-r--r--sql/share/errmsg-utf8.txt2
-rw-r--r--sql/sql_alter.h1
-rw-r--r--sql/sql_partition.cc3
-rw-r--r--sql/sql_table.cc356
-rw-r--r--storage/innobase/dict/dict0crea.cc12
-rw-r--r--storage/innobase/dict/dict0dict.cc15
-rw-r--r--storage/innobase/dict/dict0load.cc45
-rw-r--r--storage/innobase/dict/dict0mem.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc61
-rw-r--r--storage/innobase/handler/ha_innodb.h4
-rw-r--r--storage/innobase/handler/handler0alter.cc30
-rw-r--r--storage/innobase/include/dict0mem.h28
-rw-r--r--storage/innobase/include/dict0types.h9
-rw-r--r--storage/innobase/include/trx0purge.h33
-rw-r--r--storage/innobase/include/trx0trx.h5
-rw-r--r--storage/innobase/log/log0recv.cc10
-rw-r--r--storage/innobase/row/row0mysql.cc21
-rw-r--r--storage/innobase/row/row0purge.cc19
-rw-r--r--storage/innobase/row/row0uins.cc3
-rw-r--r--storage/innobase/row/row0umod.cc34
-rw-r--r--storage/innobase/srv/srv0srv.cc41
-rw-r--r--storage/innobase/srv/srv0start.cc7
-rw-r--r--storage/innobase/trx/trx0purge.cc1
-rw-r--r--storage/innobase/trx/trx0trx.cc11
-rw-r--r--storage/rocksdb/ha_rocksdb.cc103
-rw-r--r--storage/rocksdb/ha_rocksdb.h3
-rw-r--r--storage/rocksdb/rdb_datadic.h2
60 files changed, 8968 insertions, 461 deletions
diff --git a/mysql-test/include/have_rocksdb.inc b/mysql-test/include/have_rocksdb.inc
new file mode 100644
index 00000000000..bc6ec648605
--- /dev/null
+++ b/mysql-test/include/have_rocksdb.inc
@@ -0,0 +1,4 @@
+if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'ROCKSDB' AND support IN ('YES', 'DEFAULT', 'ENABLED')`)
+{
+ --skip Test requires MyRocks engine
+}
diff --git a/mysql-test/include/have_rocksdb.opt b/mysql-test/include/have_rocksdb.opt
new file mode 100644
index 00000000000..df675545bf9
--- /dev/null
+++ b/mysql-test/include/have_rocksdb.opt
@@ -0,0 +1 @@
+--plugin-load=$HA_ROCKSDB_SO
diff --git a/mysql-test/suite/atomic/alter_table.opt b/mysql-test/suite/atomic/alter_table.opt
new file mode 100644
index 00000000000..61f3ce08d27
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_table.opt
@@ -0,0 +1 @@
+--innodb-max-dirty-pages-pct=0
diff --git a/mysql-test/suite/atomic/alter_table.result b/mysql-test/suite/atomic/alter_table.result
new file mode 100644
index 00000000000..58a77b9edaf
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_table.result
@@ -0,0 +1,3134 @@
+create database test2;
+
+engine: myisam
+
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+
+query: ALTER TABLE t1 COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new"
+crash point: ddl_log_alter_after_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 change column a c int COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new"
+crash point: ddl_log_alter_after_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_before_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_drop_original_table
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+
+query: ALTER TABLE t1 disable keys
+
+crash point: ddl_log_alter_after_create_frm
+"No crash!"
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+"No crash!"
+crash point: ddl_log_alter_after_log
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+
+query: ALTER TABLE t1 rename t2
+
+crash point: ddl_log_alter_after_create_frm
+"No crash!"
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+"No crash!"
+crash point: ddl_log_alter_after_log
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_rename_triggers
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_log
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_log
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+
+query: ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_after_drop_original_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_rename_to_backup
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_before_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_delete_backup
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_drop_original_table
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.MYD
+t2.MYI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup
+t2.MYD
+t2.MYI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.MYD
+t2.MYI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.MYD
+t2.MYI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_before_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_delete_backup
+t2.MYD
+t2.MYI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_drop_original_table
+t2.MYD
+t2.MYI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+
+query: ALTER TABLE t1 COMMENT "new", rename test2.t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 ADD key(b), COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+
+query: ALTER TABLE t1 DROP INDEX a
+
+crash point: ddl_log_alter_after_create_frm
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_after_drop_original_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+
+engine: innodb
+
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 change column a c int COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.frm
+t2.ibd
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t2.frm
+t2.ibd
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.frm
+t2.ibd
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 disable keys
+
+crash point: ddl_log_alter_after_create_frm
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_create_table
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_copy
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_log
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+Warnings:
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+
+query: ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+0
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+
+query: ALTER TABLE t1 rename t2
+
+crash point: ddl_log_alter_after_create_frm
+"No crash!"
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+"No crash!"
+crash point: ddl_log_alter_after_log
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_rename_triggers
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.frm
+t2.ibd
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t2.frm
+t2.ibd
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.frm
+t2.ibd
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.frm
+t2.ibd
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t2.frm
+t2.ibd
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.frm
+t2.ibd
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+
+query: ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_after_drop_original_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_rename_to_backup
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_before_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_delete_backup
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_drop_original_table
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t2.frm
+t2.ibd
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.frm
+t2.ibd
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 COMMENT "new", rename test2.t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t2.frm
+t2.ibd
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.frm
+t2.ibd
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 ADD key(b), COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 DROP INDEX a
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+t1.ibd
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
diff --git a/mysql-test/suite/atomic/alter_table.test b/mysql-test/suite/atomic/alter_table.test
new file mode 100644
index 00000000000..e6469c3c1b7
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_table.test
@@ -0,0 +1,183 @@
+--source include/have_debug.inc
+--source include/have_innodb.inc
+--source include/have_log_bin.inc
+--source include/not_valgrind.inc
+
+#
+# Testing of atomic create table with crashes in a lot of different places
+#
+# Things tested:
+# With myisam and InnoDB engines to ensure that cover both normal and
+# online alter table paths.
+# Alter table with new columns
+# Alter table which only touches .frm
+# Alter table disable keys (has it own code path)
+# Alter table with rename
+# Alter table with rename and only options that touches .frm
+# Alter table with rename and add new columns
+# Alter table with storage engine change (with and without column definition
+# changes)
+# Alter table with storage engine change and rename
+# Alter table to another database
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: .* does not exist in the InnoDB internal");
+--enable_query_log
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+create database test2;
+
+if ($engine_count == "")
+{
+ let $engine_count=2;
+ let $engines='myisam','innodb';
+}
+if ($extra_engine == "")
+{
+ let $extra_engine=aria;
+}
+
+let $crash_count=13;
+let $crash_points='ddl_log_alter_after_create_frm', 'ddl_log_alter_after_create_table', 'ddl_log_alter_after_prepare_inplace','ddl_log_alter_after_copy', 'ddl_log_alter_after_log', 'ddl_log_alter_after_rename_to_backup', 'ddl_log_alter_after_rename_to_backup_log', 'ddl_log_alter_rename_frm', 'ddl_log_alter_after_rename_to_original', 'ddl_log_alter_before_rename_triggers', 'ddl_log_alter_after_rename_triggers', 'ddl_log_alter_after_delete_backup', 'ddl_log_alter_after_drop_original_table';
+
+let $statement_count=16;
+let $statements='ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"',
+ 'ALTER TABLE t1 COMMENT "new"',
+ 'ALTER TABLE t1 change column a c int COMMENT "new"',
+ 'ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2',
+ 'ALTER TABLE t1 disable keys',
+ 'ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"',
+ 'ALTER TABLE t1 rename t2',
+ 'ALTER TABLE t1 COMMENT "new", rename t2',
+ 'ALTER TABLE t1 change column a c int COMMENT "new", rename t2',
+ 'ALTER TABLE t1 ENGINE=$extra_engine, COMMENT "new"',
+ 'ALTER TABLE t1 change column a c int COMMENT "new", engine=$extra_engine',
+ 'ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=$extra_engine',
+ 'ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2',
+ 'ALTER TABLE t1 COMMENT "new", rename test2.t2',
+ 'ALTER TABLE t1 ADD key(b), COMMENT "new"',
+ 'ALTER TABLE t1 DROP INDEX a';
+
+# If there is a need of testing one specific state (crash point and query),
+# one can use the comments below to execute one specific test combination
+#let $crash_count=1;
+#let $crash_points='ddl_log_alter_after_create_frm';
+#let $statement_count= 1;
+#let $statements='ALTER TABLE t1 ADD COLUMN c int, COMMENT "new"';
+#let $engine_count=1;
+#let $engines='rocksdb';
+#--source include/have_rocksdb.inc
+
+let $old_debug=`select @@debug_dbug`;
+let $e=0;
+let $keep_include_silent=1;
+let $grep_script=ALTER;
+--disable_query_log
+
+while ($e < $engine_count)
+{
+ inc $e;
+ let $engine=`select ELT($e, $engines)`;
+ let $default_engine=$engine;
+
+ --echo
+ --echo engine: $engine
+ --echo
+
+ let $r=0;
+ while ($r < $statement_count)
+ {
+ inc $r;
+ let $statement=`select ELT($r, $statements)`;
+ --echo
+ --echo query: $statement
+ --echo
+ let $c=0;
+ while ($c < $crash_count)
+ {
+ inc $c;
+ let $crash=`select ELT($c, $crash_points)`;
+
+ --eval create table t1 (a int, b int, key(a)) engine=$engine
+ insert into t1 values (1,1),(2,2);
+ commit;
+ flush tables;
+
+ RESET MASTER;
+ --echo crash point: $crash
+ if ($crash_count > 1)
+ {
+ --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+ }
+# The following can be used for testing one specific failure
+# if ($crash == "ddl_log_alter_after_log")
+# {
+# if ($r == 2)
+# {
+# --remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+# }
+# }
+ --disable_reconnect
+ --eval set @@debug_dbug="+d,$crash",@debug_crash_counter=1
+ let $errno=0;
+ --error 0,2013
+ --eval $statement;
+ let $error=$errno;
+ --enable_reconnect
+ --source include/wait_until_connected_again.inc
+ --disable_query_log
+ --eval set @@debug_dbug="$old_debug"
+
+ if ($error == 0)
+ {
+ echo "No crash!";
+ }
+ if ($error != 0)
+ {
+ --list_files $MYSQLD_DATADIR/test t*
+ --list_files $MYSQLD_DATADIR/test *sql*
+ --list_files $MYSQLD_DATADIR/test2 t*
+ --list_files $MYSQLD_DATADIR/test2 *sql*
+ # Check which tables still exists
+ --error 0,1
+ --file_exists $MYSQLD_DATADIR/test/t1.frm
+ let $error2=$errno;
+ if ($error2 == 0)
+ {
+ show create table t1;
+ select count(*) from t1;
+ }
+ if ($error2 == 1)
+ {
+ --error 0,1
+ --file_exists $MYSQLD_DATADIR/test/t2.frm
+ let $error3=$errno;
+ if ($error3 == 0)
+ {
+ show create table t2;
+ select count(*) from t2;
+ }
+ if ($error3 == 1)
+ {
+ --echo "Table is in test2"
+ show create table test2.t2;
+ select count(*) from test2.t2;
+ }
+ }
+ --let $binlog_file=master-bin.000001
+ --source include/show_binlog_events.inc
+ if ($error)
+ {
+ --let $binlog_file=master-bin.000002
+ --source include/show_binlog_events.inc
+ }
+ }
+ --disable_warnings
+ drop table if exists t1,t2;
+ drop table if exists test2.t2;
+ --enable_warnings
+ }
+ }
+}
+drop database test2;
+--enable_query_log
diff --git a/mysql-test/suite/atomic/alter_table_aria.result b/mysql-test/suite/atomic/alter_table_aria.result
new file mode 100644
index 00000000000..afa1ea0cb68
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_table_aria.result
@@ -0,0 +1,1740 @@
+create database test2;
+
+engine: aria
+
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+
+query: ALTER TABLE t1 COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new"
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 change column a c int COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new"
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_before_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_drop_original_table
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+
+query: ALTER TABLE t1 disable keys
+
+crash point: ddl_log_alter_after_create_frm
+"No crash!"
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+"No crash!"
+crash point: ddl_log_alter_after_log
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+
+query: ALTER TABLE t1 rename t2
+
+crash point: ddl_log_alter_after_create_frm
+"No crash!"
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+"No crash!"
+crash point: ddl_log_alter_after_log
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_rename_triggers
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_log
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_log
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 ENGINE=myisam, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=myisam, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=myisam, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=myisam, COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=myisam, COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=myisam, COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=myisam, COMMENT "new"
+
+query: ALTER TABLE t1 change column a c int COMMENT "new", engine=myisam
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=myisam
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=myisam
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=myisam
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=myisam
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=myisam
+crash point: ddl_log_alter_after_drop_original_table
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=myisam
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=myisam
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=myisam
+crash point: ddl_log_alter_after_rename_to_backup
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=myisam
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=myisam
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=myisam
+crash point: ddl_log_alter_before_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=myisam
+crash point: ddl_log_alter_after_rename_triggers
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=myisam
+crash point: ddl_log_alter_after_delete_backup
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=myisam
+crash point: ddl_log_alter_after_drop_original_table
+t2.MYD
+t2.MYI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=myisam
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.MAD
+t2.MAI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup
+t2.MAD
+t2.MAI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.MAD
+t2.MAI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.MAD
+t2.MAI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_before_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_delete_backup
+t2.MAD
+t2.MAI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_drop_original_table
+t2.MAD
+t2.MAI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+
+query: ALTER TABLE t1 COMMENT "new", rename test2.t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 ADD key(b), COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+
+query: ALTER TABLE t1 DROP INDEX a
+
+crash point: ddl_log_alter_after_create_frm
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_after_drop_original_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
diff --git a/mysql-test/suite/atomic/alter_table_aria.test b/mysql-test/suite/atomic/alter_table_aria.test
new file mode 100644
index 00000000000..6bf44b0463d
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_table_aria.test
@@ -0,0 +1,7 @@
+#
+# Test atomic alter table with aria
+
+let $engine_count=1;
+let $engines='aria';
+let $extra_engine=myisam;
+--source alter_table.test
diff --git a/mysql-test/suite/atomic/alter_table_big_query.result b/mysql-test/suite/atomic/alter_table_big_query.result
new file mode 100644
index 00000000000..81feecb55e6
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_table_big_query.result
@@ -0,0 +1,34 @@
+
+engine: myisam
+
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+
+crash point: ddl_log_alter_after_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
+sum(a)
+3
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/* long code comment: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy*/
+
+query: ALTER TABLE t1 COMMENT "new"
+
+crash point: ddl_log_alter_after_log
+t1.MYD
+t1.MYI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
+sum(a)
+3
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/* long code comment: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy*/
diff --git a/mysql-test/suite/atomic/alter_table_big_query.test b/mysql-test/suite/atomic/alter_table_big_query.test
new file mode 100644
index 00000000000..6248d4371a0
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_table_big_query.test
@@ -0,0 +1,109 @@
+--source include/have_debug.inc
+--source include/have_sequence.inc
+--source include/have_innodb.inc
+--source include/have_log_bin.inc
+--source include/not_valgrind.inc
+
+#
+# Testing of query > 4K. For this we do not have to run many tests as we
+# only want to test the query storage, which is identical for all cases.
+#
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: .* does not exist in the InnoDB internal");
+--enable_query_log
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+let $engine_count=1;
+let $engines='myisam';
+
+let $crash_count=1;
+let $crash_points='ddl_log_alter_after_log';
+
+let $statement_count=2;
+let $statements='ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"',
+ 'ALTER TABLE t1 COMMENT "new"';
+
+# If there is a need of testing one specific state (crash point and query),
+# one can remove the comments below and modify them.
+#let $crash_count=1;
+#let $crash_points='ddl_log_alter_before_rename_triggers';
+#let $statement_count= 1;
+#let $statements='ALTER TABLE t1 change column b c int, COMMENT "new"';
+
+let $old_debug=`select @@debug_dbug`;
+
+let $e=0;
+let $keep_include_silent=1;
+let $grep_script=ALTER;
+--disable_query_log
+
+while ($e < $engine_count)
+{
+ inc $e;
+ let $engine=`select ELT($e, $engines)`;
+ let $default_engine=$engine;
+
+ --echo
+ --echo engine: $engine
+ --echo
+
+ let $r=0;
+ while ($r < $statement_count)
+ {
+ inc $r;
+ let $statement=`select ELT($r, $statements)`;
+ --echo
+ --echo query: $statement
+ let $statement=`select concat(replace('$statement', "new", repeat("x",2000)), "/* long code comment: ", repeat("y",6000), "*/")`;
+ --echo
+ let $c=0;
+ while ($c < $crash_count)
+ {
+ inc $c;
+ let $crash=`select ELT($c, $crash_points)`;
+
+ --eval create table t1 (a int, b int) engine=$engine
+ insert into t1 (a) values (1),(2);
+ flush tables;
+
+ RESET MASTER;
+ --echo crash point: $crash
+ --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+ --disable_reconnect
+ --eval set @@debug_dbug="+d,$crash",@debug_crash_counter=1
+ let $errno=0;
+ --error 0,2013
+ --eval $statement;
+ let $error=$errno;
+ --enable_reconnect
+ --source include/wait_until_connected_again.inc
+ --disable_query_log
+ --eval set @@debug_dbug="$old_debug"
+
+ if ($error == 0)
+ {
+ echo "No crash!";
+ }
+ if ($error != 0)
+ {
+ --list_files $MYSQLD_DATADIR/test t*
+ --list_files $MYSQLD_DATADIR/test *sql*
+ show create table t1;
+ select sum(a) from t1;
+ --let $binlog_file=master-bin.000001
+ --source include/show_binlog_events.inc
+ if ($error)
+ {
+ --let $binlog_file=master-bin.000002
+ --source include/show_binlog_events.inc
+ }
+ }
+ --disable_warnings
+ drop table if exists t1,t2;
+ --enable_warnings
+ }
+ }
+}
+
+--enable_query_log
diff --git a/mysql-test/suite/atomic/alter_table_rocksdb.result b/mysql-test/suite/atomic/alter_table_rocksdb.result
new file mode 100644
index 00000000000..14ab4f29553
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_table_rocksdb.result
@@ -0,0 +1,1763 @@
+set global rocksdb_flush_log_at_trx_commit=1;
+create database test2;
+
+engine: rocksdb
+
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"
+
+query: ALTER TABLE t1 COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new"
+
+query: ALTER TABLE t1 change column a c int COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new"
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_before_rename_triggers
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_drop_original_table
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+
+query: ALTER TABLE t1 disable keys
+
+crash point: ddl_log_alter_after_create_frm
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_create_table
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_copy
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_log
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+Warnings:
+Note 1031 Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+"No crash!"
+
+query: ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"
+
+query: ALTER TABLE t1 rename t2
+
+crash point: ddl_log_alter_after_create_frm
+"No crash!"
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+"No crash!"
+crash point: ddl_log_alter_after_log
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_rename_triggers
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_before_rename_triggers
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_drop_original_table
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+
+query: ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_before_rename_triggers
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_delete_backup
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+crash point: ddl_log_alter_after_drop_original_table
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", rename t2
+
+query: ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ENGINE=aria, COMMENT "new"
+
+query: ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_after_rename_to_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+crash point: ddl_log_alter_after_drop_original_table
+t1.MAD
+t1.MAI
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c` int(11) DEFAULT NULL COMMENT 'new',
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`c`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column a c int COMMENT "new", engine=aria
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_rename_to_backup
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_before_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_rename_triggers
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_delete_backup
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+crash point: ddl_log_alter_after_drop_original_table
+t2.MAD
+t2.MAI
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=aria
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_before_rename_triggers
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_delete_backup
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_drop_original_table
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2
+
+query: ALTER TABLE t1 COMMENT "new", rename test2.t2
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_to_backup_log
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_before_rename_triggers
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_rename_triggers
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_delete_backup
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+crash point: ddl_log_alter_after_drop_original_table
+t2.frm
+"Table is in test2"
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename test2.t2
+
+query: ALTER TABLE t1 ADD key(b), COMMENT "new"
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_prepare_inplace
+"No crash!"
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_after_rename_to_backup_log
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+crash point: ddl_log_alter_after_drop_original_table
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`),
+ KEY `b` (`b`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD key(b), COMMENT "new"
+
+query: ALTER TABLE t1 DROP INDEX a
+
+crash point: ddl_log_alter_after_create_frm
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_create_table
+"No crash!"
+crash point: ddl_log_alter_after_prepare_inplace
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_copy
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+crash point: ddl_log_alter_after_log
+t1.frm
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
+count(*)
+2
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 DROP INDEX a
+crash point: ddl_log_alter_after_rename_to_backup
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_backup_log
+"No crash!"
+crash point: ddl_log_alter_rename_frm
+"No crash!"
+crash point: ddl_log_alter_after_rename_to_original
+"No crash!"
+crash point: ddl_log_alter_before_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_rename_triggers
+"No crash!"
+crash point: ddl_log_alter_after_delete_backup
+"No crash!"
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
diff --git a/mysql-test/suite/atomic/alter_table_rocksdb.test b/mysql-test/suite/atomic/alter_table_rocksdb.test
new file mode 100644
index 00000000000..fa34008dd58
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_table_rocksdb.test
@@ -0,0 +1,6 @@
+--source include/have_rocksdb.inc
+
+let $engine_count=1;
+let $engines='rocksdb';
+set global rocksdb_flush_log_at_trx_commit=1;
+--source alter_table.test
diff --git a/mysql-test/suite/atomic/alter_table_trigger.result b/mysql-test/suite/atomic/alter_table_trigger.result
new file mode 100644
index 00000000000..228229d30de
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_table_trigger.result
@@ -0,0 +1,131 @@
+
+engine: myisam
+
+
+query: ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+
+crash point: ddl_log_alter_before_rename_triggers
+t1_trg.TRN
+t2.MYD
+t2.MYI
+t2.TRG
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+sum(a)
+1003
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t1_trg.TRN
+t2.MYD
+t2.MYI
+t2.TRG
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+sum(a)
+1003
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_drop_original_table
+t1_trg.TRN
+t2.MYD
+t2.MYI
+t2.TRG
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+sum(a)
+1003
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2
+
+query: ALTER TABLE t1 COMMENT "new", rename t2
+
+crash point: ddl_log_alter_before_rename_triggers
+t1_trg.TRN
+t2.MYD
+t2.MYI
+t2.TRG
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+sum(a)
+1003
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t1_trg.TRN
+t2.MYD
+t2.MYI
+t2.TRG
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+sum(a)
+1003
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 COMMENT "new", rename t2
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
+
+query: ALTER TABLE t1 change column b c int, COMMENT "new", rename t2
+
+crash point: ddl_log_alter_before_rename_triggers
+t1_trg.TRN
+t2.MYD
+t2.MYI
+t2.TRG
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+sum(a)
+1003
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column b c int, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_rename_triggers
+t1_trg.TRN
+t2.MYD
+t2.MYI
+t2.TRG
+t2.frm
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='new'
+count(*)
+2
+sum(a)
+1003
+master-bin.000002 # Query # # use `test`; ALTER TABLE t1 change column b c int, COMMENT "new", rename t2
+crash point: ddl_log_alter_after_drop_original_table
+"No crash!"
diff --git a/mysql-test/suite/atomic/alter_table_trigger.test b/mysql-test/suite/atomic/alter_table_trigger.test
new file mode 100644
index 00000000000..276da893483
--- /dev/null
+++ b/mysql-test/suite/atomic/alter_table_trigger.test
@@ -0,0 +1,140 @@
+--source include/have_debug.inc
+--source include/have_sequence.inc
+--source include/have_innodb.inc
+--source include/have_log_bin.inc
+--source include/not_valgrind.inc
+
+#
+# Testing of atomic create table with crashes in a lot of different places
+#
+# This is very similar to the alter_table.test, but includes testing of
+# triggers in with ALTER TABLE .. RENAME.
+#
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: .* does not exist in the InnoDB internal");
+--enable_query_log
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+let $engine_count=1;
+let $engines='myisam','innodb';
+
+let $crash_count=3;
+let $crash_points='ddl_log_alter_before_rename_triggers', 'ddl_log_alter_after_rename_triggers', 'ddl_log_alter_after_drop_original_table';
+
+let $statement_count=3;
+let $statements='ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2',
+ 'ALTER TABLE t1 COMMENT "new", rename t2',
+ 'ALTER TABLE t1 change column b c int, COMMENT "new", rename t2';
+
+# If there is a need of testing one specific state (crash point and query),
+# one can remove the comments below and modify them.
+#let $crash_count=1;
+#let $crash_points='ddl_log_alter_before_rename_triggers';
+#let $statement_count= 1;
+#let $statements='ALTER TABLE t1 change column b c int, COMMENT "new", rename t2';
+
+let $old_debug=`select @@debug_dbug`;
+
+let $e=0;
+let $keep_include_silent=1;
+let $grep_script=ALTER;
+--disable_query_log
+
+while ($e < $engine_count)
+{
+ inc $e;
+ let $engine=`select ELT($e, $engines)`;
+ let $default_engine=$engine;
+
+ --echo
+ --echo engine: $engine
+ --echo
+
+ let $r=0;
+ while ($r < $statement_count)
+ {
+ inc $r;
+ let $statement=`select ELT($r, $statements)`;
+ --echo
+ --echo query: $statement
+ --echo
+ let $c=0;
+ while ($c < $crash_count)
+ {
+ inc $c;
+ let $crash=`select ELT($c, $crash_points)`;
+
+ --eval create table t1 (a int, b int) engine=$engine
+ insert into t1 (a) values (1),(2);
+ flush tables;
+ delimiter |;
+ create trigger t1_trg before insert on t1 for each row
+ begin
+ if isnull(new.a) then
+ set new.a:= 1000;
+ end if;
+ end|
+ delimiter ;|
+
+ RESET MASTER;
+ --echo crash point: $crash
+ if ($crash_count != 1)
+ {
+ --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+ }
+ --disable_reconnect
+ --eval set @@debug_dbug="+d,$crash",@debug_crash_counter=1
+ let $errno=0;
+ --error 0,2013
+ --eval $statement;
+ let $error=$errno;
+ --enable_reconnect
+ --source include/wait_until_connected_again.inc
+ --disable_query_log
+ --eval set @@debug_dbug="$old_debug"
+
+ if ($error == 0)
+ {
+ echo "No crash!";
+ }
+ if ($error != 0)
+ {
+ --list_files $MYSQLD_DATADIR/test t*
+ --list_files $MYSQLD_DATADIR/test *sql*
+ # Check which tables still exists
+ --error 0,1
+ --file_exists $MYSQLD_DATADIR/test/t1.frm
+ let $error2=$errno;
+ if ($error2 == 0)
+ {
+ show create table t1;
+ # Ensure that triggers work
+ insert into t1 (a) values(null);
+ select sum(a) from t1;
+ }
+ if ($error2 == 1)
+ {
+ show create table t2;
+ select count(*) from t2;
+ # Ensure that triggers work
+ insert into t2 (a) values(null);
+ select sum(a) from t2;
+ }
+
+ --let $binlog_file=master-bin.000001
+ --source include/show_binlog_events.inc
+ if ($error)
+ {
+ --let $binlog_file=master-bin.000002
+ --source include/show_binlog_events.inc
+ }
+ }
+ --disable_warnings
+ drop table if exists t1,t2;
+ --enable_warnings
+ }
+ }
+}
+
+--enable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-alter.test b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
index f0177b2ca4e..6e5d449b10a 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-alter.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
@@ -131,7 +131,3 @@ disconnect con1;
select * from t1;
drop table t1,t2;
-
-# Work around missing crash recovery at the SQL layer.
-let $datadir= `select @@datadir`;
---remove_files_wildcard $datadir/test #sql-*.frm
diff --git a/mysql-test/suite/innodb/r/alter_copy.result b/mysql-test/suite/innodb/r/alter_copy.result
index 9b8f04eacca..5fdcf2005df 100644
--- a/mysql-test/suite/innodb/r/alter_copy.result
+++ b/mysql-test/suite/innodb/r/alter_copy.result
@@ -53,8 +53,6 @@ connection default;
SET DEBUG_SYNC='now WAIT_FOR hung';
# restart: --innodb-force-recovery=3
disconnect hang;
-#sql-alter.frm
-#sql-alter.ibd
FTS_INDEX_1.ibd
FTS_INDEX_2.ibd
FTS_INDEX_3.ibd
@@ -122,8 +120,6 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
# restart: --innodb-read-only
-#sql-alter.frm
-#sql-alter.ibd
FTS_INDEX_1.ibd
FTS_INDEX_2.ibd
FTS_INDEX_3.ibd
@@ -191,7 +187,6 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
# restart
-#sql-alter.frm
FTS_INDEX_1.ibd
FTS_INDEX_2.ibd
FTS_INDEX_3.ibd
diff --git a/mysql-test/suite/innodb/r/alter_crash.result b/mysql-test/suite/innodb/r/alter_crash.result
index 8cfeb7093ca..7572c911581 100644
--- a/mysql-test/suite/innodb/r/alter_crash.result
+++ b/mysql-test/suite/innodb/r/alter_crash.result
@@ -131,7 +131,6 @@ ERROR HY000: Lost connection to server during query
SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = ID;
TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
-# Files in datadir after manual recovery.
db.opt
t1.frm
t1.ibd
diff --git a/mysql-test/suite/innodb/r/alter_foreign_crash.result b/mysql-test/suite/innodb/r/alter_foreign_crash.result
index 9a7a23a5b72..42bba3f289d 100644
--- a/mysql-test/suite/innodb/r/alter_foreign_crash.result
+++ b/mysql-test/suite/innodb/r/alter_foreign_crash.result
@@ -19,9 +19,14 @@ SET DEBUG_SYNC='now SIGNAL s2 WAIT_FOR s1';
disconnect con1;
show tables;
Tables_in_bug
+child
parent
alter table parent row_format=dynamic;
-Warnings:
-Warning 1088 failed to load FOREIGN KEY constraints
+select * from child;
+a
+1
+drop table parent;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+drop table child;
drop table parent;
drop database bug;
diff --git a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result
index a65be1fc9d6..bc40e5f4b71 100644
--- a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result
+++ b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result
@@ -46,12 +46,6 @@ disconnect con1;
SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
t1 1 f1 1 f1 A 2 NULL NULL BTREE NO
-t1 1 f2 1 f2 A NULL NULL NULL Corrupted NO
-Warnings:
-Warning 1082 InnoDB: Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
-Warning 1082 InnoDB: Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
-Warning 1082 InnoDB: Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
-Warning 1082 InnoDB: Table test/t1 contains 1 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
DROP TABLE t1;
#
# MDEV-25503 InnoDB hangs on startup during recovery
diff --git a/mysql-test/suite/innodb/t/alter_copy.test b/mysql-test/suite/innodb/t/alter_copy.test
index de2f99b68d4..6b6a0151de4 100644
--- a/mysql-test/suite/innodb/t/alter_copy.test
+++ b/mysql-test/suite/innodb/t/alter_copy.test
@@ -63,7 +63,7 @@ let $shutdown_timeout=0;
disconnect hang;
let $shutdown_timeout=;
let $datadir=`select @@datadir`;
---replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ /FTS_[0-9a-f]*_[0-9a-f]*/FTS/
+--replace_regex /FTS_[0-9a-f]*_[0-9a-f]*/FTS/
--list_files $datadir/test
SHOW CREATE TABLE t;
SELECT COUNT(*) FROM t;
@@ -76,7 +76,7 @@ CHECK TABLE t1;
--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc
---replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ /FTS_[0-9a-f]*_[0-9a-f]*/FTS/
+--replace_regex /FTS_[0-9a-f]*_[0-9a-f]*/FTS/
--list_files $datadir/test
SHOW CREATE TABLE t;
@@ -90,9 +90,6 @@ CHECK TABLE t1;
--let $restart_parameters=
--source include/restart_mysqld.inc
---replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ /FTS_[0-9a-f]*_[0-9a-f]*/FTS/
+--replace_regex /FTS_[0-9a-f]*_[0-9a-f]*/FTS/
--list_files $datadir/test
DROP TABLE t1,t;
-
-# Work around missing crash recovery at the SQL layer.
---remove_files_wildcard $datadir/test #sql-*.frm
diff --git a/mysql-test/suite/innodb/t/alter_crash.test b/mysql-test/suite/innodb/t/alter_crash.test
index 72116b0ca9d..ea2716b9111 100644
--- a/mysql-test/suite/innodb/t/alter_crash.test
+++ b/mysql-test/suite/innodb/t/alter_crash.test
@@ -74,19 +74,6 @@ let $orig_table_id = `SELECT table_id
--error 2013
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
-let TABLENAME_INC= $MYSQLTEST_VARDIR/tmp/tablename.inc;
-perl;
-die unless open OUT, ">$ENV{TABLENAME_INC}";
-chdir "$ENV{'datadir'}/test";
-my @frm_file = map { substr($_, 0, -4) } glob "#sql-*.frm";
-print OUT 'let $tablename=', $frm_file[0], ';';
-close OUT or die;
-EOF
-source $TABLENAME_INC;
-remove_file $TABLENAME_INC;
-
-move_file $datadir/test/$tablename.frm $datadir/test/t1.frm;
-
--echo # Restart mysqld after the crash and reconnect.
--source include/start_mysqld.inc
@@ -127,8 +114,6 @@ let $orig_table_id = `SELECT table_id
--error 2013
ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);
-remove_files_wildcard $datadir/test #sql-*.frm;
-
--echo # Startup the server after the crash
--source include/start_mysqld.inc
@@ -169,18 +154,6 @@ let $orig_table_id = `select table_id from
--error 2013
ALTER TABLE t1 ADD INDEX (b), CHANGE c d int, ALGORITHM=INPLACE;
-perl;
-die unless open OUT, ">$ENV{TABLENAME_INC}";
-chdir "$ENV{'datadir'}/test";
-my @frm_file = map { substr($_, 0, -4) } glob "#sql-*.frm";
-print OUT 'let $tablename=', $frm_file[0], ';';
-close OUT or die;
-EOF
-source $TABLENAME_INC;
-remove_file $TABLENAME_INC;
-
-move_file $datadir/test/$tablename.frm $datadir/test/t1.frm;
-
--echo # Restart mysqld after the crash and reconnect.
--source include/start_mysqld.inc
@@ -188,7 +161,6 @@ move_file $datadir/test/$tablename.frm $datadir/test/t1.frm;
eval SELECT * FROM information_schema.innodb_sys_tables
WHERE table_id = $orig_table_id;
---echo # Files in datadir after manual recovery.
--list_files $MYSQLD_DATADIR/test
SHOW TABLES;
diff --git a/mysql-test/suite/innodb/t/alter_foreign_crash.test b/mysql-test/suite/innodb/t/alter_foreign_crash.test
index 1952a1b30d4..e2a6c301bf7 100644
--- a/mysql-test/suite/innodb/t/alter_foreign_crash.test
+++ b/mysql-test/suite/innodb/t/alter_foreign_crash.test
@@ -32,6 +32,9 @@ disconnect con1;
show tables;
alter table parent row_format=dynamic;
-
+select * from child;
+--error ER_ROW_IS_REFERENCED_2
+drop table parent;
+drop table child;
drop table parent;
drop database bug;
diff --git a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
index 8db1fdfec45..979005f6410 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
@@ -40,8 +40,6 @@ SET debug_dbug='+d,innodb_alter_commit_crash_before_commit';
--error 2013
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
-remove_files_wildcard $datadir/test #sql-*.frm;
-
--source include/start_mysqld.inc
show create table t1;
diff --git a/mysql-test/suite/innodb/t/instant_alter_crash.test b/mysql-test/suite/innodb/t/instant_alter_crash.test
index 43db8f619f3..2a596342530 100644
--- a/mysql-test/suite/innodb/t/instant_alter_crash.test
+++ b/mysql-test/suite/innodb/t/instant_alter_crash.test
@@ -203,5 +203,4 @@ SHOW CREATE TABLE t2;
SHOW CREATE TABLE t3;
DROP TABLE t1,t2,t3;
---remove_files_wildcard $MYSQLD_DATADIR/test #sql*.frm
--list_files $MYSQLD_DATADIR/test
diff --git a/mysql-test/suite/innodb_fts/t/crash_recovery.test b/mysql-test/suite/innodb_fts/t/crash_recovery.test
index f0fbab1092f..fe58ca0addf 100644
--- a/mysql-test/suite/innodb_fts/t/crash_recovery.test
+++ b/mysql-test/suite/innodb_fts/t/crash_recovery.test
@@ -100,44 +100,8 @@ disconnect ddl1;
disconnect ddl2;
disconnect ddl3;
-if (!$have_debug)
-{
-# Work around the lack of MDEV-25180: We may have index name mismatches
-# because there is a race condition in the non-debug test.
---disable_result_log
-}
CHECK TABLE t1,t2,t3;
-if (!$have_debug)
-{
---enable_result_log
---echo Table Op Msg_type Msg_text
---echo test.t1 check status OK
---echo test.t2 check status OK
---echo test.t3 check status OK
---disable_query_log
---echo DROP TABLE t1,t2,t3;
-DROP TABLE t1,t2;
---disable_warnings
-DROP TABLE IF EXISTS t3;
---enable_warnings
-# The server may be killed at any time of executing ALTER TABLE on t1,t2,t3.
-# Remove possible #sql- tables left behind by ALTER TABLE t2 or ALTER TABLE t3.
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE c TEXT DEFAULT
- (SELECT GROUP_CONCAT(CONCAT('DROP TABLE `#mysql50#',SUBSTR(name,6),'`;'))
- FROM information_schema.innodb_sys_tables
- WHERE name LIKE 'test/#sql-alter-%' OR name LIKE 'test/#sql-backup-%');
- IF c IS NOT NULL THEN EXECUTE IMMEDIATE c; END IF;
-END;
-$$
-DELIMITER ;$$
---enable_query_log
-}
-if ($have_debug)
-{
DROP TABLE t1,t2,t3;
-}
# This insert will re-initialize the Doc ID counter, it should not crash
INSERT INTO articles (title,body) VALUES
@@ -281,19 +245,9 @@ SELECT * FROM mdev19073_2 WHERE MATCH (title, body)
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
DROP TABLE mdev19073, mdev19073_2;
-# Work around the lack of MDEV-25180 (Atomic ALTER TABLE)
-let $datadir=`select @@datadir`;
if (!$have_debug)
{
--disable_query_log
-call mtr.add_suppression("Cannot find index [ab] in InnoDB index dictionary\\.");
-call mtr.add_suppression("InnoDB indexes are inconsistent with what defined in \\.frm for table \\./test/t[123]");
-call mtr.add_suppression("InnoDB could not find key no [01] with name [ab] from dict cache for table test/t[123]");
-call mtr.add_suppression("InnoDB: Table test/t[123] contains .* indexes inside InnoDB");
-call mtr.add_suppression("InnoDB: Table `test`\\.`t3` does not exist");
-# MDEV-24626 FIXME: a 0-sized file will not be deleted!
---list_files $datadir/test #sql-alter-*.ibd
-
# Some errors are reported despite the MDEV-24626 fix.
call mtr.add_suppression("InnoDB: Cannot (read first page of|open datafile for read-only:) '\\./test/(FTS_|#sql-(alter|backup)-).*\\.ibd'");
call mtr.add_suppression("InnoDB: Datafile '\\./test/(FTS_|#sql-(alter|backup)-).*\\.ibd' is corrupted");
@@ -302,7 +256,6 @@ call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`\\.`(FTS_|#sql-(
call mtr.add_suppression("InnoDB: Expected tablespace id [1-9][0-9]* but found 0 in the file .*/test/(FTS_|#sql-(alter|backup)-).*\\.ibd");
--enable_query_log
}
---remove_files_wildcard $datadir/test #sql-*.frm
SELECT * FROM information_schema.innodb_sys_tables
WHERE name LIKE 'test/%' AND name NOT LIKE 'test/#sql-ib%';
diff --git a/mysql-test/suite/s3/partition.result b/mysql-test/suite/s3/partition.result
index ee837611d50..3cfa33e99eb 100644
--- a/mysql-test/suite/s3/partition.result
+++ b/mysql-test/suite/s3/partition.result
@@ -18,8 +18,6 @@ ERROR 42000: Table 't1' uses an extension that doesn't exist in this MariaDB ver
SHOW WARNINGS;
Level Code Message
Error 1112 Table 't1' uses an extension that doesn't exist in this MariaDB version
-Error 6 Error on delete of './s3/t1#P#p0#TMP#.MAI' (Errcode: 2 "No such file or directory")
-Error 6 Error on delete of './s3/t1#P#p0#TMP#.MAD' (Errcode: 2 "No such file or directory")
ALTER TABLE t1 ADD PARTITION PARTITIONS 6;
SELECT count(*) FROM t1;
count(*)
diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc
index 5f9a025c042..93ebc92b421 100644
--- a/sql/ddl_log.cc
+++ b/sql/ddl_log.cc
@@ -90,7 +90,7 @@ const char *ddl_log_action_name[DDL_LOG_LAST_ACTION]=
"rename table", "rename view",
"initialize drop table", "drop table",
"drop view", "drop trigger", "drop db", "create table", "create view",
- "delete tmp file", "create trigger",
+ "delete tmp file", "create trigger", "alter table", "store query"
};
/* Number of phases per entry */
@@ -101,6 +101,7 @@ const uchar ddl_log_entry_phases[DDL_LOG_LAST_ACTION]=
(uchar) DDL_DROP_PHASE_END, 1, 1,
(uchar) DDL_DROP_DB_PHASE_END, (uchar) DDL_CREATE_TABLE_PHASE_END,
(uchar) DDL_CREATE_VIEW_PHASE_END, 0, (uchar) DDL_CREATE_TRIGGER_PHASE_END,
+ DDL_ALTER_TABLE_PHASE_END, 1
};
@@ -117,13 +118,21 @@ struct st_global_ddl_log
bool open;
};
-/* The following structure is only used during startup recovery */
+/*
+ The following structure is only used during startup recovery
+ for writing queries to the binary log.
+ */
+
class st_ddl_recovery {
public:
String drop_table;
String drop_view;
+ String query;
+ String db;
size_t drop_table_init_length, drop_view_init_length;
char current_db[NAME_LEN];
+ uint execute_entry_pos;
+ ulonglong xid;
};
static st_global_ddl_log global_ddl_log;
@@ -295,6 +304,7 @@ static bool write_ddl_log_file_entry(uint entry_pos)
static bool update_phase(uint entry_pos, uchar phase)
{
DBUG_ENTER("update_phase");
+ DBUG_PRINT("enter", ("phase: %d", (int) phase));
DBUG_RETURN(mysql_file_pwrite(global_ddl_log.file_id, &phase, 1,
global_ddl_log.io_size * entry_pos +
@@ -304,6 +314,25 @@ static bool update_phase(uint entry_pos, uchar phase)
}
+/*
+ Update flags in ddl log entry
+
+ This is not synced as it usually followed by a phase change, which will sync.
+*/
+
+static bool update_flags(uint entry_pos, uint16 flags)
+{
+ uchar buff[2];
+ DBUG_ENTER("update_flags");
+
+ int2store(buff, flags);
+ DBUG_RETURN(mysql_file_pwrite(global_ddl_log.file_id, buff, sizeof(buff),
+ global_ddl_log.io_size * entry_pos +
+ DDL_LOG_FLAG_POS,
+ MYF(MY_WME | MY_NABP)));
+}
+
+
static bool update_next_entry_pos(uint entry_pos, uint next_entry)
{
uchar buff[4];
@@ -323,7 +352,7 @@ static bool update_xid(uint entry_pos, ulonglong xid)
DBUG_ENTER("update_xid");
int8store(buff, xid);
- DBUG_RETURN(mysql_file_pwrite(global_ddl_log.file_id, buff, 8,
+ DBUG_RETURN(mysql_file_pwrite(global_ddl_log.file_id, buff, sizeof(buff),
global_ddl_log.io_size * entry_pos +
DDL_LOG_XID_POS,
MYF(MY_WME | MY_NABP)) ||
@@ -559,6 +588,7 @@ static void set_global_from_ddl_log_entry(const DDL_LOG_ENTRY *ddl_log_entry)
pos= store_string(pos, end, &ddl_log_entry->from_db);
pos= store_string(pos, end, &ddl_log_entry->from_name);
pos= store_string(pos, end, &ddl_log_entry->tmp_name);
+ pos= store_string(pos, end, &ddl_log_entry->extra_name);
bzero(pos, global_ddl_log.io_size - (pos - file_entry_buf));
}
@@ -580,6 +610,7 @@ static size_t ddl_log_free_space_in_entry(const DDL_LOG_ENTRY *ddl_log_entry)
length+= ddl_log_entry->from_db.length;
length+= ddl_log_entry->from_name.length;
length+= ddl_log_entry->tmp_name.length;
+ length+= ddl_log_entry->extra_name.length;
return global_ddl_log.io_size - length - 3; // 3 is for storing next string
}
@@ -621,6 +652,7 @@ static void set_ddl_log_entry_from_global(DDL_LOG_ENTRY *ddl_log_entry,
ddl_log_entry->from_db= get_string(&pos, end);
ddl_log_entry->from_name= get_string(&pos, end);
ddl_log_entry->tmp_name= get_string(&pos, end);
+ ddl_log_entry->extra_name= get_string(&pos, end);
}
@@ -818,6 +850,19 @@ static bool ddl_log_increment_phase_no_lock(uint entry_pos)
/*
+ Increment phase and sync ddl log. This expects LOCK_gdl to be locked
+*/
+
+static bool increment_phase(uint entry_pos)
+{
+ if (ddl_log_increment_phase_no_lock(entry_pos))
+ return 1;
+ ddl_log_sync_no_lock();
+ return 0;
+}
+
+
+/*
Ignore errors from the file system about:
- Non existing tables or file (from drop table or delete file)
- Error about tables files that already exists.
@@ -935,7 +980,7 @@ static void ddl_log_to_binary_log(THD *thd, String *query)
static bool ddl_log_drop_to_binary_log(THD *thd, DDL_LOG_ENTRY *ddl_log_entry,
String *query)
{
- DBUG_ENTER("ddl_log_binary_log");
+ DBUG_ENTER("ddl_log_drop_to_binary_log");
if (mysql_bin_log.is_open())
{
if (!ddl_log_entry->next_entry ||
@@ -960,6 +1005,235 @@ static bool ddl_log_drop_to_binary_log(THD *thd, DDL_LOG_ENTRY *ddl_log_entry,
DBUG_RETURN(0);
}
+/*
+ Create a new handler based on handlerton name
+*/
+
+static handler *create_handler(THD *thd, MEM_ROOT *mem_root,
+ LEX_CSTRING *name)
+{
+ handlerton *hton;
+ handler *file;
+ plugin_ref plugin= my_plugin_lock_by_name(thd, name,
+ MYSQL_STORAGE_ENGINE_PLUGIN);
+ if (!plugin)
+ {
+ my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(ME_ERROR_LOG), name->str);
+ return 0;
+ }
+ hton= plugin_hton(plugin);
+ if (!ha_storage_engine_is_enabled(hton))
+ {
+ my_error(ER_STORAGE_ENGINE_DISABLED, MYF(ME_ERROR_LOG), name->str);
+ return 0;
+ }
+ if ((file= hton->create(hton, (TABLE_SHARE*) 0, mem_root)))
+ file->init();
+ return file;
+}
+
+
+/*
+ Rename a table and its .frm file for a ddl_log_entry
+
+ We first rename the table and then the .frm file as some engines,
+ like connect, needs the .frm file to exists to be able to do an rename.
+*/
+
+static void execute_rename_table(DDL_LOG_ENTRY *ddl_log_entry, handler *file,
+ const LEX_CSTRING *from_db,
+ const LEX_CSTRING *from_table,
+ const LEX_CSTRING *to_db,
+ const LEX_CSTRING *to_table,
+ uint flags,
+ char *from_path, char *to_path)
+{
+ uint to_length=0, fr_length=0;
+ DBUG_ENTER("execute_rename_table");
+
+ if (file->needs_lower_case_filenames())
+ {
+ build_lower_case_table_filename(from_path, FN_REFLEN,
+ from_db, from_table,
+ flags & FN_FROM_IS_TMP);
+ build_lower_case_table_filename(to_path, FN_REFLEN,
+ to_db, to_table, flags & FN_TO_IS_TMP);
+ }
+ else
+ {
+ fr_length= build_table_filename(from_path, FN_REFLEN,
+ from_db->str, from_table->str, "",
+ flags & FN_TO_IS_TMP);
+ to_length= build_table_filename(to_path, FN_REFLEN,
+ to_db->str, to_table->str, "",
+ flags & FN_TO_IS_TMP);
+ }
+ file->ha_rename_table(from_path, to_path);
+ if (file->needs_lower_case_filenames())
+ {
+ /*
+ We have to rebuild the file names as the .frm file should be used
+ without lower case conversion
+ */
+ fr_length= build_table_filename(from_path, FN_REFLEN,
+ from_db->str, from_table->str, reg_ext,
+ flags & FN_FROM_IS_TMP);
+ to_length= build_table_filename(to_path, FN_REFLEN,
+ to_db->str, to_table->str, reg_ext,
+ flags & FN_TO_IS_TMP);
+ }
+ else
+ {
+ strmov(from_path+fr_length, reg_ext);
+ strmov(to_path+to_length, reg_ext);
+ }
+ if (!access(from_path, F_OK))
+ (void) mysql_file_rename(key_file_frm, from_path, to_path, MYF(MY_WME));
+ DBUG_VOID_RETURN;
+}
+
+
+/*
+ Update triggers
+
+ If swap_tables == 0 (Restoring the original in case of failed rename)
+ Convert triggers for db.name -> from_db.from_name
+ else (Doing the rename in case of ALTER TABLE ... RENAME)
+ Convert triggers for from_db.from_name -> db.extra_name
+*/
+
+static void rename_triggers(THD *thd, DDL_LOG_ENTRY *ddl_log_entry,
+ bool swap_tables)
+{
+ LEX_CSTRING to_table, from_table, to_db, from_db, from_converted_name;
+ char to_path[FN_REFLEN+1], from_path[FN_REFLEN+1], conv_path[FN_REFLEN+1];
+
+ if (!swap_tables)
+ {
+ from_db= ddl_log_entry->db;
+ from_table= ddl_log_entry->name;
+ to_db= ddl_log_entry->from_db;
+ to_table= ddl_log_entry->from_name;
+ }
+ else
+ {
+ from_db= ddl_log_entry->from_db;
+ from_table= ddl_log_entry->from_name;
+ to_db= ddl_log_entry->db;
+ to_table= ddl_log_entry->extra_name;
+ }
+
+ build_filename_and_delete_tmp_file(from_path, sizeof(from_path),
+ &from_db, &from_table,
+ TRG_EXT, key_file_trg);
+ build_filename_and_delete_tmp_file(to_path, sizeof(to_path),
+ &to_db, &to_table,
+ TRG_EXT, key_file_trg);
+ if (lower_case_table_names)
+ {
+ uint errors;
+ from_converted_name.str= conv_path;
+ from_converted_name.length=
+ strconvert(system_charset_info, from_table.str, from_table.length,
+ files_charset_info, conv_path, FN_REFLEN, &errors);
+ }
+ else
+ from_converted_name= from_table;
+
+ if (!access(to_path, F_OK))
+ {
+ /*
+ The original file was never renamed or we crashed in recovery
+ just after renaming back the file.
+ In this case the current file is correct and we can remove any
+ left over copied files
+ */
+ (void) mysql_file_delete(key_file_trg, from_path, MYF(0));
+ }
+ else if (!access(from_path, F_OK))
+ {
+ /* .TRG file was renamed. Rename it back */
+ /*
+ We have to create a MDL lock as change_table_names() checks that we
+ have a mdl locks for the table
+ */
+ MDL_request mdl_request;
+ TRIGGER_RENAME_PARAM trigger_param;
+ int error __attribute__((unused));
+ MDL_REQUEST_INIT(&mdl_request, MDL_key::TABLE,
+ from_db.str,
+ from_converted_name.str,
+ MDL_EXCLUSIVE, MDL_EXPLICIT);
+ error= thd->mdl_context.acquire_lock(&mdl_request, 1);
+ /* acquire_locks() should never fail during recovery */
+ DBUG_ASSERT(error == 0);
+
+ (void) Table_triggers_list::prepare_for_rename(thd,
+ &trigger_param,
+ &from_db,
+ &from_table,
+ &from_converted_name,
+ &to_db,
+ &to_table);
+ (void) Table_triggers_list::change_table_name(thd,
+ &trigger_param,
+ &from_db,
+ &from_table,
+ &from_converted_name,
+ &to_db,
+ &to_table);
+ thd->mdl_context.release_lock(mdl_request.ticket);
+ }
+}
+
+
+/*
+ Update stat tables
+
+ If swap_tables == 0
+ Convert stats for from_db.from_table -> db.name
+ else
+ Convert stats for db.name -> from_db.from_table
+*/
+
+static void rename_in_stat_tables(THD *thd, DDL_LOG_ENTRY *ddl_log_entry,
+ bool swap_tables)
+{
+ LEX_CSTRING from_table, to_table, from_db, to_db, from_converted_name;
+ char conv_path[FN_REFLEN+1];
+
+ if (!swap_tables)
+ {
+ from_db= ddl_log_entry->db;
+ from_table= ddl_log_entry->name;
+ to_db= ddl_log_entry->from_db;
+ to_table= ddl_log_entry->from_name;
+ }
+ else
+ {
+ from_db= ddl_log_entry->from_db;
+ from_table= ddl_log_entry->from_name;
+ to_db= ddl_log_entry->db;
+ to_table= ddl_log_entry->extra_name;
+ }
+ if (lower_case_table_names)
+ {
+ uint errors;
+ from_converted_name.str= conv_path;
+ from_converted_name.length=
+ strconvert(system_charset_info, from_table.str, from_table.length,
+ files_charset_info, conv_path, FN_REFLEN, &errors);
+ }
+ else
+ from_converted_name= from_table;
+
+ (void) rename_table_in_stat_tables(thd,
+ &from_db,
+ &from_converted_name,
+ &to_db,
+ &to_table);
+}
+
/**
Execute one action in a ddl log entry
@@ -1009,17 +1283,9 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
frm_action= TRUE;
else if (ddl_log_entry->handler_name.length)
{
- plugin_ref plugin= my_plugin_lock_by_name(thd, &handler_name,
- MYSQL_STORAGE_ENGINE_PLUGIN);
- if (!plugin)
- {
- my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), ddl_log_entry->handler_name);
- goto end;
- }
- hton= plugin_hton(plugin);
- file= get_new_handler((TABLE_SHARE*)0, mem_root, hton);
- if (unlikely(!file))
+ if (!(file= create_handler(thd, mem_root, &handler_name)))
goto end;
+ hton= file->ht;
}
switch (ddl_log_entry->action_type) {
@@ -1049,9 +1315,8 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
break;
}
}
- if (ddl_log_increment_phase_no_lock(entry_pos))
+ if (increment_phase(entry_pos))
break;
- (void) ddl_log_sync_no_lock();
error= 0;
if (ddl_log_entry->action_type == DDL_LOG_DELETE_ACTION)
break;
@@ -1082,9 +1347,8 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
else
(void) file->ha_rename_table(ddl_log_entry->from_name.str,
ddl_log_entry->name.str);
- if (ddl_log_increment_phase_no_lock(entry_pos))
+ if (increment_phase(entry_pos))
break;
- (void) ddl_log_sync_no_lock();
break;
}
case DDL_LOG_EXCHANGE_ACTION:
@@ -1135,130 +1399,35 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
/*
We should restore things by renaming from
'entry->name' to 'entry->from_name'
-
- In the following code 'to_' stands for what the table was renamed to
- that we have to rename back.
*/
- size_t fr_length, to_length;
- LEX_CSTRING from_table, to_table, to_converted_name;
- from_table= ddl_log_entry->from_name;
- to_table= ddl_log_entry->name;
-
- /* Some functions wants to have the lower case table name as an argument */
- if (lower_case_table_names)
- {
- uint errors;
- to_converted_name.str= to_path;
- to_converted_name.length=
- strconvert(system_charset_info, to_table.str, to_table.length,
- files_charset_info, from_path, FN_REFLEN, &errors);
- }
- else
- to_converted_name= to_table;
-
switch (ddl_log_entry->phase) {
case DDL_RENAME_PHASE_TRIGGER:
- {
- MDL_request mdl_request;
- TRIGGER_RENAME_PARAM trigger_param;
-
- build_filename_and_delete_tmp_file(to_path, sizeof(to_path),
- &ddl_log_entry->db,
- &ddl_log_entry->name,
- TRG_EXT,
- key_file_trg);
- build_filename_and_delete_tmp_file(from_path, sizeof(from_path),
- &ddl_log_entry->from_db,
- &ddl_log_entry->from_name,
- TRG_EXT, key_file_trg);
-
- if (!access(from_path, F_OK))
- {
- /*
- The original file was never renamed or we crashed in recovery
- just after renaming back the file.
- In this case the current file is correct and we can remove any
- left over copied files
- */
- (void) mysql_file_delete(key_file_trg, to_path, MYF(0));
- }
- else if (!access(to_path, F_OK))
- {
- /* .TRG file was renamed. Rename it back */
- /*
- We have to create a MDL lock as change_table_names() checks that we
- have a mdl locks for the table
- */
- MDL_REQUEST_INIT(&mdl_request, MDL_key::TABLE,
- ddl_log_entry->db.str,
- to_converted_name.str,
- MDL_EXCLUSIVE, MDL_EXPLICIT);
- error= thd->mdl_context.acquire_lock(&mdl_request, 1);
- /* acquire_locks() should never fail during recovery */
- DBUG_ASSERT(error == 0);
- (void) Table_triggers_list::prepare_for_rename(thd,
- &trigger_param,
- &ddl_log_entry->db,
- &to_table,
- &to_converted_name,
- &ddl_log_entry->from_db,
- &from_table);
- (void) Table_triggers_list::change_table_name(thd,
- &trigger_param,
- &ddl_log_entry->db,
- &to_table,
- &to_converted_name,
- &ddl_log_entry->from_db,
- &from_table);
- thd->mdl_context.release_lock(mdl_request.ticket);
- }
- if (ddl_log_increment_phase_no_lock(entry_pos))
+ rename_triggers(thd, ddl_log_entry, 0);
+ if (increment_phase(entry_pos))
break;
- (void) ddl_log_sync_no_lock();
- }
/* fall through */
case DDL_RENAME_PHASE_STAT:
- {
- (void) rename_table_in_stat_tables(thd,
- &ddl_log_entry->db,
- &to_converted_name,
- &ddl_log_entry->from_db,
- &from_table);
- if (ddl_log_increment_phase_no_lock(entry_pos))
- break;
- (void) ddl_log_sync_no_lock();
- }
+ /*
+ Stat tables must be updated last so that we can handle a rename of
+ a stat table. For now we just rememeber that we have to update it
+ */
+ update_flags(ddl_log_entry->entry_pos, DDL_LOG_FLAG_UPDATE_STAT);
+ ddl_log_entry->flags|= DDL_LOG_FLAG_UPDATE_STAT;
/* fall through */
case DDL_RENAME_PHASE_TABLE:
/* Restore frm and table to original names */
- to_length= build_table_filename(to_path, sizeof(to_path) - 1,
- ddl_log_entry->db.str,
- ddl_log_entry->name.str,
- reg_ext, 0);
- fr_length= build_table_filename(from_path, sizeof(from_path) - 1,
- ddl_log_entry->from_db.str,
- ddl_log_entry->from_name.str,
- reg_ext, 0);
- (void) mysql_file_rename(key_file_frm, to_path, from_path, MYF(MY_WME));
+ execute_rename_table(ddl_log_entry, file,
+ &ddl_log_entry->db, &ddl_log_entry->name,
+ &ddl_log_entry->from_db, &ddl_log_entry->from_name,
+ 0,
+ from_path, to_path);
- if (file->needs_lower_case_filenames())
- {
- build_lower_case_table_filename(to_path, sizeof(to_path) - 1,
- &ddl_log_entry->db,
- &to_table, 0);
- build_lower_case_table_filename(from_path, sizeof(from_path) - 1,
- &ddl_log_entry->from_db,
- &from_table, 0);
- }
- else
+ if (ddl_log_entry->flags & DDL_LOG_FLAG_UPDATE_STAT)
{
- /* remove extension from file name */
- DBUG_ASSERT(to_length != 0 && fr_length != 0);
- to_path[to_length - reg_ext_length]= 0;
- from_path[fr_length - reg_ext_length]= 0;
+ /* Update stat tables last */
+ rename_in_stat_tables(thd, ddl_log_entry, 0);
}
- file->ha_rename_table(to_path, from_path);
/* disable the entry and sync */
(void) update_phase(entry_pos, DDL_LOG_FINAL_PHASE);
break;
@@ -1348,19 +1517,17 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
/* Not found or already deleted. Delete .frm if it exists */
strxnmov(to_path, sizeof(to_path)-1, path.str, reg_ext, NullS);
mysql_file_delete(key_file_frm, to_path, MYF(MY_WME|MY_IGNORE_ENOENT));
+ error= 0;
}
- if (ddl_log_increment_phase_no_lock(entry_pos))
+ if (increment_phase(entry_pos))
break;
- (void) ddl_log_sync_no_lock();
/* Fall through */
case DDL_DROP_PHASE_TRIGGER:
Table_triggers_list::drop_all_triggers(thd, &db, &table,
MYF(MY_WME | MY_IGNORE_ENOENT));
- if (ddl_log_increment_phase_no_lock(entry_pos))
+ if (increment_phase(entry_pos))
break;
- (void) ddl_log_sync_no_lock();
/* Fall through */
-
case DDL_DROP_PHASE_BINLOG:
if (strcmp(recovery_state.current_db, db.str))
{
@@ -1374,7 +1541,7 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
if (ddl_log_drop_to_binary_log(thd, ddl_log_entry,
&recovery_state.drop_table))
{
- if (ddl_log_increment_phase_no_lock(entry_pos))
+ if (increment_phase(entry_pos))
break;
}
break;
@@ -1408,7 +1575,7 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
if (ddl_log_drop_to_binary_log(thd, ddl_log_entry,
&recovery_state.drop_view))
{
- if (ddl_log_increment_phase_no_lock(entry_pos))
+ if (increment_phase(entry_pos))
break;
}
}
@@ -1502,9 +1669,9 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
mysql_file_delete_with_symlink(key_file_misc, to_path, "", MYF(0));
(void) rm_dir_w_symlink(path.str, 0);
- if (ddl_log_increment_phase_no_lock(entry_pos))
+ if (increment_phase(entry_pos))
break;
- /* Fall through */
+ /* fall through */
case DDL_DROP_DB_PHASE_LOG:
{
String *query= &recovery_state.drop_table;
@@ -1578,6 +1745,7 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
}
}
(void) update_phase(entry_pos, DDL_LOG_FINAL_PHASE);
+ error= 0;
break;
}
case DDL_LOG_CREATE_VIEW_ACTION:
@@ -1733,6 +1901,349 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
}
break;
}
+ case DDL_LOG_ALTER_TABLE_ACTION:
+ {
+ handlerton *org_hton, *partition_hton;
+ handler *org_file;
+ bool is_renamed= ddl_log_entry->flags & DDL_LOG_FLAG_ALTER_RENAME;
+ bool new_version_ready= 0, new_version_unusable= 0;
+ LEX_CSTRING db, table;
+ db= ddl_log_entry->db;
+ table= ddl_log_entry->name;
+
+ if (!(org_file= create_handler(thd, mem_root,
+ &ddl_log_entry->from_handler_name)))
+ goto end;
+ /* Handlerton of the final table and any temporary tables */
+ org_hton= org_file->ht;
+ /*
+ partition_hton is the hton for the new file, or
+ in case of ALTER of a partitioned table, the underlying
+ table
+ */
+ partition_hton= hton;
+
+ if (ddl_log_entry->flags & DDL_LOG_FLAG_ALTER_PARTITION)
+ {
+ /*
+ The from and to tables where both using the partition engine.
+ */
+ hton= org_hton;
+ }
+ switch (ddl_log_entry->phase) {
+ case DDL_ALTER_TABLE_PHASE_RENAME_FAILED:
+ /*
+ We come here when the final rename of temporary table (#sql-alter) to
+ the original name failed. Now we have to delete the temporary table
+ and restore the backup.
+ */
+ quick_rm_table(thd, hton, &db, &table, FN_IS_TMP);
+ if (!is_renamed)
+ {
+ execute_rename_table(ddl_log_entry, file,
+ &ddl_log_entry->from_db,
+ &ddl_log_entry->extra_name, // #sql-backup
+ &ddl_log_entry->from_db,
+ &ddl_log_entry->from_name,
+ FN_FROM_IS_TMP,
+ from_path, to_path);
+ }
+ (void) update_phase(entry_pos, DDL_LOG_FINAL_PHASE);
+ break;
+ case DDL_ALTER_TABLE_PHASE_PREPARE_INPLACE:
+ /* We crashed before ddl_log_update_unique_id() was called */
+ new_version_unusable= 1;
+ /* fall through */
+ case DDL_ALTER_TABLE_PHASE_INPLACE_COPIED:
+ /* The inplace alter table is committed and ready to be used */
+ if (!new_version_unusable)
+ new_version_ready= 1;
+ /* fall through */
+ case DDL_ALTER_TABLE_PHASE_INPLACE:
+ {
+ int fr_length, to_length;
+ /*
+ Inplace alter table was used.
+ On disk there are now a table with the original name, the
+ original .frm file and potentially a #sql-alter...frm file
+ with the new definition.
+ */
+ fr_length= build_table_filename(from_path, sizeof(from_path) - 1,
+ ddl_log_entry->db.str,
+ ddl_log_entry->name.str,
+ reg_ext, 0);
+ to_length= build_table_filename(to_path, sizeof(to_path) - 1,
+ ddl_log_entry->from_db.str,
+ ddl_log_entry->from_name.str,
+ reg_ext, 0);
+ if (!access(from_path, F_OK)) // Does #sql-alter.. exists?
+ {
+ LEX_CUSTRING version= {ddl_log_entry->uuid, MY_UUID_SIZE};
+ /*
+ Temporary .frm file exists. This means that that the table in
+ the storage engine can be of either old or new version.
+ If old version, delete the new .frm table and keep the old one.
+ If new version, replace the old .frm with the new one.
+ */
+ to_path[to_length - reg_ext_length]= 0; // Remove .frm
+ if (!new_version_unusable &&
+ ( !partition_hton->check_version || new_version_ready ||
+ !partition_hton->check_version(partition_hton,
+ to_path, &version,
+ ddl_log_entry->unique_id)))
+ {
+ /* Table is up to date */
+
+ /*
+ Update state so that if we crash and retry the ddl log entry,
+ we know that we can use the new table even if .frm is renamed.
+ */
+ if (ddl_log_entry->phase != DDL_ALTER_TABLE_PHASE_INPLACE_COPIED)
+ (void) update_phase(entry_pos,
+ DDL_ALTER_TABLE_PHASE_INPLACE_COPIED);
+ /* Replace old .frm file with new one */
+ to_path[to_length - reg_ext_length]= FN_EXTCHAR;
+ (void) mysql_file_rename(key_file_frm, from_path, to_path,
+ MYF(MY_WME));
+ new_version_ready= 1;
+ }
+ else
+ {
+ DBUG_ASSERT(!new_version_ready);
+ /*
+ Use original version of the .frm file.
+ Remove temporary #sql-alter.frm file and the #sql-alter table.
+ We have also to remove the temporary table as some storage engines,
+ like InnoDB, may use it as an internal temporary table
+ during inplace alter table.
+ */
+ from_path[fr_length - reg_ext_length]= 0;
+ error= org_hton->drop_table(org_hton, from_path);
+ if (non_existing_table_error(error))
+ error= 0;
+ from_path[fr_length - reg_ext_length]= FN_EXTCHAR;
+ mysql_file_delete(key_file_frm, from_path,
+ MYF(MY_WME|MY_IGNORE_ENOENT));
+ (void) update_phase(entry_pos, DDL_LOG_FINAL_PHASE);
+ break;
+ }
+ }
+ if (is_renamed && new_version_ready)
+ {
+ /* After the renames above, the original table is now in from_name */
+ ddl_log_entry->name= ddl_log_entry->from_name;
+ /* Rename db.name -> db.extra_name */
+ execute_rename_table(ddl_log_entry, file,
+ &ddl_log_entry->db, &ddl_log_entry->name,
+ &ddl_log_entry->db, &ddl_log_entry->extra_name,
+ 0,
+ from_path, to_path);
+ }
+ (void) update_phase(entry_pos, DDL_ALTER_TABLE_PHASE_UPDATE_TRIGGERS);
+ goto update_triggers;
+ }
+ case DDL_ALTER_TABLE_PHASE_COPIED:
+ {
+ char *from_end;
+ /*
+ New table is created and we have the query for the binary log.
+ We should remove the original table and in the next stage replace
+ it with the new one.
+ */
+ build_table_filename(from_path, sizeof(from_path) - 1,
+ ddl_log_entry->from_db.str,
+ ddl_log_entry->from_name.str,
+ "", 0);
+ build_table_filename(to_path, sizeof(to_path) - 1,
+ ddl_log_entry->db.str,
+ ddl_log_entry->name.str,
+ "", 0);
+ from_end= strend(from_path);
+ if (likely(org_hton))
+ {
+ error= org_hton->drop_table(org_hton, from_path);
+ if (non_existing_table_error(error))
+ error= 0;
+ }
+ strmov(from_end, reg_ext);
+ mysql_file_delete(key_file_frm, from_path,
+ MYF(MY_WME|MY_IGNORE_ENOENT));
+ *from_end= 0; // Remove extension
+
+ (void) update_phase(entry_pos, DDL_ALTER_TABLE_PHASE_OLD_RENAMED);
+ }
+ /* fall through */
+ case DDL_ALTER_TABLE_PHASE_OLD_RENAMED:
+ {
+ /*
+ The new table (from_path) is up to date.
+ Original table is either renamed as backup table (normal case),
+ only frm is renamed (in case of engine change) or deleted above.
+ */
+ if (!is_renamed)
+ {
+ uint length;
+ /* Rename new "temporary" table to the original wanted name */
+ execute_rename_table(ddl_log_entry, file,
+ &ddl_log_entry->db,
+ &ddl_log_entry->name,
+ &ddl_log_entry->from_db,
+ &ddl_log_entry->from_name,
+ FN_FROM_IS_TMP,
+ from_path, to_path);
+
+ /*
+ Remove backup (only happens if alter table used without rename).
+ Backup name is always in lower case, so there is no need for
+ converting table names.
+ */
+ length= build_table_filename(from_path, sizeof(from_path) - 1,
+ ddl_log_entry->from_db.str,
+ ddl_log_entry->extra_name.str,
+ "", FN_IS_TMP);
+ if (likely(org_hton))
+ {
+ if (ddl_log_entry->flags & DDL_LOG_FLAG_ALTER_ENGINE_CHANGED)
+ {
+ /* Only frm is renamed, storage engine files have original name */
+ build_table_filename(to_path, sizeof(from_path) - 1,
+ ddl_log_entry->from_db.str,
+ ddl_log_entry->from_name.str,
+ "", 0);
+ error= org_hton->drop_table(org_hton, to_path);
+ }
+ else
+ error= org_hton->drop_table(org_hton, from_path);
+ if (non_existing_table_error(error))
+ error= 0;
+ }
+ strmov(from_path + length, reg_ext);
+ mysql_file_delete(key_file_frm, from_path,
+ MYF(MY_WME|MY_IGNORE_ENOENT));
+ }
+ else
+ execute_rename_table(ddl_log_entry, file,
+ &ddl_log_entry->db, &ddl_log_entry->name,
+ &ddl_log_entry->db, &ddl_log_entry->extra_name,
+ FN_FROM_IS_TMP,
+ from_path, to_path);
+ (void) update_phase(entry_pos, DDL_ALTER_TABLE_PHASE_UPDATE_TRIGGERS);
+ }
+ /* fall through */
+ case DDL_ALTER_TABLE_PHASE_UPDATE_TRIGGERS:
+ update_triggers:
+ {
+ if (is_renamed)
+ {
+ // rename_triggers will rename from: from_db.from_name -> db.extra_name
+ rename_triggers(thd, ddl_log_entry, 1);
+ (void) update_phase(entry_pos, DDL_ALTER_TABLE_PHASE_UPDATE_STATS);
+ }
+ }
+ /* fall through */
+ case DDL_ALTER_TABLE_PHASE_UPDATE_STATS:
+ if (is_renamed)
+ {
+ ddl_log_entry->name= ddl_log_entry->from_name;
+ ddl_log_entry->from_name= ddl_log_entry->extra_name;
+ rename_in_stat_tables(thd, ddl_log_entry, 1);
+ (void) update_phase(entry_pos, DDL_ALTER_TABLE_PHASE_UPDATE_STATS);
+ }
+ /* fall through */
+ case DDL_ALTER_TABLE_PHASE_UPDATE_BINARY_LOG:
+ {
+ /* Write ALTER TABLE query to binary log */
+ if (recovery_state.query.length() && mysql_bin_log.is_open())
+ {
+ LEX_CSTRING save_db;
+ /* Reuse old xid value if possible */
+ if (!recovery_state.xid)
+ recovery_state.xid= server_uuid_value();
+ thd->binlog_xid= recovery_state.xid;
+ update_xid(recovery_state.execute_entry_pos, thd->binlog_xid);
+
+ mysql_mutex_unlock(&LOCK_gdl);
+ save_db= thd->db;
+ lex_string_set3(&thd->db, recovery_state.db.ptr(),
+ recovery_state.db.length());
+ (void) thd->binlog_query(THD::STMT_QUERY_TYPE,
+ recovery_state.query.ptr(),
+ recovery_state.query.length(),
+ TRUE, FALSE, FALSE, 0);
+ thd->binlog_xid= 0;
+ thd->db= save_db;
+ mysql_mutex_lock(&LOCK_gdl);
+ }
+ recovery_state.query.length(0);
+ (void) update_phase(entry_pos, DDL_LOG_FINAL_PHASE);
+ break;
+ }
+ /*
+ The following cases are when alter table failed and we have to roll
+ back
+ */
+ case DDL_ALTER_TABLE_PHASE_CREATED:
+ {
+ /*
+ Temporary table should have been created. Delete it.
+ */
+ if (likely(hton))
+ {
+ error= hton->drop_table(hton, ddl_log_entry->tmp_name.str);
+ if (non_existing_table_error(error))
+ error= 0;
+ }
+ (void) update_phase(entry_pos, DDL_ALTER_TABLE_PHASE_INIT);
+ }
+ /* fall through */
+ case DDL_ALTER_TABLE_PHASE_INIT:
+ {
+ /*
+ A temporary .frm and possible a .par files should have been created
+ */
+ strxmov(to_path, ddl_log_entry->tmp_name.str, reg_ext, NullS);
+ mysql_file_delete(key_file_frm, to_path, MYF(MY_WME|MY_IGNORE_ENOENT));
+ strxmov(to_path, ddl_log_entry->tmp_name.str, PAR_EXT, NullS);
+ mysql_file_delete(key_file_partition_ddl_log, to_path,
+ MYF(MY_WME|MY_IGNORE_ENOENT));
+ (void) update_phase(entry_pos, DDL_LOG_FINAL_PHASE);
+ break;
+ }
+ }
+ delete org_file;
+ break;
+ }
+ case DDL_LOG_STORE_QUERY_ACTION:
+ {
+ /*
+ Read query for next ddl command
+ */
+ if (ddl_log_entry->flags)
+ {
+ /*
+ First QUERY event. Allocate query string.
+ Query length is stored in unique_id
+ */
+ if (recovery_state.query.alloc((size_t) (ddl_log_entry->unique_id+1)))
+ goto end;
+ recovery_state.query.length(0);
+ recovery_state.db.copy(ddl_log_entry->db.str, ddl_log_entry->db.length,
+ system_charset_info);
+ }
+ if (unlikely(recovery_state.query.length() +
+ ddl_log_entry->extra_name.length >
+ recovery_state.query.alloced_length()))
+ {
+ /* Impossible length. Ignore query */
+ recovery_state.query.length(0);
+ error= 1;
+ my_error(ER_INTERNAL_ERROR, MYF(0),
+ "DDL log: QUERY event has impossible length");
+ break;
+ }
+ recovery_state.query.qs_append(&ddl_log_entry->extra_name);
+ break;
+ }
default:
DBUG_ASSERT(0);
break;
@@ -1740,7 +2251,7 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
end:
delete file;
- if ((error= no_such_table_handler.unhandled_errors > 0))
+ if ((error= (no_such_table_handler.unhandled_errors > 0)))
my_errno= no_such_table_handler.first_error;
thd->pop_internal_handler();
DBUG_RETURN(error);
@@ -1819,6 +2330,8 @@ void ddl_log_release_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry)
global_ddl_log.first_used= next_log_entry;
if (next_log_entry)
next_log_entry->prev_log_entry= prev_log_entry;
+ // Ensure we get a crash if we try to access this link again.
+ log_entry->next_active_log_entry= (DDL_LOG_MEMORY_ENTRY*) 0x1;
DBUG_VOID_RETURN;
}
@@ -2056,6 +2569,8 @@ bool ddl_log_sync()
Executing an entry means executing a linked list of actions.
+ This function is called for recovering partitioning in case of error.
+
@param first_entry Reference to first action in entry
@return Operation status
@@ -2169,9 +2684,12 @@ int ddl_log_execute_recovery()
thd->thread_stack= (char*) &thd;
thd->store_globals();
thd->init(); // Needed for error messages
+
thd->log_all_errors= (global_system_variables.log_warnings >= 3);
recovery_state.drop_table.free();
recovery_state.drop_view.free();
+ recovery_state.query.free();
+ recovery_state.db.free();
thd->set_query(recover_query_string, strlen(recover_query_string));
@@ -2185,6 +2703,13 @@ int ddl_log_execute_recovery()
}
if (ddl_log_entry.entry_type == DDL_LOG_EXECUTE_CODE)
{
+ /*
+ Remeber information about executive ddl log entry,
+ used for binary logging during recovery
+ */
+ recovery_state.execute_entry_pos= i;
+ recovery_state.xid= ddl_log_entry.xid;
+
/* purecov: begin tested */
if (ddl_log_entry.unique_id > DDL_LOG_MAX_RETRY)
{
@@ -2200,6 +2725,7 @@ int ddl_log_execute_recovery()
continue;
}
/* purecov: end tested */
+
if (ddl_log_execute_entry_no_lock(thd, ddl_log_entry.next_entry))
{
/* Real unpleasant scenario but we have to continue anyway */
@@ -2211,10 +2737,13 @@ int ddl_log_execute_recovery()
}
recovery_state.drop_table.free();
recovery_state.drop_view.free();
+ recovery_state.query.free();
+ recovery_state.db.free();
close_ddl_log();
mysql_mutex_unlock(&LOCK_gdl);
thd->reset_query();
delete thd;
+ set_current_thd(original_thd);
/*
Create a new ddl_log to get rid of old stuff and ensure that header matches
@@ -2280,7 +2809,7 @@ static void add_log_entry(DDL_LOG_STATE *state,
DDL_LOG_MEMORY_ENTRY *log_entry)
{
log_entry->next_active_log_entry= state->list;
- state->list= log_entry;
+ state->main_entry= state->list= log_entry;
}
@@ -2332,6 +2861,8 @@ void ddl_log_complete(DDL_LOG_STATE *state)
/**
Revert (execute) all entries in the ddl log
+
+ This is called for failed rename table, create trigger or drop trigger.
*/
void ddl_log_revert(THD *thd, DDL_LOG_STATE *state)
@@ -2355,13 +2886,48 @@ void ddl_log_revert(THD *thd, DDL_LOG_STATE *state)
/*
- Update phase of last created ddl log entry
+ Update phase of main ddl log entry (usually the last one created,
+ except in case of query events, the one before the query event).
*/
bool ddl_log_update_phase(DDL_LOG_STATE *state, uchar phase)
{
DBUG_ENTER("ddl_log_update_phase");
- DBUG_RETURN(update_phase(state->list->entry_pos, phase));
+ if (likely(state->list))
+ DBUG_RETURN(update_phase(state->main_entry->entry_pos, phase));
+ DBUG_RETURN(0);
+}
+
+
+/*
+ Update flag bits in main ddl log entry (usually last created, except in case
+ of query events, the one before the query event.
+*/
+
+bool ddl_log_add_flag(DDL_LOG_STATE *state, uint16 flags)
+{
+ DBUG_ENTER("ddl_log_update_phase");
+ if (likely(state->list))
+ {
+ state->flags|= flags;
+ DBUG_RETURN(update_flags(state->main_entry->entry_pos, state->flags));
+ }
+ DBUG_RETURN(0);
+}
+
+
+/**
+ Update unique_id (used for inplace alter table)
+*/
+
+bool ddl_log_update_unique_id(DDL_LOG_STATE *state, ulonglong id)
+{
+ DBUG_ENTER("ddl_log_update_unique_id");
+ DBUG_PRINT("enter", ("id: %llu", id));
+ /* The following may not be true in case of temporary tables */
+ if (likely(state->list))
+ DBUG_RETURN(update_unique_id(state->main_entry->entry_pos, id));
+ DBUG_RETURN(0);
}
@@ -2396,6 +2962,8 @@ bool ddl_log_update_xid(DDL_LOG_STATE *state, ulonglong xid)
/*
Write ddl_log_entry and write or update ddl_execute_entry
+
+ Will update DDL_LOG_STATE->flags
*/
static bool ddl_log_write(DDL_LOG_STATE *ddl_state,
@@ -2417,6 +2985,7 @@ static bool ddl_log_write(DDL_LOG_STATE *ddl_state,
DBUG_RETURN(1);
}
add_log_entry(ddl_state, log_entry);
+ ddl_state->flags|= ddl_log_entry->flags; // Update cache
DBUG_RETURN(0);
}
@@ -2678,7 +3247,7 @@ bool ddl_log_create_table(THD *thd, DDL_LOG_STATE *ddl_state,
ddl_log_entry.db= *const_cast<LEX_CSTRING*>(db);
ddl_log_entry.name= *const_cast<LEX_CSTRING*>(table);
ddl_log_entry.tmp_name= *const_cast<LEX_CSTRING*>(path);
- ddl_log_entry.flags= only_frm;
+ ddl_log_entry.flags= only_frm ? DDL_LOG_FLAG_ONLY_FRM : 0;
DBUG_RETURN(ddl_log_write(ddl_state, &ddl_log_entry));
}
@@ -2750,3 +3319,156 @@ bool ddl_log_create_trigger(THD *thd, DDL_LOG_STATE *ddl_state,
ddl_log_entry.phase= (uchar) phase;
DBUG_RETURN(ddl_log_write(ddl_state, &ddl_log_entry));
}
+
+
+/**
+ Log ALTER TABLE
+
+ $param backup_name Name of backup table. In case of ALTER TABLE rename
+ this is the final table name
+*/
+
+bool ddl_log_alter_table(THD *thd, DDL_LOG_STATE *ddl_state,
+ handlerton *org_hton,
+ const LEX_CSTRING *db, const LEX_CSTRING *table,
+ handlerton *new_hton,
+ handlerton *partition_underlying_hton,
+ const LEX_CSTRING *new_db,
+ const LEX_CSTRING *new_table,
+ const LEX_CSTRING *frm_path,
+ const LEX_CSTRING *backup_name,
+ const LEX_CUSTRING *version,
+ ulonglong table_version,
+ bool is_renamed)
+{
+ DDL_LOG_ENTRY ddl_log_entry;
+ DBUG_ENTER("ddl_log_alter_table");
+ DBUG_ASSERT(new_hton);
+ DBUG_ASSERT(org_hton);
+
+ bzero(&ddl_log_entry, sizeof(ddl_log_entry));
+ ddl_log_entry.action_type= DDL_LOG_ALTER_TABLE_ACTION;
+ if (new_hton)
+ lex_string_set(&ddl_log_entry.handler_name,
+ ha_resolve_storage_engine_name(new_hton));
+ /* Store temporary table name */
+ ddl_log_entry.db= *const_cast<LEX_CSTRING*>(new_db);
+ ddl_log_entry.name= *const_cast<LEX_CSTRING*>(new_table);
+ if (org_hton)
+ lex_string_set(&ddl_log_entry.from_handler_name,
+ ha_resolve_storage_engine_name(org_hton));
+ ddl_log_entry.from_db= *const_cast<LEX_CSTRING*>(db);
+ ddl_log_entry.from_name= *const_cast<LEX_CSTRING*>(table);
+ ddl_log_entry.tmp_name= *const_cast<LEX_CSTRING*>(frm_path);
+ ddl_log_entry.extra_name= *const_cast<LEX_CSTRING*>(backup_name);
+ ddl_log_entry.flags= is_renamed ? DDL_LOG_FLAG_ALTER_RENAME : 0;
+ ddl_log_entry.unique_id= table_version;
+
+ /*
+ If we are doing an inplace of a partition engine, we need to log the
+ underlaying engine. We store this is in ddl_log_entry.handler_name
+ */
+ if (new_hton == org_hton && partition_underlying_hton != new_hton)
+ {
+ lex_string_set(&ddl_log_entry.handler_name,
+ ha_resolve_storage_engine_name(partition_underlying_hton));
+ ddl_log_entry.flags|= DDL_LOG_FLAG_ALTER_PARTITION;
+ }
+ DBUG_ASSERT(version->length == MY_UUID_SIZE);
+ memcpy(ddl_log_entry.uuid, version->str, version->length);
+ DBUG_RETURN(ddl_log_write(ddl_state, &ddl_log_entry));
+}
+
+
+/*
+ Store query that later should be logged to binary log
+
+ The links of the query log event is
+
+ execute_log_event -> first log_query_event [-> log_query_event...] ->
+ action_log_event (probably a LOG_ALTER_TABLE_ACTION event)
+
+ This ensures that when we execute the log_query_event it can collect
+ the full query from the log_query_events and then execute the
+ action_log_event with the original query stored in 'recovery_state.query'.
+
+ The query is stored in ddl_log_entry.extra_name as this is the last string
+ stored in the log block (makes it easier to check and debug).
+*/
+
+bool ddl_log_store_query(THD *thd, DDL_LOG_STATE *ddl_state,
+ const char *query, size_t length)
+{
+ DDL_LOG_ENTRY ddl_log_entry;
+ DDL_LOG_MEMORY_ENTRY *first_entry, *next_entry= 0;
+ DDL_LOG_MEMORY_ENTRY *original_entry= ddl_state->list;
+ size_t max_query_length;
+ uint entry_pos, next_entry_pos= 0, parent_entry_pos;
+ DBUG_ENTER("ddl_log_store_query");
+ DBUG_ASSERT(length <= UINT_MAX32);
+ DBUG_ASSERT(length > 0);
+ DBUG_ASSERT(ddl_state->list);
+
+ bzero(&ddl_log_entry, sizeof(ddl_log_entry));
+ ddl_log_entry.action_type= DDL_LOG_STORE_QUERY_ACTION;
+ ddl_log_entry.unique_id= length;
+ ddl_log_entry.flags= 1; // First entry
+ ddl_log_entry.db= thd->db; // Current database
+
+ max_query_length= ddl_log_free_space_in_entry(&ddl_log_entry);
+
+ mysql_mutex_lock(&LOCK_gdl);
+ ddl_log_entry.entry_type= DDL_LOG_ENTRY_CODE;
+
+ if (ddl_log_get_free_entry(&first_entry))
+ goto err;
+ parent_entry_pos= ddl_state->list->entry_pos;
+ entry_pos= first_entry->entry_pos;
+ add_log_entry(ddl_state, first_entry);
+
+ while (length)
+ {
+ size_t write_length= MY_MIN(length, max_query_length);
+ ddl_log_entry.extra_name.str= query;
+ ddl_log_entry.extra_name.length= write_length;
+
+ query+= write_length;
+ length-= write_length;
+
+ if (length > 0)
+ {
+ if (ddl_log_get_free_entry(&next_entry))
+ goto err;
+ ddl_log_entry.next_entry= next_entry_pos= next_entry->entry_pos;
+ add_log_entry(ddl_state, next_entry);
+ }
+ else
+ {
+ /* point next link of last query_action event to the original action */
+ ddl_log_entry.next_entry= parent_entry_pos;
+ }
+ set_global_from_ddl_log_entry(&ddl_log_entry);
+ if (unlikely(write_ddl_log_file_entry(entry_pos)))
+ goto err;
+ entry_pos= next_entry_pos;
+ ddl_log_entry.flags= 0; // Only first entry has this set
+ ddl_log_entry.db.length= 0; // Don't need DB anymore
+ ddl_log_entry.extra_name.length= 0;
+ max_query_length= ddl_log_free_space_in_entry(&ddl_log_entry);
+ }
+ if (ddl_log_write_execute_entry(first_entry->entry_pos,
+ &ddl_state->execute_entry))
+ goto err;
+
+ /* Set the original entry to be used for future PHASE updates */
+ ddl_state->main_entry= original_entry;
+ mysql_mutex_unlock(&LOCK_gdl);
+ DBUG_RETURN(0);
+err:
+ /*
+ Allocated ddl_log entries will be released by the
+ ddl_log_release_entries() call in dl_log_complete()
+ */
+ mysql_mutex_unlock(&LOCK_gdl);
+ DBUG_RETURN(1);
+}
diff --git a/sql/ddl_log.h b/sql/ddl_log.h
index 3aabde31733..7033539963d 100644
--- a/sql/ddl_log.h
+++ b/sql/ddl_log.h
@@ -86,6 +86,8 @@ enum ddl_log_action_code
DDL_LOG_CREATE_VIEW_ACTION=13,
DDL_LOG_DELETE_TMP_FILE_ACTION=14,
DDL_LOG_CREATE_TRIGGER_ACTION=15,
+ DDL_LOG_ALTER_TABLE_ACTION=16,
+ DDL_LOG_STORE_QUERY_ACTION=17,
DDL_LOG_LAST_ACTION /* End marker */
};
@@ -142,6 +144,35 @@ enum enum_ddl_log_create_trigger_phase {
DDL_CREATE_TRIGGER_PHASE_END
};
+enum enum_ddl_log_alter_table_phase {
+ DDL_ALTER_TABLE_PHASE_INIT,
+ DDL_ALTER_TABLE_PHASE_RENAME_FAILED,
+ DDL_ALTER_TABLE_PHASE_INPLACE_COPIED,
+ DDL_ALTER_TABLE_PHASE_INPLACE,
+ DDL_ALTER_TABLE_PHASE_PREPARE_INPLACE,
+ DDL_ALTER_TABLE_PHASE_CREATED,
+ DDL_ALTER_TABLE_PHASE_COPIED,
+ DDL_ALTER_TABLE_PHASE_OLD_RENAMED,
+ DDL_ALTER_TABLE_PHASE_UPDATE_TRIGGERS,
+ DDL_ALTER_TABLE_PHASE_UPDATE_STATS,
+ DDL_ALTER_TABLE_PHASE_UPDATE_BINARY_LOG,
+ DDL_ALTER_TABLE_PHASE_END
+};
+
+
+/*
+ Flags stored in DDL_LOG_ENTRY.flags
+ The flag values can be reused for different commands
+*/
+#define DDL_LOG_FLAG_ALTER_RENAME (1 << 0)
+#define DDL_LOG_FLAG_ALTER_ENGINE_CHANGED (1 << 1)
+#define DDL_LOG_FLAG_ONLY_FRM (1 << 2)
+#define DDL_LOG_FLAG_UPDATE_STAT (1 << 3)
+/*
+ Set when using ALTER TABLE on a partitioned table and the table
+ engine is not changed
+*/
+#define DDL_LOG_FLAG_ALTER_PARTITION (1 << 4)
/*
Setting ddl_log_entry.phase to this has the same effect as setting
@@ -155,10 +186,11 @@ typedef struct st_ddl_log_entry
LEX_CSTRING name;
LEX_CSTRING from_name;
LEX_CSTRING handler_name;
- LEX_CSTRING tmp_name;
LEX_CSTRING db;
LEX_CSTRING from_db;
LEX_CSTRING from_handler_name;
+ LEX_CSTRING tmp_name; /* frm file or temporary file name */
+ LEX_CSTRING extra_name; /* Backup table name */
uchar uuid[MY_UUID_SIZE]; // UUID for new frm file
ulonglong xid; // Xid stored in the binary log
@@ -210,6 +242,12 @@ typedef struct st_ddl_log_state
DDL_LOG_MEMORY_ENTRY *list;
/* One execute entry per list */
DDL_LOG_MEMORY_ENTRY *execute_entry;
+ /*
+ Entry used for PHASE updates. Normally same as first in 'list', but in
+ case of a query log event, this points to the main event.
+ */
+ DDL_LOG_MEMORY_ENTRY *main_entry;
+ uint16 flags; /* Cache for flags */
bool is_active() { return list != 0; }
} DDL_LOG_STATE;
@@ -232,6 +270,8 @@ void ddl_log_complete(DDL_LOG_STATE *ddl_log_state);
void ddl_log_revert(THD *thd, DDL_LOG_STATE *ddl_log_state);
bool ddl_log_update_phase(DDL_LOG_STATE *entry, uchar phase);
+bool ddl_log_add_flag(DDL_LOG_STATE *entry, uint16 flag);
+bool ddl_log_update_unique_id(DDL_LOG_STATE *state, ulonglong id);
bool ddl_log_update_xid(DDL_LOG_STATE *state, ulonglong xid);
bool ddl_log_disable_entry(DDL_LOG_STATE *state);
bool ddl_log_increment_phase(uint entry_pos);
@@ -294,5 +334,19 @@ bool ddl_log_create_trigger(THD *thd, DDL_LOG_STATE *ddl_state,
const LEX_CSTRING *db, const LEX_CSTRING *table,
const LEX_CSTRING *trigger_name,
enum_ddl_log_create_trigger_phase phase);
+bool ddl_log_alter_table(THD *thd, DDL_LOG_STATE *ddl_state,
+ handlerton *org_hton,
+ const LEX_CSTRING *db, const LEX_CSTRING *table,
+ handlerton *new_hton,
+ handlerton *partition_underlying_hton,
+ const LEX_CSTRING *new_db,
+ const LEX_CSTRING *new_table,
+ const LEX_CSTRING *frm_path,
+ const LEX_CSTRING *backup_table_name,
+ const LEX_CUSTRING *version,
+ ulonglong table_version,
+ bool is_renamed);
+bool ddl_log_store_query(THD *thd, DDL_LOG_STATE *ddl_log_state,
+ const char *query, size_t length);
extern mysql_mutex_t LOCK_gdl;
#endif /* DDL_LOG_INCLUDED */
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index b6c1a33fc91..f252c0c3137 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -304,8 +304,10 @@ ha_partition::ha_partition(handlerton *hton, TABLE_SHARE *share)
void ha_partition::ha_partition_init()
{
+ DBUG_ENTER("ha_partition::ha_partition_init");
init_alloc_root(PSI_INSTRUMENT_ME, &m_mem_root, 512, 512, MYF(0));
init_handler_variables();
+ DBUG_VOID_RETURN;
}
/*
diff --git a/sql/handler.cc b/sql/handler.cc
index 82c0f11905a..fa99c24771c 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -943,6 +943,24 @@ void ha_kill_query(THD* thd, enum thd_kill_levels level)
}
+static my_bool signal_ddl_recovery_done(THD *, plugin_ref plugin, void *)
+{
+ handlerton *hton= plugin_hton(plugin);
+ if (hton->signal_ddl_recovery_done)
+ (hton->signal_ddl_recovery_done)(hton);
+ return 0;
+}
+
+
+void ha_signal_ddl_recovery_done()
+{
+ DBUG_ENTER("ha_signal_ddl_recovery_done");
+ plugin_foreach(NULL, signal_ddl_recovery_done, MYSQL_STORAGE_ENGINE_PLUGIN,
+ NULL);
+ DBUG_VOID_RETURN;
+}
+
+
/*****************************************************************************
Backup functions
******************************************************************************/
@@ -4954,19 +4972,9 @@ Alter_inplace_info::Alter_inplace_info(HA_CREATE_INFO *create_info_arg,
alter_info(alter_info_arg),
key_info_buffer(key_info_arg),
key_count(key_count_arg),
- index_drop_count(0),
- index_drop_buffer(nullptr),
- index_add_count(0),
- index_add_buffer(nullptr),
- index_altered_ignorability_count(0),
rename_keys(current_thd->mem_root),
- handler_ctx(nullptr),
- group_commit_ctx(nullptr),
- handler_flags(0),
modified_part_info(modified_part_info_arg),
ignore(ignore_arg),
- online(false),
- unsupported_reason(nullptr),
error_if_not_empty(error_non_empty)
{}
diff --git a/sql/handler.h b/sql/handler.h
index 029e981c038..78ca0f92a38 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1546,6 +1546,37 @@ struct handlerton
THD *victim_thd, my_bool signal);
int (*set_checkpoint)(handlerton *hton, const XID* xid);
int (*get_checkpoint)(handlerton *hton, XID* xid);
+ /**
+ Check if the version of the table matches the version in the .frm
+ file.
+
+ This is mainly used to verify in recovery to check if an inplace
+ ALTER TABLE succeded.
+ Storage engines that does not support inplace alter table does not
+ have to implement this function.
+
+ @param hton handlerton
+ @param path Path for table
+ @param version The unique id that is stored in the .frm file for
+ CREATE and updated for each ALTER TABLE (but not for
+ simple renames).
+ This is the ID used for the final table.
+ @param create_id The value returned from handler->table_version() for
+ the original table (before ALTER TABLE).
+
+ @retval 0 If id matches or table is newer than create_id (depending
+ on what version check the engine supports. This means that
+ The (inplace) alter table did succeed.
+ @retval # > 0 Alter table did not succeed.
+
+ Related to handler::discover_check_version().
+ */
+ int (*check_version)(handlerton *hton, const char *path,
+ const LEX_CUSTRING *version, ulonglong create_id);
+
+ /* Called for all storage handlers after ddl recovery is done */
+ void (*signal_ddl_recovery_done)(handlerton *hton);
+
/*
Optional clauses in the CREATE/ALTER TABLE
*/
@@ -1820,6 +1851,12 @@ handlerton *ha_default_tmp_handlerton(THD *thd);
*/
#define HTON_REQUIRES_CLOSE_AFTER_TRUNCATE (1 << 18)
+/*
+ Used by mysql_inplace_alter_table() to decide if we should call
+ hton->notify_tabledef_changed() before commit (MyRocks) or after (InnoDB).
+*/
+#define HTON_REQUIRES_NOTIFY_TABLEDEF_CHANGED_AFTER_COMMIT (1 << 19)
+
class Ha_trx_info;
struct THD_TRANS
@@ -2485,27 +2522,27 @@ public:
uint key_count;
/** Size of index_drop_buffer array. */
- uint index_drop_count;
+ uint index_drop_count= 0;
/**
Array of pointers to KEYs to be dropped belonging to the TABLE instance
for the old version of the table.
*/
- KEY **index_drop_buffer;
+ KEY **index_drop_buffer= nullptr;
/** Size of index_add_buffer array. */
- uint index_add_count;
+ uint index_add_count= 0;
/**
Array of indexes into key_info_buffer for KEYs to be added,
sorted in increasing order.
*/
- uint *index_add_buffer;
+ uint *index_add_buffer= nullptr;
- KEY_PAIR *index_altered_ignorability_buffer;
+ KEY_PAIR *index_altered_ignorability_buffer= nullptr;
/** Size of index_altered_ignorability_buffer array. */
- uint index_altered_ignorability_count;
+ uint index_altered_ignorability_count= 0;
/**
Old and new index names. Used for index rename.
@@ -2536,7 +2573,7 @@ public:
@see inplace_alter_handler_ctx for information about object lifecycle.
*/
- inplace_alter_handler_ctx *handler_ctx;
+ inplace_alter_handler_ctx *handler_ctx= nullptr;
/**
If the table uses several handlers, like ha_partition uses one handler
@@ -2548,13 +2585,13 @@ public:
@see inplace_alter_handler_ctx for information about object lifecycle.
*/
- inplace_alter_handler_ctx **group_commit_ctx;
+ inplace_alter_handler_ctx **group_commit_ctx= nullptr;
/**
Flags describing in detail which operations the storage engine is to
execute. Flags are defined in sql_alter.h
*/
- alter_table_operations handler_flags;
+ alter_table_operations handler_flags= 0;
/* Alter operations involving parititons are strored here */
ulong partition_flags;
@@ -2565,13 +2602,24 @@ public:
with partitions to be dropped or changed marked as such + all partitions
to be added in the new version of table marked as such.
*/
- partition_info *modified_part_info;
+ partition_info * const modified_part_info;
/** true for ALTER IGNORE TABLE ... */
const bool ignore;
/** true for online operation (LOCK=NONE) */
- bool online;
+ bool online= false;
+
+ /**
+ When ha_commit_inplace_alter_table() is called the the engine can
+ set this to a function to be called after the ddl log
+ is committed.
+ */
+ typedef void (inplace_alter_table_commit_callback)(void *);
+ inplace_alter_table_commit_callback *inplace_alter_table_committed= nullptr;
+
+ /* This will be used as the argument to the above function when called */
+ void *inplace_alter_table_committed_argument= nullptr;
/** which ALGORITHM and LOCK are supported by the storage engine */
enum_alter_inplace_result inplace_supported;
@@ -2588,10 +2636,10 @@ public:
Please set to a properly localized string, for example using
my_get_err_msg(), so that the error message as a whole is localized.
*/
- const char *unsupported_reason;
+ const char *unsupported_reason= nullptr;
/** true when InnoDB should abort the alter when table is not empty */
- bool error_if_not_empty;
+ const bool error_if_not_empty;
Alter_inplace_info(HA_CREATE_INFO *create_info_arg,
Alter_info *alter_info_arg,
@@ -4044,6 +4092,15 @@ public:
{ return 0; }
virtual int extra_opt(enum ha_extra_function operation, ulong arg)
{ return extra(operation); }
+ /*
+ Table version id for the the table. This should change for each
+ sucessfull ALTER TABLE.
+ This is used by the handlerton->check_version() to ask the engine
+ if the table definition has been updated.
+ Storage engines that does not support inplace alter table does not
+ have to support this call.
+ */
+ virtual ulonglong table_version() const { return 0; }
/**
In an UPDATE or DELETE, if the row under the cursor was locked by another
@@ -5179,6 +5236,7 @@ TYPELIB *ha_known_exts(void);
int ha_panic(enum ha_panic_function flag);
void ha_close_connection(THD* thd);
void ha_kill_query(THD* thd, enum thd_kill_levels level);
+void ha_signal_ddl_recovery_done();
bool ha_flush_logs();
void ha_drop_database(const char* path);
void ha_checkpoint_state(bool disable);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index c31a60304ad..965809ff460 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -6863,14 +6863,18 @@ void uuid_short_init()
(((ulonglong) server_start_time) << 24));
}
-
-longlong Item_func_uuid_short::val_int()
+ulonglong server_uuid_value()
{
ulonglong val;
mysql_mutex_lock(&LOCK_short_uuid_generator);
val= uuid_value++;
mysql_mutex_unlock(&LOCK_short_uuid_generator);
- return (longlong) val;
+ return val;
+}
+
+longlong Item_func_uuid_short::val_int()
+{
+ return (longlong) server_uuid_value();
}
diff --git a/sql/item_func.h b/sql/item_func.h
index 560a9fa898e..3293a5893a3 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -4046,6 +4046,7 @@ public:
void uuid_short_init();
+ulonglong server_uuid_value();
class Item_func_uuid_short :public Item_longlong_func
{
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 9cc67419564..dff18b9585e 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -5313,6 +5313,10 @@ static int init_server_components()
}
#endif
+ if (ddl_log_execute_recovery() > 0)
+ unireg_abort(1);
+ ha_signal_ddl_recovery_done();
+
if (opt_myisam_log)
(void) mi_log(1);
@@ -5681,9 +5685,6 @@ int mysqld_main(int argc, char **argv)
initialize_information_schema_acl();
- if (ddl_log_execute_recovery() > 0)
- unireg_abort(1);
-
/*
Change EVENTS_ORIGINAL to EVENTS_OFF (the default value) as there is no
point in using ORIGINAL during startup
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 63dc9cf024c..ed68576b5b5 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7990,3 +7990,5 @@ ER_WITH_TIES_NEEDS_ORDER
eng "FETCH ... WITH TIES requires ORDER BY clause to be present"
ER_REMOVED_ORPHAN_TRIGGER
eng "Dropped orphan trigger '%-.64s', originally created for table: '%-.192s'"
+ER_STORAGE_ENGINE_DISABLED
+ eng "Storage engine %s is disabled"
diff --git a/sql/sql_alter.h b/sql/sql_alter.h
index b922cbf0637..b8aa2595a58 100644
--- a/sql/sql_alter.h
+++ b/sql/sql_alter.h
@@ -324,6 +324,7 @@ public:
LEX_CSTRING new_alias;
LEX_CSTRING tmp_name;
char tmp_buff[80];
+
/**
Indicates that if a row is deleted during copying of data from old version
of table to the new version ER_FK_CANNOT_DELETE_PARENT error should be
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 22efecb9210..07926712583 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -6168,8 +6168,9 @@ static void release_part_info_log_entries(DDL_LOG_MEMORY_ENTRY *log_entry)
while (log_entry)
{
+ DDL_LOG_MEMORY_ENTRY *next= log_entry->next_active_log_entry;
ddl_log_release_memory_entry(log_entry);
- log_entry= log_entry->next_active_log_entry;
+ log_entry= next;
}
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 7b3b0eb1136..95337d641a5 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4900,7 +4900,7 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,
DBUG_RETURN(TRUE);
}
- if (file->needs_lower_case_filenames())
+ if (file && file->needs_lower_case_filenames())
{
build_lower_case_table_filename(lc_from, sizeof(lc_from) -1,
old_db, old_name, flags & FN_FROM_IS_TMP);
@@ -7023,6 +7023,41 @@ static bool is_inplace_alter_impossible(TABLE *table,
}
+/*
+ Notify engine that table definition has changed as part of inplace alter
+ table
+*/
+
+static bool notify_tabledef_changed(TABLE_LIST *table_list)
+{
+ TABLE *table= table_list->table;
+ DBUG_ENTER("notify_tabledef_changed");
+
+ if (table->file->partition_ht()->notify_tabledef_changed)
+ {
+ char db_buff[FN_REFLEN], table_buff[FN_REFLEN];
+ handlerton *hton= table->file->ht;
+ LEX_CSTRING tmp_db, tmp_table;
+
+ tmp_db.str= db_buff;
+ tmp_table.str= table_buff;
+ tmp_db.length= tablename_to_filename(table_list->db.str,
+ db_buff, sizeof(db_buff));
+ tmp_table.length= tablename_to_filename(table_list->table_name.str,
+ table_buff, sizeof(table_buff));
+ if ((hton->notify_tabledef_changed)(hton, &tmp_db, &tmp_table,
+ table->s->frm_image,
+ &table->s->tabledef_version,
+ table->file))
+ {
+ my_error(HA_ERR_INCOMPATIBLE_DEFINITION, MYF(0));
+ DBUG_RETURN(true);
+ }
+ }
+ DBUG_RETURN(0);
+}
+
+
/**
Perform in-place alter table.
@@ -7058,6 +7093,7 @@ static bool mysql_inplace_alter_table(THD *thd,
TABLE *altered_table,
Alter_inplace_info *ha_alter_info,
MDL_request *target_mdl_request,
+ DDL_LOG_STATE *ddl_log_state,
TRIGGER_RENAME_PARAM *trigger_param,
Alter_table_ctx *alter_ctx)
{
@@ -7065,7 +7101,7 @@ static bool mysql_inplace_alter_table(THD *thd,
handlerton *db_type= table->s->db_type();
Alter_info *alter_info= ha_alter_info->alter_info;
bool reopen_tables= false;
- bool res;
+ bool res, commit_succeded_with_error= 0;
const enum_alter_inplace_result inplace_supported=
ha_alter_info->inplace_supported;
DBUG_ENTER("mysql_inplace_alter_table");
@@ -7178,10 +7214,27 @@ static bool mysql_inplace_alter_table(THD *thd,
break;
}
+ ddl_log_update_phase(ddl_log_state, DDL_ALTER_TABLE_PHASE_PREPARE_INPLACE);
+
if (table->file->ha_prepare_inplace_alter_table(altered_table,
ha_alter_info))
goto rollback;
+ debug_crash_here("ddl_log_alter_after_prepare_inplace");
+
+ /*
+ Store the new table_version() as it may have not been available before
+ in some engines, like InnoDB.
+ */
+ ddl_log_update_unique_id(ddl_log_state,
+ table->file->table_version());
+ /*
+ Mark that we have started inplace alter table. DDL recover will
+ have to decide if it should use the old or new version of the table, based
+ on if the new version did commit or not.
+ */
+ ddl_log_update_phase(ddl_log_state, DDL_ALTER_TABLE_PHASE_INPLACE);
+
/*
Downgrade the lock if storage engine has told us that exclusive lock was
necessary only for prepare phase (unless we are not under LOCK TABLES) and
@@ -7227,12 +7280,17 @@ static bool mysql_inplace_alter_table(THD *thd,
if (backup_reset_alter_copy_lock(thd))
goto rollback;
+ /* Crashing here should cause the original table to be used */
+ debug_crash_here("ddl_log_alter_after_copy");
/*
If we are killed after this point, we should ignore and continue.
We have mostly completed the operation at this point, there should
be no long waits left.
*/
+ DEBUG_SYNC(thd, "alter_table_inplace_before_commit");
+ THD_STAGE_INFO(thd, stage_alter_inplace_commit);
+
DBUG_EXECUTE_IF("alter_table_rollback_new_index", {
table->file->ha_commit_inplace_alter_table(altered_table,
ha_alter_info,
@@ -7241,8 +7299,15 @@ static bool mysql_inplace_alter_table(THD *thd,
goto cleanup;
});
- DEBUG_SYNC(thd, "alter_table_inplace_before_commit");
- THD_STAGE_INFO(thd, stage_alter_inplace_commit);
+ /*
+ Notify the engine that the table definition has changed so that it can
+ store the new ID as part of the commit
+ */
+
+ if (!(table->file->partition_ht()->flags &
+ HTON_REQUIRES_NOTIFY_TABLEDEF_CHANGED_AFTER_COMMIT) &&
+ notify_tabledef_changed(table_list))
+ goto rollback;
{
TR_table trt(thd, true);
@@ -7269,28 +7334,26 @@ static bool mysql_inplace_alter_table(THD *thd,
DEBUG_SYNC(thd, "alter_table_inplace_after_commit");
}
- /* Notify the engine that the table definition has changed */
+ /*
+ We are new ready to use the new table. Update the state in the
+ ddl log so that we recovery know that the new table is ready and
+ in case of crash it should use the new one and log the query
+ to the binary log.
+ */
+ ddl_log_update_phase(ddl_log_state, DDL_ALTER_TABLE_PHASE_INPLACE_COPIED);
+ debug_crash_here("ddl_log_alter_after_log");
- if (table->file->partition_ht()->notify_tabledef_changed)
+ if ((table->file->partition_ht()->flags &
+ HTON_REQUIRES_NOTIFY_TABLEDEF_CHANGED_AFTER_COMMIT) &&
+ notify_tabledef_changed(table_list))
{
- char db_buff[FN_REFLEN], table_buff[FN_REFLEN];
- handlerton *hton= table->file->ht;
- LEX_CSTRING tmp_db, tmp_table;
-
- tmp_db.str= db_buff;
- tmp_table.str= table_buff;
- tmp_db.length= tablename_to_filename(table_list->db.str,
- db_buff, sizeof(db_buff));
- tmp_table.length= tablename_to_filename(table_list->table_name.str,
- table_buff, sizeof(table_buff));
- if ((hton->notify_tabledef_changed)(hton, &tmp_db, &tmp_table,
- table->s->frm_image,
- &table->s->tabledef_version,
- table->file))
- {
- my_error(HA_ERR_INCOMPATIBLE_DEFINITION, MYF(0));
- DBUG_RETURN(true);
- }
+ /*
+ The above should never fail. If it failed, the new structure is
+ commited and we have no way to roll back.
+ The best we can do is to continue, but send an error to the
+ user that something when wrong
+ */
+ commit_succeded_with_error= 1;
}
close_all_tables_for_name(thd, table->s,
@@ -7303,7 +7366,8 @@ static bool mysql_inplace_alter_table(THD *thd,
/*
Replace the old .FRM with the new .FRM, but keep the old name for now.
Rename to the new name (if needed) will be handled separately below.
-
+ */
+ /*
TODO: remove this check of thd->is_error() (now it intercept
errors in some val_*() methods and bring some single place to
such error interception).
@@ -7316,6 +7380,7 @@ static bool mysql_inplace_alter_table(THD *thd,
// Since changes were done in-place, we can't revert them.
DBUG_RETURN(true);
}
+ debug_crash_here("ddl_log_alter_after_rename_frm");
// Rename altered table in case of ALTER TABLE ... RENAME
if (alter_ctx->is_table_renamed())
@@ -7331,6 +7396,7 @@ static bool mysql_inplace_alter_table(THD *thd,
*/
DBUG_RETURN(true);
}
+ debug_crash_here("ddl_log_alter_before_rename_triggers");
if (Table_triggers_list::change_table_name(thd, trigger_param,
&alter_ctx->db,
&alter_ctx->alias,
@@ -7346,13 +7412,15 @@ static bool mysql_inplace_alter_table(THD *thd,
&alter_ctx->new_db, &alter_ctx->new_alias,
&alter_ctx->db, &alter_ctx->alias,
NO_FK_CHECKS);
+ ddl_log_disable_entry(ddl_log_state);
DBUG_RETURN(true);
}
rename_table_in_stat_tables(thd, &alter_ctx->db, &alter_ctx->alias,
&alter_ctx->new_db, &alter_ctx->new_alias);
+ debug_crash_here("ddl_log_alter_after_rename_triggers");
}
- DBUG_RETURN(false);
+ DBUG_RETURN(commit_succeded_with_error);
rollback:
table->file->ha_commit_inplace_alter_table(altered_table,
@@ -8846,6 +8914,13 @@ simple_tmp_rename_or_index_change(THD *thd, TABLE_LIST *table_list,
@return Operation status
@retval false Success
@retval true Failure
+
+ @notes
+ Normally with ALTER TABLE we roll forward as soon as data is copied
+ or new table is committed. For an ALTER TABLE that only does a RENAME,
+ we will roll back unless the RENAME fully completes.
+ If we crash while using enable/disable keys, this may have completed
+ and will not be rolled back.
*/
static bool
@@ -8856,11 +8931,13 @@ simple_rename_or_index_change(THD *thd, TABLE_LIST *table_list,
{
TABLE *table= table_list->table;
MDL_ticket *mdl_ticket= table->mdl_ticket;
+ DDL_LOG_STATE ddl_log_state;
int error= 0;
enum ha_extra_function extra_func= thd->locked_tables_mode
? HA_EXTRA_NOT_USED
: HA_EXTRA_FORCE_REOPEN;
DBUG_ENTER("simple_rename_or_index_change");
+ bzero(&ddl_log_state, sizeof(ddl_log_state));
if (keys_onoff != Alter_info::LEAVE_AS_IS)
{
@@ -8895,37 +8972,52 @@ simple_rename_or_index_change(THD *thd, TABLE_LIST *table_list,
close_all_tables_for_name(thd, table->s, HA_EXTRA_PREPARE_FOR_RENAME,
NULL);
+ (void) ddl_log_rename_table(thd, &ddl_log_state, old_db_type,
+ &alter_ctx->db, &alter_ctx->table_name,
+ &alter_ctx->new_db, &alter_ctx->new_alias);
if (mysql_rename_table(old_db_type, &alter_ctx->db, &alter_ctx->table_name,
&alter_ctx->new_db, &alter_ctx->new_alias, 0))
error= -1;
- else if (Table_triggers_list::change_table_name(thd, trigger_param,
- &alter_ctx->db,
- &alter_ctx->alias,
- &alter_ctx->table_name,
- &alter_ctx->new_db,
- &alter_ctx->new_alias))
+ if (!error)
+ ddl_log_update_phase(&ddl_log_state, DDL_RENAME_PHASE_TRIGGER);
+ debug_crash_here("ddl_log_alter_before_rename_triggers");
+ if (!error &&
+ Table_triggers_list::change_table_name(thd, trigger_param,
+ &alter_ctx->db,
+ &alter_ctx->alias,
+ &alter_ctx->table_name,
+ &alter_ctx->new_db,
+ &alter_ctx->new_alias))
{
(void) mysql_rename_table(old_db_type,
&alter_ctx->new_db, &alter_ctx->new_alias,
&alter_ctx->db, &alter_ctx->table_name,
NO_FK_CHECKS);
+ ddl_log_disable_entry(&ddl_log_state);
error= -1;
}
- /* Update stat tables last. This is to be able to handle rename of a stat table */
+ /*
+ Update stat tables last. This is to be able to handle rename of
+ a stat table.
+ */
if (error == 0)
(void) rename_table_in_stat_tables(thd, &alter_ctx->db,
&alter_ctx->table_name,
&alter_ctx->new_db,
&alter_ctx->new_alias);
+ debug_crash_here("ddl_log_alter_after_rename_triggers");
}
if (likely(!error))
{
+ thd->binlog_xid= thd->query_id;
+ ddl_log_update_xid(&ddl_log_state, thd->binlog_xid);
error= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
-
+ thd->binlog_xid= 0;
if (likely(!error))
my_ok(thd);
}
+ ddl_log_complete(&ddl_log_state);
table_list->table= NULL; // For query cache
query_cache_invalidate3(thd, table_list, 0);
@@ -9054,6 +9146,8 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
bool engine_changed, error, frm_is_created= false;
bool no_ha_table= true; /* We have not created table in storage engine yet */
TABLE *table, *new_table;
+ DDL_LOG_STATE ddl_log_state;
+
#ifdef WITH_PARTITION_STORAGE_ENGINE
bool partition_changed= false;
bool fast_alter_partition= false;
@@ -9076,14 +9170,24 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
bool varchar= create_info->varchar, table_creation_was_logged= 0;
bool binlog_as_create_select= 0, log_if_exists= 0;
uint tables_opened;
- handlerton *new_db_type, *old_db_type;
+ handlerton *new_db_type, *old_db_type= nullptr;
ha_rows copied=0, deleted=0;
LEX_CUSTRING frm= {0,0};
- char index_file[FN_REFLEN], data_file[FN_REFLEN];
+ LEX_CSTRING backup_name;
+ char index_file[FN_REFLEN], data_file[FN_REFLEN], backup_name_buff[60];
+ uchar uuid_buffer[MY_UUID_SIZE];
MDL_request target_mdl_request;
MDL_ticket *mdl_ticket= 0;
Alter_table_prelocking_strategy alter_prelocking_strategy;
TRIGGER_RENAME_PARAM trigger_param;
+
+ /*
+ Callback function that an engine can request to be called after executing
+ inplace alter table.
+ */
+ Alter_inplace_info::inplace_alter_table_commit_callback
+ *inplace_alter_table_committed= 0;
+ void *inplace_alter_table_committed_argument= 0;
DBUG_ENTER("mysql_alter_table");
/*
@@ -9128,6 +9232,13 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
}
THD_STAGE_INFO(thd, stage_init_update);
+ bzero(&ddl_log_state, sizeof(ddl_log_state));
+
+ /* Temporary name for backup of original table */
+ backup_name.str= backup_name_buff;
+ backup_name.length= my_snprintf(backup_name_buff, sizeof(backup_name_buff)-1,
+ "%s-backup-%lx-%llx", tmp_file_prefix,
+ current_pid, thd->thread_id);
/* Check if the new table type is a shared table */
if (ha_check_if_updates_are_ignored(thd, create_info->db_type, "ALTER"))
@@ -9752,9 +9863,47 @@ do_continue:;
DEBUG_SYNC(thd, "alter_table_before_create_table_no_lock");
+ /* Create a new table version id for the new table */
+ my_uuid(uuid_buffer);
+ create_info->tabledef_version.str= uuid_buffer;
+ create_info->tabledef_version.length= MY_UUID_SIZE;
+
+ if (!table->s->tmp_table)
+ {
+ LEX_CSTRING path_to_frm= alter_ctx.get_tmp_cstring_path();
+ LEX_CSTRING tmp_table= backup_name;
+ if (alter_ctx.is_table_renamed())
+ tmp_table= alter_ctx.new_alias;
+
+ if (ddl_log_alter_table(thd, &ddl_log_state,
+ old_db_type,
+ &alter_ctx.db, &alter_ctx.table_name,
+ new_db_type,
+ table->file->partition_ht(),
+ &alter_ctx.new_db, &alter_ctx.tmp_name,
+ &path_to_frm,
+ &tmp_table,
+ &create_info->tabledef_version,
+ table->file->table_version(),
+ alter_ctx.is_table_renamed()) ||
+ ddl_log_store_query(thd, &ddl_log_state,
+ thd->query(), thd->query_length()))
+ {
+ error= 1;
+ goto err_cleanup;
+ }
+ }
+
tmp_disable_binlog(thd);
create_info->options|=HA_CREATE_TMP_ALTER;
create_info->alias= alter_ctx.table_name;
+ /*
+ Create the .frm file for the new table. Storage engine table will not be
+ created at this stage.
+
+ No ddl logging needed as ddl_log_alter_query will take care of failed
+ table creations.
+ */
error= create_table_impl(thd, (DDL_LOG_STATE*) 0, (DDL_LOG_STATE*) 0,
alter_ctx.db, alter_ctx.table_name,
alter_ctx.new_db, alter_ctx.tmp_name,
@@ -9763,11 +9912,11 @@ do_continue:;
C_ALTER_TABLE_FRM_ONLY, NULL,
&key_info, &key_count, &frm);
reenable_binlog(thd);
+
+ debug_crash_here("ddl_log_alter_after_create_frm");
+
if (unlikely(error))
- {
- my_free(const_cast<uchar*>(frm.str));
- DBUG_RETURN(true);
- }
+ goto err_cleanup;
if (alter_info->algorithm(thd) != Alter_info::ALTER_TABLE_ALGORITHM_COPY)
{
@@ -9809,7 +9958,6 @@ do_continue:;
*/
table->file->ha_create_partitioning_metadata(alter_ctx.get_tmp_path(),
NULL, CHF_DELETE_FLAG);
- my_free(const_cast<uchar*>(frm.str));
goto end_inplace;
}
@@ -9894,19 +10042,19 @@ do_continue:;
*/
enum_check_fields org_count_cuted_fields= thd->count_cuted_fields;
thd->count_cuted_fields= CHECK_FIELD_WARN;
- int res= mysql_inplace_alter_table(thd,
- table_list, table, &altered_table,
+ int res= mysql_inplace_alter_table(thd, table_list, table, &altered_table,
&ha_alter_info,
- &target_mdl_request,
+ &target_mdl_request, &ddl_log_state,
&trigger_param,
&alter_ctx);
thd->count_cuted_fields= org_count_cuted_fields;
- my_free(const_cast<uchar*>(frm.str));
-
+ inplace_alter_table_committed= ha_alter_info.inplace_alter_table_committed;
+ inplace_alter_table_committed_argument=
+ ha_alter_info.inplace_alter_table_committed_argument;
if (res)
{
cleanup_table_after_inplace_alter(&altered_table);
- DBUG_RETURN(true);
+ goto err_cleanup;
}
cleanup_table_after_inplace_alter_keep_files(&altered_table);
@@ -9958,11 +10106,15 @@ do_continue:;
MYSQL_LOCK_USE_MALLOC))
goto err_new_table_cleanup;
+ ddl_log_update_phase(&ddl_log_state, DDL_ALTER_TABLE_PHASE_CREATED);
+
if (ha_create_table(thd, alter_ctx.get_tmp_path(),
alter_ctx.new_db.str, alter_ctx.new_name.str,
create_info, &frm, frm_is_created))
goto err_new_table_cleanup;
+ debug_crash_here("ddl_log_alter_after_create_table");
+
/* Mark that we have created table in storage engine. */
no_ha_table= false;
DEBUG_SYNC(thd, "alter_table_intermediate_table_created");
@@ -10107,10 +10259,16 @@ do_continue:;
/* We don't replicate alter table statement on temporary tables */
if (!thd->is_current_stmt_binlog_format_row() &&
table_creation_was_logged &&
- !binlog_as_create_select &&
- write_bin_log_with_if_exists(thd, true, false, log_if_exists))
- DBUG_RETURN(true);
- my_free(const_cast<uchar*>(frm.str));
+ !binlog_as_create_select)
+ {
+ int tmp_error;
+ thd->binlog_xid= thd->query_id;
+ ddl_log_update_xid(&ddl_log_state, thd->binlog_xid);
+ tmp_error= write_bin_log_with_if_exists(thd, true, false, log_if_exists);
+ thd->binlog_xid= 0;
+ if (tmp_error)
+ goto err_cleanup;
+ }
goto end_temporary;
}
@@ -10157,6 +10315,18 @@ do_continue:;
(mysql_execute_command()) to release metadata locks.
*/
+ debug_crash_here("ddl_log_alter_after_copy"); // Use old table
+ /*
+ We are new ready to use the new table. Update the state in the
+ ddl log so that we recovery know that the new table is ready and
+ in case of crash it should use the new one and log the query
+ to the binary log.
+ */
+ if (engine_changed)
+ ddl_log_add_flag(&ddl_log_state, DDL_LOG_FLAG_ALTER_ENGINE_CHANGED);
+ ddl_log_update_phase(&ddl_log_state, DDL_ALTER_TABLE_PHASE_COPIED);
+ debug_crash_here("ddl_log_alter_after_log"); // Use new table
+
THD_STAGE_INFO(thd, stage_rename_result_table);
if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME))
@@ -10168,29 +10338,20 @@ do_continue:;
HA_EXTRA_NOT_USED,
NULL);
table_list->table= table= NULL; /* Safety */
- my_free(const_cast<uchar*>(frm.str));
-
- /*
- Rename the old table to temporary name to have a backup in case
- anything goes wrong while renaming the new table.
- We only have to do this if name of the table is not changed.
- If we are changing to use another table handler, we don't
- have to do the rename as the table names will not interfer.
- */
- char backup_name_buff[FN_LEN];
- LEX_CSTRING backup_name;
- backup_name.str= backup_name_buff;
DBUG_PRINT("info", ("is_table_renamed: %d engine_changed: %d",
alter_ctx.is_table_renamed(), engine_changed));
if (!alter_ctx.is_table_renamed())
{
- backup_name.length= my_snprintf(backup_name_buff, sizeof(backup_name_buff),
- "%s-backup-%lx-%llx", tmp_file_prefix,
- current_pid, thd->thread_id);
- if (lower_case_table_names)
- my_casedn_str(files_charset_info, backup_name_buff);
+ /*
+ Rename the old table to temporary name to have a backup in case
+ anything goes wrong while renaming the new table.
+
+ We only have to do this if name of the table is not changed.
+ If we are changing to use another table handler, we don't
+ have to do the rename as the table names will not interfer.
+ */
if (mysql_rename_table(old_db_type, &alter_ctx.db, &alter_ctx.table_name,
&alter_ctx.db, &backup_name,
FN_TO_IS_TMP |
@@ -10209,6 +10370,18 @@ do_continue:;
PSI_CALL_drop_table_share(0, alter_ctx.db.str, (int) alter_ctx.db.length,
alter_ctx.table_name.str, (int) alter_ctx.table_name.length);
}
+ debug_crash_here("ddl_log_alter_after_rename_to_backup");
+
+ if (!alter_ctx.is_table_renamed())
+ {
+ /*
+ We should not set this stage in case of rename as we in this case
+ must execute DDL_ALTER_TABLE_PHASE_COPIED to remove the orignal table
+ */
+ ddl_log_update_phase(&ddl_log_state, DDL_ALTER_TABLE_PHASE_OLD_RENAMED);
+ }
+
+ debug_crash_here("ddl_log_alter_after_rename_to_backup_log");
// Rename the new table to the correct name.
if (mysql_rename_table(new_db_type, &alter_ctx.new_db, &alter_ctx.tmp_name,
@@ -10216,6 +10389,7 @@ do_continue:;
FN_FROM_IS_TMP))
{
// Rename failed, delete the temporary table.
+ ddl_log_update_phase(&ddl_log_state, DDL_ALTER_TABLE_PHASE_RENAME_FAILED);
(void) quick_rm_table(thd, new_db_type, &alter_ctx.new_db,
&alter_ctx.tmp_name, FN_IS_TMP);
@@ -10230,10 +10404,12 @@ do_continue:;
}
goto err_with_mdl;
}
+ debug_crash_here("ddl_log_alter_after_rename_to_original");
// Check if we renamed the table and if so update trigger files.
if (alter_ctx.is_table_renamed())
{
+ debug_crash_here("ddl_log_alter_before_rename_triggers");
if (Table_triggers_list::change_table_name(thd, &trigger_param,
&alter_ctx.db,
&alter_ctx.alias,
@@ -10254,12 +10430,15 @@ do_continue:;
}
rename_table_in_stat_tables(thd, &alter_ctx.db, &alter_ctx.alias,
&alter_ctx.new_db, &alter_ctx.new_alias);
+ debug_crash_here("ddl_log_alter_after_rename_triggers");
}
// ALTER TABLE succeeded, delete the backup of the old table.
error= 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)
{
/* the .frm file was removed but not the original table */
@@ -10268,6 +10447,7 @@ do_continue:;
NO_FRM_RENAME |
(engine_changed ? 0 : FN_IS_TMP));
}
+ debug_crash_here("ddl_log_alter_after_drop_original_table");
if (binlog_as_create_select)
{
/*
@@ -10275,7 +10455,10 @@ do_continue:;
DROP + CREATE + data statement to the binary log
*/
thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF;
+ thd->binlog_xid= thd->query_id;
+ ddl_log_update_xid(&ddl_log_state, thd->binlog_xid);
binlog_hton->commit(binlog_hton, thd, 1);
+ thd->binlog_xid= 0;
}
if (error)
@@ -10295,7 +10478,6 @@ end_inplace:
goto err_with_mdl_after_alter;
THD_STAGE_INFO(thd, stage_end);
-
DEBUG_SYNC(thd, "alter_table_before_main_binlog");
DBUG_ASSERT(!(mysql_bin_log.is_open() &&
@@ -10303,9 +10485,27 @@ end_inplace:
(create_info->tmp_table())));
if (!binlog_as_create_select)
{
- if (write_bin_log_with_if_exists(thd, true, false, log_if_exists))
- DBUG_RETURN(true);
+ int tmp_error;
+ thd->binlog_xid= thd->query_id;
+ ddl_log_update_xid(&ddl_log_state, thd->binlog_xid);
+ tmp_error= write_bin_log_with_if_exists(thd, true, false, log_if_exists);
+ thd->binlog_xid= 0;
+ if (tmp_error)
+ goto err_cleanup;
}
+
+ /*
+ We have to close the ddl log as soon as possible, after binlogging the
+ query, for inplace alter table.
+ */
+ ddl_log_complete(&ddl_log_state);
+ if (inplace_alter_table_committed)
+ {
+ /* Signal to storage engine that ddl log is committed */
+ (*inplace_alter_table_committed)(inplace_alter_table_committed_argument);
+ inplace_alter_table_committed= 0;
+ }
+
table_list->table= NULL; // For query cache
query_cache_invalidate3(thd, table_list, false);
@@ -10319,6 +10519,8 @@ end_inplace:
}
end_temporary:
+ my_free(const_cast<uchar*>(frm.str));
+
thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF;
my_snprintf(alter_ctx.tmp_buff, sizeof(alter_ctx.tmp_buff),
@@ -10333,7 +10535,6 @@ err_new_table_cleanup:
DBUG_PRINT("error", ("err_new_table_cleanup"));
thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF;
- my_free(const_cast<uchar*>(frm.str));
/*
No default value was provided for a DATE/DATETIME field, the
current sql_mode doesn't allow the '0000-00-00' value and
@@ -10358,6 +10559,14 @@ err_new_table_cleanup:
(FN_IS_TMP | (no_ha_table ? NO_HA_TABLE : 0)),
alter_ctx.get_tmp_path());
+err_cleanup:
+ my_free(const_cast<uchar*>(frm.str));
+ ddl_log_complete(&ddl_log_state);
+ if (inplace_alter_table_committed)
+ {
+ /* Signal to storage engine that ddl log is committed */
+ (*inplace_alter_table_committed)(inplace_alter_table_committed_argument);
+ }
DBUG_RETURN(true);
err_with_mdl_after_alter:
@@ -10374,6 +10583,7 @@ err_with_mdl_after_alter:
write_bin_log_with_if_exists(thd, FALSE, FALSE, log_if_exists);
err_with_mdl:
+ ddl_log_complete(&ddl_log_state);
/*
An error happened while we were holding exclusive name metadata lock
on table being altered. To be safe under LOCK TABLES we should
@@ -10383,7 +10593,7 @@ err_with_mdl:
thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0);
if (!table_list->table)
thd->mdl_context.release_all_locks_for_name(mdl_ticket);
- DBUG_RETURN(true);
+ goto err_cleanup;
}
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index 0b1c39e145e..cf5c6d5014f 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -1405,13 +1405,15 @@ dict_create_or_check_foreign_constraint_tables(void)
"PROCEDURE CREATE_GARBAGE_TABLE_PROC () IS\n"
"BEGIN\n"
"CREATE TABLE\n"
- "\"test/#sql-ib-garbage\"(ID CHAR);\n"
- "CREATE UNIQUE CLUSTERED INDEX PRIMARY"
- " ON \"test/#sql-ib-garbage\"(ID);\n"
+ "\"test/" TEMP_FILE_PREFIX_INNODB "-garbage\""
+ "(ID CHAR);\n"
+ "CREATE UNIQUE CLUSTERED INDEX PRIMARY ON "
+ "\"test/" TEMP_FILE_PREFIX_INNODB "-garbage\"(ID);\n"
"END;\n", FALSE, trx);
ut_ad(err == DB_SUCCESS);
- row_drop_table_for_mysql("test/#sql-ib-garbage", trx,
- SQLCOM_DROP_DB, true););
+ row_drop_table_for_mysql("test/"
+ TEMP_FILE_PREFIX_INNODB "-garbage",
+ trx, SQLCOM_DROP_DB, true););
ib::info() << "Creating foreign key constraint system tables.";
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index be43f56320b..66181b0cb7d 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -716,9 +716,7 @@ bool dict_table_t::parse_name(char (&db_name)[NAME_LEN + 1],
db_buf[db_len]= 0;
size_t tbl_len= strlen(name.m_name + db_len + 1);
-
- const bool is_temp= tbl_len > TEMP_FILE_PREFIX_LENGTH &&
- !strncmp(name.m_name, TEMP_FILE_PREFIX, TEMP_FILE_PREFIX_LENGTH);
+ const bool is_temp= name.is_temporary();
if (is_temp);
else if (const char *is_part= static_cast<const char*>
@@ -1714,15 +1712,13 @@ dict_table_rename_in_cache(
to store foreign key constraint name in charset
my_charset_filename for comparison further below. */
char fkid[MAX_TABLE_NAME_LEN+20];
- ibool on_tmp = FALSE;
/* The old table name in my_charset_filename is stored
in old_name_cs_filename */
strcpy(old_name_cs_filename, old_name);
old_name_cs_filename[MAX_FULL_NAME_LEN] = '\0';
- if (strstr(old_name, TEMP_TABLE_PATH_PREFIX) == NULL) {
-
+ if (!dict_table_t::is_temporary_name(old_name)) {
innobase_convert_to_system_charset(
strchr(old_name_cs_filename, '/') + 1,
strchr(old_name, '/') + 1,
@@ -1749,13 +1745,14 @@ dict_table_rename_in_cache(
strncpy(fkid, foreign->id, MAX_TABLE_NAME_LEN);
- if (strstr(fkid, TEMP_TABLE_PATH_PREFIX) == NULL) {
+ const bool on_tmp = dict_table_t::is_temporary_name(
+ fkid);
+
+ if (!on_tmp) {
innobase_convert_to_filename_charset(
strchr(fkid, '/') + 1,
strchr(foreign->id, '/') + 1,
MAX_TABLE_NAME_LEN+20);
- } else {
- on_tmp = TRUE;
}
old_id = mem_strdup(foreign->id);
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 27583f87cfd..040f9bef079 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -946,7 +946,7 @@ next:
continue;
}
- if (strstr(table_name.m_name, "/" TEMP_FILE_PREFIX "-")) {
+ if (strstr(table_name.m_name, "/" TEMP_FILE_PREFIX_INNODB)) {
/* This table will be dropped by
row_mysql_drop_garbage_tables().
We do not care if the file exists. */
@@ -1097,11 +1097,14 @@ err_len:
pos = mach_read_from_4(field);
- rec_get_nth_field_offs_old(
+ field = rec_get_nth_field_old(
rec, DICT_FLD__SYS_COLUMNS__DB_TRX_ID, &len);
if (len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL) {
goto err_len;
}
+
+ const trx_id_t trx_id = mach_read_from_6(field);
+
rec_get_nth_field_offs_old(
rec, DICT_FLD__SYS_COLUMNS__DB_ROLL_PTR, &len);
if (len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL) {
@@ -1188,6 +1191,10 @@ err_len:
dict_mem_table_add_col(table, heap, name, mtype,
prtype, col_len);
}
+
+ if (trx_id > table->def_trx_id) {
+ table->def_trx_id = trx_id;
+ }
} else {
dict_mem_fill_column_struct(column, pos, mtype,
prtype, col_len);
@@ -1754,10 +1761,6 @@ dict_load_index_low(
*index = NULL;
}
- if (rec_get_deleted_flag(rec, 0)) {
- return(dict_load_index_del);
- }
-
if (rec_get_n_fields_old(rec) == DICT_NUM_FIELDS__SYS_INDEXES) {
/* MERGE_THRESHOLD exists */
field = rec_get_nth_field_old(
@@ -1819,9 +1822,10 @@ err_len:
field = rec_get_nth_field_old(
rec, DICT_FLD__SYS_INDEXES__NAME, &name_len);
- if (name_len == UNIV_SQL_NULL) {
+ if (name_len == 0 || name_len == UNIV_SQL_NULL) {
goto err_len;
}
+ ut_ad(field == &rec[8 + 8 + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN]);
name_buf = mem_heap_strdupl(heap, (const char*) field,
name_len);
@@ -1849,6 +1853,10 @@ err_len:
goto err_len;
}
+ if (rec_get_deleted_flag(rec, 0)) {
+ return(dict_load_index_del);
+ }
+
if (allocate) {
*index = dict_mem_index_create(NULL, name_buf, type, n_fields);
} else {
@@ -1976,8 +1984,7 @@ dict_load_indexes(
ib::warn() << "Failed to load the"
" clustered index for table "
<< table->name
- << " because of the following error: "
- << err_msg << "."
+ << " because of TABLE_ID mismatch."
" Refusing to load the rest of the"
" indexes (if any) and the whole table"
" altogether.";
@@ -1986,8 +1993,13 @@ dict_load_indexes(
}
break;
- } else if (err_msg == dict_load_index_del) {
- /* Skip delete-marked records. */
+ }
+
+ if (err_msg == dict_load_index_del) {
+ const trx_id_t id = mach_read_from_6(rec + 8 + 8);
+ if (id > table->def_trx_id) {
+ table->def_trx_id = id;
+ }
goto next_rec;
} else if (err_msg) {
ib::error() << err_msg;
@@ -1999,6 +2011,11 @@ dict_load_indexes(
} else if (rec[8 + 8 + DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN]
== static_cast<byte>(*TEMP_INDEX_PREFIX_STR)) {
goto next_rec;
+ } else {
+ const trx_id_t id = mach_read_from_6(rec + 8 + 8);
+ if (id > table->def_trx_id) {
+ table->def_trx_id = id;
+ }
}
ut_ad(index);
@@ -2172,6 +2189,12 @@ static const char* dict_load_table_low(const table_name_t& name,
(*table)->id = table_id;
(*table)->file_unreadable = !!(flags2 & DICT_TF2_DISCARDED);
+ ulint len;
+ (*table)->def_trx_id = mach_read_from_6(
+ rec_get_nth_field_old(rec, DICT_FLD__SYS_TABLES__DB_TRX_ID,
+ &len));
+ ut_ad(len == DATA_TRX_ID_LEN);
+ static_assert(DATA_TRX_ID_LEN == 6, "compatibility");
return(NULL);
}
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index b489dfd17bd..7f0c15614f0 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -1125,7 +1125,7 @@ dict_mem_create_temporary_tablename(
ut_ad(dbend);
size_t dblen = size_t(dbend - dbtab) + 1;
- size = dblen + (sizeof(TEMP_FILE_PREFIX) + 3 + 20);
+ size = dblen + (sizeof(TEMP_FILE_PREFIX_INNODB) + 20);
name = static_cast<char*>(mem_heap_alloc(heap, size));
memcpy(name, dbtab, dblen);
snprintf(name + dblen, size - dblen,
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index f1843711c0c..89f6f7c1689 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -108,9 +108,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "srv0mon.h"
#include "srv0start.h"
#include "rem0rec.h"
-#ifdef UNIV_DEBUG
#include "trx0purge.h"
-#endif /* UNIV_DEBUG */
#include "trx0roll.h"
#include "trx0rseg.h"
#include "trx0trx.h"
@@ -1916,6 +1914,59 @@ static void wsrep_abort_transaction(handlerton*, THD *, THD *, my_bool);
static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid);
static int innobase_wsrep_get_checkpoint(handlerton* hton, XID* xid);
#endif /* WITH_WSREP */
+
+ulonglong ha_innobase::table_version() const
+{
+ /* This is either "garbage" or something that was assigned
+ on a successful ha_innobase::prepare_inplace_alter_table(). */
+ return m_prebuilt->trx_id;
+}
+
+#ifdef UNIV_DEBUG
+/** whether the DDL log recovery has been completed */
+static bool ddl_recovery_done;
+#endif
+
+static int innodb_check_version(handlerton *hton, const char *path,
+ const LEX_CUSTRING *version,
+ ulonglong create_id)
+{
+ DBUG_ENTER("innodb_check_version");
+ DBUG_ASSERT(hton == innodb_hton_ptr);
+ ut_ad(!ddl_recovery_done);
+
+ if (!create_id)
+ DBUG_RETURN(0);
+
+ char norm_path[FN_REFLEN];
+ normalize_table_name(norm_path, path);
+
+ if (dict_table_t *table= dict_table_open_on_name(norm_path, false, false,
+ DICT_ERR_IGNORE_NONE))
+ {
+ const trx_id_t trx_id= table->def_trx_id;
+ DBUG_ASSERT(trx_id <= create_id);
+ dict_table_close(table, false, false);
+ DBUG_PRINT("info", ("create_id: %llu trx_id: %llu", create_id, trx_id));
+ DBUG_RETURN(create_id != trx_id);
+ }
+ else
+ DBUG_RETURN(2);
+}
+
+static void innodb_ddl_recovery_done(handlerton*)
+{
+ ut_ad(!ddl_recovery_done);
+ ut_d(ddl_recovery_done= true);
+ if (!srv_read_only_mode && srv_operation == SRV_OPERATION_NORMAL &&
+ srv_force_recovery < SRV_FORCE_NO_BACKGROUND)
+ {
+ srv_init_purge_tasks();
+ purge_sys.coordinator_startup();
+ srv_wake_purge_thread_if_not_active();
+ }
+}
+
/********************************************************************//**
Converts an InnoDB error code to a MySQL error code and also tells to MySQL
about a possible transaction rollback inside InnoDB caused by a lock wait
@@ -3950,7 +4001,8 @@ static int innodb_init(void* p)
HTON_SUPPORTS_EXTENDED_KEYS | HTON_SUPPORTS_FOREIGN_KEYS |
HTON_NATIVE_SYS_VERSIONING |
HTON_WSREP_REPLICATION |
- HTON_REQUIRES_CLOSE_AFTER_TRUNCATE;
+ HTON_REQUIRES_CLOSE_AFTER_TRUNCATE |
+ HTON_REQUIRES_NOTIFY_TABLEDEF_CHANGED_AFTER_COMMIT;
#ifdef WITH_WSREP
innobase_hton->abort_transaction=wsrep_abort_transaction;
@@ -3958,6 +4010,9 @@ static int innodb_init(void* p)
innobase_hton->get_checkpoint=innobase_wsrep_get_checkpoint;
#endif /* WITH_WSREP */
+ innobase_hton->check_version = innodb_check_version;
+ innobase_hton->signal_ddl_recovery_done = innodb_ddl_recovery_done;
+
innobase_hton->tablefile_extensions = ha_innobase_exts;
innobase_hton->table_options = innodb_table_option_list;
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 791b5c8ac88..1b50069bbc7 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -59,6 +59,10 @@ public:
ha_innobase(handlerton* hton, TABLE_SHARE* table_arg);
~ha_innobase() override;
+ /** @return the transaction that last modified the table definition
+ @see dict_table_t::def_trx_id */
+ ulonglong table_version() const override;
+
/** Get the row type from the storage engine. If this method returns
ROW_TYPE_NOT_USED, the information in HA_CREATE_INFO should be used. */
enum row_type get_row_type() const override;
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 62388c2adf6..8583a084c94 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -46,6 +46,7 @@ Smart ALTER TABLE
#include "row0row.h"
#include "row0upd.h"
#include "trx0trx.h"
+#include "trx0purge.h"
#include "handler0alter.h"
#include "srv0mon.h"
#include "srv0srv.h"
@@ -8107,6 +8108,15 @@ err_exit:
DBUG_RETURN(true);
}
+success:
+ /* Memorize the future transaction ID for committing
+ the data dictionary change, to be reported by
+ ha_innobase::table_version(). */
+ m_prebuilt->trx_id = (ha_alter_info->handler_flags
+ & ~INNOBASE_INPLACE_IGNORE)
+ ? static_cast<ha_innobase_inplace_ctx*>
+ (ha_alter_info->handler_ctx)->trx->id
+ : 0;
DBUG_RETURN(false);
}
@@ -8210,12 +8220,16 @@ found_col:
ha_alter_info->ignore || !thd_is_strict_mode(m_user_thd),
alt_opt.page_compressed, alt_opt.page_compression_level);
- DBUG_RETURN(prepare_inplace_alter_table_dict(
- ha_alter_info, altered_table, table,
- table_share->table_name.str,
- info.flags(), info.flags2(),
- fts_doc_col_no, add_fts_doc_id,
- add_fts_doc_id_idx));
+ if (!prepare_inplace_alter_table_dict(
+ ha_alter_info, altered_table, table,
+ table_share->table_name.str,
+ info.flags(), info.flags2(),
+ fts_doc_col_no, add_fts_doc_id,
+ add_fts_doc_id_idx)) {
+ goto success;
+ }
+
+ DBUG_RETURN(true);
}
/** Check that the column is part of a virtual index(index contains
@@ -8826,6 +8840,7 @@ func_exit:
}
trx_commit_for_mysql(prebuilt->trx);
+ prebuilt->trx_id = 0;
MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE);
DBUG_RETURN(fail);
}
@@ -11106,6 +11121,9 @@ ha_innobase::commit_inplace_alter_table(
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
ut_ad(!new_clustered || trx->has_logged());
+ ha_alter_info->inplace_alter_table_committed =
+ purge_sys.resume_SYS;
+ purge_sys.stop_SYS();
trx->commit();
log_write_up_to(trx->commit_lsn, true);
DBUG_EXECUTE_IF("innodb_alter_commit_crash_after_commit",
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index c6071e43f73..71554e116eb 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -1866,7 +1866,7 @@ struct dict_table_t {
which denotes temporary or intermediate tables in MariaDB. */
static bool is_temporary_name(const char* name)
{
- return strstr(name, "/" TEMP_FILE_PREFIX) != NULL;
+ return strstr(name, "/#sql");
}
/** @return whether instant ALTER TABLE is in effect */
@@ -2218,15 +2218,17 @@ public:
foreign key checks running on it. */
Atomic_counter<int32_t> n_foreign_key_checks_running;
- /** Transaction id that last touched the table definition. Either when
- loading the definition or CREATE TABLE, or ALTER TABLE (prepare,
- commit, and rollback phases). */
- trx_id_t def_trx_id;
- /** Last transaction that inserted into an empty table.
- Updated while holding exclusive table lock and an exclusive
- latch on the clustered index root page (which must also be
- an empty leaf page), and an ahi_latch (if btr_search_enabled). */
- Atomic_relaxed<trx_id_t> bulk_trx_id;
+ /** DDL transaction that last touched the table definition, or 0 if
+ no history is available. This includes possible changes in
+ ha_innobase::prepare_inplace_alter_table() and
+ ha_innobase::commit_inplace_alter_table(). */
+ trx_id_t def_trx_id;
+
+ /** Last transaction that inserted into an empty table.
+ Updated while holding exclusive table lock and an exclusive
+ latch on the clustered index root page (which must also be
+ an empty leaf page), and an ahi_latch (if btr_search_enabled). */
+ Atomic_relaxed<trx_id_t> bulk_trx_id;
/*!< set of foreign key constraints in the table; these refer to
columns in other tables */
@@ -2406,9 +2408,9 @@ public:
/** Timestamp of the last modification of this table. */
Atomic_relaxed<time_t> update_time;
/** Transactions whose view low limit is greater than this number are
- not allowed to store to the query cache or retrieve from it.
- When a trx with undo logs commits, it sets this to the value of the
- transaction id. */
+ not allowed to access the MariaDB query cache.
+ @see innobase_query_caching_table_check_low()
+ @see trx_t::commit_tables() */
Atomic_relaxed<trx_id_t> query_cache_inv_trx_id;
#ifdef UNIV_DEBUG
diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h
index 6db0f3ba65b..24bc84d776c 100644
--- a/storage/innobase/include/dict0types.h
+++ b/storage/innobase/include/dict0types.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2019, MariaDB Corporation.
+Copyright (c) 2013, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -90,14 +90,9 @@ enum ib_quiesce_t {
QUIESCE_COMPLETE /*!< All done */
};
-/** Prefix for tmp tables, adopted from sql/table.h */
-#define TEMP_FILE_PREFIX "#sql"
-#define TEMP_FILE_PREFIX_LENGTH 4
+/** Prefix for InnoDB internal tables, adopted from sql/table.h */
#define TEMP_FILE_PREFIX_INNODB "#sql-ib"
-#define TEMP_TABLE_PREFIX "#sql"
-#define TEMP_TABLE_PATH_PREFIX "/" TEMP_TABLE_PREFIX
-
/** Table name wrapper for pretty-printing */
struct table_name_t
{
diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h
index fd9ccfd386e..db11f882968 100644
--- a/storage/innobase/include/trx0purge.h
+++ b/storage/innobase/include/trx0purge.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2020, MariaDB Corporation.
+Copyright (c) 2017, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -127,15 +127,17 @@ private:
class purge_sys_t
{
public:
- /** latch protecting view, m_enabled */
- MY_ALIGNED(CACHE_LINE_SIZE) mutable srw_lock latch;
+ /** latch protecting view, m_enabled */
+ MY_ALIGNED(CACHE_LINE_SIZE) mutable srw_lock latch;
private:
- /** The purge will not remove undo logs which are >= this view */
- ReadViewBase view;
- /** whether purge is enabled; protected by latch and std::atomic */
- std::atomic<bool> m_enabled;
- /** number of pending stop() calls without resume() */
- Atomic_counter<int32_t> m_paused;
+ /** The purge will not remove undo logs which are >= this view */
+ ReadViewBase view;
+ /** whether purge is enabled; protected by latch and std::atomic */
+ std::atomic<bool> m_enabled;
+ /** number of pending stop() calls without resume() */
+ Atomic_counter<uint32_t> m_paused;
+ /** number of stop_SYS() calls without resume_SYS() */
+ Atomic_counter<uint32_t> m_SYS_paused;
public:
que_t* query; /*!< The query graph which will do the
parallelized purge operation */
@@ -245,6 +247,19 @@ public:
void stop();
/** Resume purge at UNLOCK TABLES after FLUSH TABLES FOR EXPORT */
void resume();
+
+private:
+ void wait_SYS();
+public:
+ /** Suspend purge in data dictionary tables */
+ void stop_SYS();
+ /** Resume purge in data dictionary tables */
+ static void resume_SYS(void *);
+ /** @return whether stop_SYS() is in effect */
+ bool must_wait_SYS() const { return m_SYS_paused; }
+ /** check stop_SYS() */
+ void check_stop_SYS() { if (must_wait_SYS()) wait_SYS(); }
+
/** A wrapper around ReadView::changes_visible(). */
bool changes_visible(trx_id_t id, const table_name_t &name) const
{
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index 1ddd6fe1996..813afd4763a 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -903,8 +903,9 @@ public:
inline void release_locks();
/** Evict a table definition due to the rollback of ALTER TABLE.
- @param[in] table_id table identifier */
- void evict_table(table_id_t table_id);
+ @param table_id table identifier
+ @param reset_only whether to only reset dict_table_t::def_trx_id */
+ void evict_table(table_id_t table_id, bool reset_only= false);
/** Initiate rollback.
@param savept savepoint to which to roll back
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 933a0d6987c..12ec2e29bfb 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -3491,10 +3491,12 @@ static
dberr_t
recv_init_missing_space(dberr_t err, const recv_spaces_t::const_iterator& i)
{
- if (srv_operation == SRV_OPERATION_RESTORE
- || srv_operation == SRV_OPERATION_RESTORE_EXPORT) {
- if (i->second.name.find(TEMP_TABLE_PATH_PREFIX)
- != std::string::npos) {
+ switch (srv_operation) {
+ default:
+ break;
+ case SRV_OPERATION_RESTORE:
+ case SRV_OPERATION_RESTORE_EXPORT:
+ if (i->second.name.find("/#sql") != std::string::npos) {
ib::warn() << "Tablespace " << i->first << " was not"
" found at " << i->second.name << " when"
" restoring a (partial?) backup. All redo log"
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index efcc6ca0ef9..debde448162 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -2669,10 +2669,7 @@ row_mysql_drop_garbage_tables()
table_name = mem_heap_strdupl(
heap,
reinterpret_cast<const char*>(field), len);
- if (strstr(table_name, "/" TEMP_FILE_PREFIX "-") &&
- !strstr(table_name, "/" TEMP_FILE_PREFIX "-backup-") &&
- !strstr(table_name, "/" TEMP_FILE_PREFIX "-exchange-"))
- {
+ if (strstr(table_name, "/" TEMP_FILE_PREFIX_INNODB)) {
btr_pcur_store_position(&pcur, &mtr);
btr_pcur_commit_specify_mtr(&pcur, &mtr);
@@ -3269,7 +3266,7 @@ row_drop_table_for_mysql(
pfs_os_file_t detached_handle = OS_FILE_CLOSED;
const bool is_temp_name = strstr(table->name.m_name,
- "/" TEMP_FILE_PREFIX);
+ "/" TEMP_FILE_PREFIX_INNODB);
if (table->is_temporary()) {
ut_ad(table->space == fil_system.temp_space);
@@ -3402,15 +3399,11 @@ row_drop_table_for_mysql(
if (table->n_foreign_key_checks_running > 0) {
defer:
- /* Rename #sql-backup to #sql-ib if table has open ref count
- while dropping the table. This scenario can happen
- when purge thread is waiting for dict_sys.mutex so
- that it could close the table. But drop table acquires
- dict_sys.mutex.
- In the future this should use 'tmp_file_prefix'!
- */
- if (!is_temp_name
- || strstr(table->name.m_name, "/#sql-backup-")) {
+ /* Rename the table to #sql-ib prefix. This scenario can
+ occur also for #sql tables when purge is waiting for
+ dict_sys.mutex so that it could close the table. But
+ DROP TABLE acquires dict_sys.mutex. */
+ if (!is_temp_name) {
heap = mem_heap_create(FN_REFLEN);
const char* tmp_name
= dict_mem_create_temporary_tablename(
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index cd23da944fd..ad4ecbe9289 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -196,6 +196,7 @@ close_and_exit:
table = nullptr;
}
+ purge_sys.check_stop_SYS();
mtr.start();
index->set_modified(mtr);
@@ -732,12 +733,19 @@ row_purge_del_mark(
return(row_purge_remove_clust_if_poss(node));
}
+void purge_sys_t::wait_SYS()
+{
+ while (must_wait_SYS())
+ std::this_thread::sleep_for(std::chrono::seconds(1));
+}
+
/** Reset DB_TRX_ID, DB_ROLL_PTR of a clustered index record
whose old history can no longer be observed.
@param[in,out] node purge node
@param[in,out] mtr mini-transaction (will be started and committed) */
static void row_purge_reset_trx_id(purge_node_t* node, mtr_t* mtr)
{
+retry:
/* Reset DB_TRX_ID, DB_ROLL_PTR for old records. */
mtr->start();
@@ -773,6 +781,17 @@ static void row_purge_reset_trx_id(purge_node_t* node, mtr_t* mtr)
ut_ad(!rec_get_deleted_flag(
rec, rec_offs_comp(offsets))
|| rec_is_alter_metadata(rec, *index));
+ switch (node->table->id) {
+ case DICT_TABLES_ID:
+ case DICT_COLUMNS_ID:
+ case DICT_INDEXES_ID:
+ if (purge_sys.must_wait_SYS()) {
+ mtr->commit();
+ purge_sys.check_stop_SYS();
+ goto retry;
+ }
+ }
+
DBUG_LOG("purge", "reset DB_TRX_ID="
<< ib::hex(row_get_rec_trx_id(
rec, index, offsets)));
diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc
index c295e8955ae..9a598718616 100644
--- a/storage/innobase/row/row0uins.cc
+++ b/storage/innobase/row/row0uins.cc
@@ -449,7 +449,8 @@ static bool row_undo_ins_parse_undo_rec(undo_node_t* node, bool dict_locked)
case TRX_UNDO_RENAME_TABLE:
dict_table_t* table = node->table;
ut_ad(!table->is_temporary());
- ut_ad(dict_table_is_file_per_table(table)
+ ut_ad(table->file_unreadable
+ || dict_table_is_file_per_table(table)
== !is_system_tablespace(table->space_id));
size_t len = mach_read_from_2(node->undo_rec)
+ size_t(node->undo_rec - ptr) - 2;
diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc
index 760d7dd1f5f..d363e82f1f1 100644
--- a/storage/innobase/row/row0umod.cc
+++ b/storage/innobase/row/row0umod.cc
@@ -158,21 +158,43 @@ row_undo_mod_clust_low(
}
}
- if (err == DB_SUCCESS
- && btr_cur_get_index(btr_cur)->table->id == DICT_COLUMNS_ID) {
+ if (err != DB_SUCCESS) {
+ return err;
+ }
+
+ switch (const auto id = btr_cur_get_index(btr_cur)->table->id) {
+ unsigned c;
+ case DICT_TABLES_ID:
+ if (node->trx != trx_roll_crash_recv_trx) {
+ break;
+ }
+ c = DICT_COL__SYS_TABLES__ID;
+ goto evict;
+ case DICT_INDEXES_ID:
+ if (node->trx != trx_roll_crash_recv_trx) {
+ break;
+ }
+ /* fall through */
+ case DICT_COLUMNS_ID:
+ static_assert(!DICT_COL__SYS_INDEXES__TABLE_ID, "");
+ static_assert(!DICT_COL__SYS_COLUMNS__TABLE_ID, "");
+ c = DICT_COL__SYS_COLUMNS__TABLE_ID;
/* This is rolling back an UPDATE or DELETE on SYS_COLUMNS.
If it was part of an instant ALTER TABLE operation, we
must evict the table definition, so that it can be
reloaded after the dictionary operation has been
completed. At this point, any corresponding operation
to the metadata record will have been rolled back. */
- const dfield_t& table_id = *dtuple_get_nth_field(node->row, 0);
+ evict:
+ const dfield_t& table_id = *dtuple_get_nth_field(node->row, c);
ut_ad(dfield_get_len(&table_id) == 8);
- node->trx->evict_table(mach_read_from_8(static_cast<byte*>(
- table_id.data)));
+ node->trx->evict_table(mach_read_from_8(
+ static_cast<byte*>(
+ table_id.data)),
+ id == DICT_COLUMNS_ID);
}
- return(err);
+ return DB_SUCCESS;
}
/** Get the byte offset of the DB_TRX_ID column
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 45e34b0737f..842e1ef5ab0 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -1363,21 +1363,38 @@ bool purge_sys_t::running() const
return purge_coordinator_task.is_running();
}
+/** Suspend purge in data dictionary tables */
+void purge_sys_t::stop_SYS()
+{
+ latch.rd_lock(SRW_LOCK_CALL);
+ ++m_SYS_paused;
+ latch.rd_unlock();
+}
+
/** Stop purge during FLUSH TABLES FOR EXPORT */
void purge_sys_t::stop()
{
- latch.wr_lock(SRW_LOCK_CALL);
-
- if (!enabled())
+ for (;;)
{
- /* Shutdown must have been initiated during FLUSH TABLES FOR EXPORT. */
- ut_ad(!srv_undo_sources);
+ latch.wr_lock(SRW_LOCK_CALL);
+
+ if (!enabled())
+ {
+ /* Shutdown must have been initiated during FLUSH TABLES FOR EXPORT. */
+ ut_ad(!srv_undo_sources);
+ latch.wr_unlock();
+ return;
+ }
+
+ ut_ad(srv_n_purge_threads > 0);
+
+ if (!must_wait_SYS())
+ break;
+
latch.wr_unlock();
- return;
+ std::this_thread::sleep_for(std::chrono::seconds(1));
}
- ut_ad(srv_n_purge_threads > 0);
-
const auto paused= m_paused++;
latch.wr_unlock();
@@ -1390,6 +1407,14 @@ void purge_sys_t::stop()
}
}
+/** Resume purge in data dictionary tables */
+void purge_sys_t::resume_SYS(void *)
+{
+ ut_d(const auto s=)
+ purge_sys.m_SYS_paused--;
+ ut_ad(s);
+}
+
/** Resume purge at UNLOCK TABLES after FLUSH TABLES FOR EXPORT */
void purge_sys_t::resume()
{
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index ca41dd675b2..524964e0124 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1830,13 +1830,6 @@ skip_monitors:
}
}
- if (!srv_read_only_mode && srv_operation == SRV_OPERATION_NORMAL
- && srv_force_recovery < SRV_FORCE_NO_BACKGROUND) {
- srv_init_purge_tasks();
- purge_sys.coordinator_startup();
- srv_wake_purge_thread_if_not_active();
- }
-
srv_is_being_started = false;
if (srv_print_verbose_log) {
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 9bdd7a7b5a2..f1dce39c21d 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -167,6 +167,7 @@ void purge_sys_t::create()
ut_ad(!heap);
ut_ad(!enabled());
m_paused= 0;
+ m_SYS_paused= 0;
query= purge_graph_build();
next_stored= false;
rseg= NULL;
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 17b1c5e7fbf..0ebb4a493b8 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1230,8 +1230,9 @@ inline void trx_t::commit_tables()
}
/** Evict a table definition due to the rollback of ALTER TABLE.
-@param[in] table_id table identifier */
-void trx_t::evict_table(table_id_t table_id)
+@param table_id table identifier
+@param reset_only whether to only reset dict_table_t::def_trx_id */
+void trx_t::evict_table(table_id_t table_id, bool reset_only)
{
ut_ad(in_rollback);
@@ -1241,6 +1242,8 @@ void trx_t::evict_table(table_id_t table_id)
return;
}
+ table->def_trx_id = 0;
+
if (!table->release()) {
/* This must be a DDL operation that is being rolled
back in an active connection. */
@@ -1250,6 +1253,10 @@ void trx_t::evict_table(table_id_t table_id)
return;
}
+ if (reset_only) {
+ return;
+ }
+
/* This table should only be locked by this transaction, if at all. */
ut_ad(UT_LIST_GET_LEN(table->locks) <= 1);
const bool locked = UT_LIST_GET_LEN(table->locks);
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 18101aa9bab..3baac8960d8 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -224,6 +224,12 @@ static handler *rocksdb_create_handler(my_core::handlerton *hton,
my_core::TABLE_SHARE *table_arg,
my_core::MEM_ROOT *mem_root);
+void save_table_version(rocksdb::WriteBatch *wb, const char *path,
+ ulonglong version);
+ulonglong get_table_version(const char *path);
+void delete_table_version(rocksdb::WriteBatch *wb,
+ const char *path);
+
static rocksdb::CompactRangeOptions getCompactRangeOptions(
int concurrency = 0) {
rocksdb::CompactRangeOptions compact_range_options;
@@ -5200,6 +5206,18 @@ static rocksdb::Status check_rocksdb_options_compatibility(
bool prevent_myrocks_loading= false;
+static int rocksdb_check_version(handlerton *hton,
+ const char *path,
+ const LEX_CUSTRING *version,
+ ulonglong create_id) {
+ ulonglong ver= get_table_version(path);
+ DBUG_PRINT("note",
+ ("MYROCKS-VER: rocksdb_check_version(): path: %s create_id: %llu "
+ "on_disk_create_id: %llu",
+ path, create_id, ver));
+
+ return (create_id == ver);
+}
/*
Storage Engine initialization function, invoked when plugin is loaded.
*/
@@ -5319,6 +5337,7 @@ static int rocksdb_init_func(void *const p) {
rocksdb_hton->handle_single_table_select = rocksdb_handle_single_table_select;
*/
+ rocksdb_hton->check_version = rocksdb_check_version;
rocksdb_hton->flags = HTON_TEMPORARY_NOT_SUPPORTED |
HTON_SUPPORTS_EXTENDED_KEYS | HTON_CAN_RECREATE;
@@ -7739,6 +7758,7 @@ int ha_rocksdb::create_table(const std::string &table_name,
goto error;
}
+ save_table_version(batch, table_arg->s->path.str, 0);
err = dict_manager.commit(batch);
if (err != HA_EXIT_SUCCESS) {
dict_manager.unlock();
@@ -11336,6 +11356,8 @@ ulonglong ha_rocksdb::table_flags() const
- have no PK
- have some (or all) of PK that can't be decoded from the secondary
index.
+ HA_REUSES_FILE_NAMES
+ - Ensures that there is a .frm file when table is dropped or renamed.
*/
THD *thd= ha_thd();
DBUG_RETURN(HA_BINLOG_ROW_CAPABLE |
@@ -11344,7 +11366,7 @@ ulonglong ha_rocksdb::table_flags() const
HA_REC_NOT_IN_SEQ | HA_CAN_INDEX_BLOBS |
HA_PRIMARY_KEY_IN_READ_INDEX |
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | HA_NULL_IN_KEY |
- HA_PARTIAL_COLUMN_READ |
+ HA_PARTIAL_COLUMN_READ | HA_REUSES_FILE_NAMES |
HA_TABLE_SCAN_ON_INDEX);
}
@@ -11687,11 +11709,14 @@ int ha_rocksdb::delete_table(Rdb_tbl_def *const tbl) {
dict_manager.add_drop_table(tbl->m_key_descr_arr, tbl->m_key_count, batch);
+ std::string path = std::string("./") + tbl->base_dbname() +
+ "/" + tbl->base_tablename();
/*
Remove the table entry in data dictionary (this will also remove it from
the persistent data dictionary).
*/
ddl_manager.remove(tbl, batch, true);
+ delete_table_version(batch, path.c_str());
int err = dict_manager.commit(batch);
if (err) {
@@ -13035,6 +13060,13 @@ bool ha_rocksdb::commit_inplace_alter_table(
ddl_manager.remove_uncommitted_keydefs(ctx->m_added_indexes);
}
+ /*
+ Increment the table version.
+ */
+ ulonglong table_ver = get_table_version(table->s->path.str);
+ table_ver++;
+ save_table_version(batch, table->s->path.str, table_ver);
+
if (dict_manager.commit(batch)) {
/*
Should never reach here. We assume MyRocks will abort if commit fails.
@@ -14572,6 +14604,75 @@ void ha_rocksdb::print_error(int error, myf errflag) {
handler::print_error(error, errflag);
}
+
+std::string make_table_version_lookup_key(const char *path) {
+ std::string res;
+ char buf[Rdb_key_def::INDEX_NUMBER_SIZE];
+ rdb_netbuf_store_index((uchar*)buf, Rdb_key_def::TABLE_VERSION);
+ res.append(buf, Rdb_key_def::INDEX_NUMBER_SIZE);
+ res.append("MariaDB:table-version:");
+ res.append(path);
+ return res;
+}
+
+
+/*
+ Save the table version in the data dictionary
+
+ @param wb Where to write
+ @param path Table's path "./db_name/table_name"
+ @param version Version
+*/
+
+void save_table_version(rocksdb::WriteBatch *wb, const char *path,
+ ulonglong version) {
+ ulonglong val= htobe64(version);
+ auto lookup_key = make_table_version_lookup_key(path);
+ wb->Put(dict_manager.get_system_cf(), lookup_key,
+ rocksdb::Slice((const char*)&val, sizeof(val)));
+}
+
+/*
+ @brief Read table's version from the data dictionary
+
+ @param path The table's path, "./db_name/table_name"
+
+ @return
+ number TTable version as stored in the data dictionary
+ 0 If there's no table version stored.
+ -1 Read error
+*/
+
+ulonglong get_table_version(const char *path) {
+ auto lookup_key = make_table_version_lookup_key(path);
+ std::string value;
+ ulonglong res;
+
+ auto s = dict_manager.get_value(rocksdb::Slice(lookup_key), &value);
+ if (s.IsNotFound()) {
+ res = 0;
+ } else if (s.ok()) {
+ // decode the value
+ if (value.length() == sizeof(res)) {
+ memcpy(&res, value.data(), sizeof(res));
+ res = be64toh(res);
+ }
+ else
+ res = ulonglong(-1);
+ } else {
+ res = ulonglong(-1);
+ }
+ return res;
+}
+
+void delete_table_version(rocksdb::WriteBatch *wb, const char *path) {
+ auto lookup_key = make_table_version_lookup_key(path);
+ wb->Delete(dict_manager.get_system_cf(), lookup_key);
+}
+
+ulonglong ha_rocksdb::table_version() const {
+ return get_table_version(table->s->path.str);
+}
std::string rdb_corruption_marker_file_name() {
std::string ret(rocksdb_datadir);
ret.append("/ROCKSDB_CORRUPTED");
diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h
index 05b5341bfb1..05f0b2bf984 100644
--- a/storage/rocksdb/ha_rocksdb.h
+++ b/storage/rocksdb/ha_rocksdb.h
@@ -973,6 +973,9 @@ public:
my_core::Alter_inplace_info *const ha_alter_info, bool commit) override;
void set_skip_unique_check_tables(const char *const whitelist);
+
+ virtual ulonglong table_version() const override;
+
#ifdef MARIAROCKS_NOT_YET // MDEV-10976
bool is_read_free_rpl_table() const;
#endif
diff --git a/storage/rocksdb/rdb_datadic.h b/storage/rocksdb/rdb_datadic.h
index 903cecdc379..fb368a17fba 100644
--- a/storage/rocksdb/rdb_datadic.h
+++ b/storage/rocksdb/rdb_datadic.h
@@ -505,6 +505,8 @@ class Rdb_key_def {
MAX_INDEX_ID = 7,
DDL_CREATE_INDEX_ONGOING = 8,
AUTO_INC = 9,
+ // MariaDB: 10 through 12 are already taken in upstream
+ TABLE_VERSION = 20, // MariaDB: table version record
END_DICT_INDEX_ID = 255
};