diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2022-08-31 11:55:04 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2022-08-31 11:55:04 +0300 |
commit | 93c8252f02faa8ad8dc5f005e52f1990c29d4a0d (patch) | |
tree | bc846307029cb9052d272425634c506fb2fc3db0 | |
parent | 86da0f4ee8381e7543733fae209252ff2b873631 (diff) | |
download | mariadb-git-93c8252f02faa8ad8dc5f005e52f1990c29d4a0d.tar.gz |
MDEV-25292 Atomic CREATE OR REPLACE TABLE
Atomic CREATE OR REPLACE allows to keep an old table intact if the
command fails or during the crash. That is done through creating
a table with a temporary name and filling it with the data
(for CREATE OR REPLACE .. SELECT), then renaming the original table
to another temporary (backup) name and renaming the replacement table
to original table. The backup table is kept until the last chance of
failure and if that happens, the replacement table is thrown off and
backup recovered. When the command is complete and logged the backup
table is deleted.
Atomic replace algorithm
Two DDL chains are used for CREATE OR REPLACE:
ddl_log_state_create (C) and ddl_log_state_rm (D).
1. (C) Log CREATE_TABLE_ACTION of TMP table (drops TMP table);
2. Create new table as TMP;
3. Do everything with TMP (like insert data);
finalize_atomic_replace():
4. Link chains: (D) is executed only if (C) is closed;
5. (D) Log DROP_ACTION of BACKUP;
6. (C) Log RENAME_TABLE_ACTION from ORIG to BACKUP (replays BACKUP -> ORIG);
7. Rename ORIG to BACKUP;
8. (C) Log CREATE_TABLE_ACTION of ORIG (drops ORIG);
9. Rename TMP to ORIG;
finalize_ddl() in case of success:
10. Close (C);
11. Replay (D): BACKUP is dropped.
finalize_ddl() in case of error:
10. Close (D);
11. Replay (C):
1) ORIG is dropped (only after finalize_atomic_replace());
2) BACKUP renamed to ORIG (only after finalize_atomic_replace());
3) drop TMP.
If crash happens (C) or (D) is replayed in reverse order. (C) is
replayed if crash happens before it is closed, otherwise (D) is
replayed.
Temporary table for CREATE OR REPLACE
Before dropping "old" table, CREATE OR REPLACE creates "tmp" table.
ddl_log_state_create holds the drop of the "tmp" table. When
everything is OK (data is inserted, "tmp" is ready) ddl_log_state_rm
is written to replace "old" with "tmp". Until ddl_log_state_create
is closed ddl_log_state_rm is not executed.
After the binlogging is done ddl_log_state_create is closed. At that
point ddl_log_state_rm is executed and "tmp" is replaced with
"old". That is: final rename is done by the DDL log.
With that important role of DDL log for CREATE OR REPLACE operation
replay of ddl_log_state_rm must fail at the first hit error and
print the error message if possible. F.ex. foreign key error is
discovered at this phase: InnoDB rejects to drop the "old" table and
returns corresponding foreign key error code.
Additional notes
- CREATE TABLE without REPLACE is not affected by this commit.
- Engines having HTON_EXPENSIVE_RENAME flag set are not affected by
this commit.
- CREATE TABLE .. SELECT XID usage is fixed and now there is no need
to log DROP TABLE via DDL_CREATE_TABLE_PHASE_LOG (see comments in
do_postlock()). XID is now correctly updated so it disables
DDL_LOG_DROP_TABLE_ACTION. Note that binary log is flushed at the
final stage when the table is ready. So if we have XID in the
binary log we don't need to drop the table.
- Three variations of CREATE OR REPLACE handled:
1. CREATE OR REPLACE TABLE t1 (..);
2. CREATE OR REPLACE TABLE t1 LIKE t2;
3. CREATE OR REPLACE TABLE t1 SELECT ..;
- Test case uses 6 combinations for engines (aria, aria_notrans,
myisam, ib, lock_tables, expensive_rename) and 2 combinations for
binlog types (row, stmt). Combinations help to check differences
between the results. Error failures are tested for the above three
variations.
- expensive_rename tests CREATE OR REPLACE without atomic
replace. The effect should be the same as with the old behaviour
before this commit.
- Triggers mechanism is unaffected by this change. This is tested in
create_replace.test.
- LOCK TABLES is affected. Lock restoration must be done after "rm"
chain is replayed.
- Moved ddl_log_complete() from send_eof() to finalize_ddl(). This
checkpoint was not executed before for normal CREATE TABLE but is
executed now.
- CREATE TABLE will now rollback also if writing to the binary
logging failed. See rpl_gtid_strict.test
Rename and drop via DDL log
We replay ddl_log_state_rm to drop the old table and rename the
temporary table. In that case we must throw the correct error
message if ddl_log_revert() fails (f.ex. on FK error).
If table is deleted earlier and not via DDL log and the crash
happened, the create chain is not closed. Linked drop chain is not
executed and the new table is not installed. But the old table is
already deleted.
ddl_log.cc changes
Now we can place action before DDL_LOG_DROP_INIT_ACTION and it will
be replayed after DDL_LOG_DROP_TABLE_ACTION.
report_error parameter for ddl_log_revert() allows to fail at first
error and print the error message if possible.
ddl_log_execute_action() now can print error message.
Since we now can handle errors from ddl_log_execute_action() (in
case of non-recovery execution) unconditional setting "error= TRUE"
is wrong (it was wrong anyway because it was overwritten at the end
of the function).
On XID usage
Like with all other atomic DDL operations XID is used to avoid
inconsistency between master and slave in the case of a crash after
binary log is written and before ddl_log_state_create is closed. On
recovery XIDs are taken from binary log and corresponding DDL log
events get disabled. That is done by
ddl_log_close_binlogged_events().
On linking two chains together
Chains are executed in the ascending order of entry_pos of execute
entries. But entry_pos assignment order is undefined: it may assign
bigger number for the first chain and then smaller number for the
second chain. So the execution order in that case will be reverse:
second chain will be executed first.
To avoid that we link one chain to another. While the base chain
(ddl_log_state_create) is active the secondary chain
(ddl_log_state_rm) is not executed. That is: only one chain can be
executed in two linked chains.
The interface ddl_log_link_chains() was done in "MDEV-22166
ddl_log_write_execute_entry() extension".
More on CREATE OR REPLACE .. SELECT
We use create_and_open_tmp_table() like in ALTER TABLE to create
temporary TABLE object (tmp_table is (NON_)TRANSACTIONAL_TMP_TABLE).
After we created such TABLE object we use create_info->tmp_table()
instead of table->s->tmp_table when we need to check for
parser-requested tmp-table.
External locking is required for temporary table created by
create_and_open_tmp_table(). F.ex. that disables logging for Aria
transactional tables and without that (when no mysql_lock_tables()
is done) it cannot work correctly.
For making external lock the patch requires Aria table to work in
non-transactional mode. That is usually done by
ha_enable_transaction(false). But we cannot disable transaction
completely because: 1. binlog rollback removes pending row events
(binlog_remove_pending_rows_event()). The row events are added
during CREATE .. SELECT data insertion phase. 2. replication slave
highly depends on transaction and cannot work without it.
So we put temporary Aria table into non-transactional mode with
"thd->transaction->on hack". See comment for on_save variable.
Note that Aria table has internal_table mode. But we cannot use it
because:
if (!internal_table)
{
mysql_mutex_lock(&THR_LOCK_myisam);
old_info= test_if_reopen(name_buff);
}
For internal_table test_if_reopen() is not called and we get a new
MARIA_SHARE for each file handler. In that case duplicate errors are
missed because insert and lookup in CREATE .. SELECT is done via two
different handlers (see create_lookup_handler()).
For temporary table before dropping TABLE_SHARE by
drop_temporary_table() we must do ha_reset(). ha_reset() releases
storage share. Without that the share is kept and the second CREATE
OR REPLACE .. SELECT fails with:
HA_ERR_TABLE_EXIST (156): MyISAM table '#sql-create-b5377-4-t2' is
in use (most likely by a MERGE table). Try FLUSH TABLES.
HA_EXTRA_PREPARE_FOR_DROP also removes MYISAM_SHARE, but that is
not needed as ha_reset() does the job.
ha_reset() is usually done by
mark_tmp_table_as_free_for_reuse(). But we don't need that mechanism
for our temporary table.
Atomic_info in HA_CREATE_INFO
Many functions in CREATE TABLE pass the same parameters. These
parameters are part of table creation info and should be in
HA_CREATE_INFO (or whatever). Passing parameters via single
structure is much easier for adding new data and
refactoring.
InnoDB changes (revised by Marko Mäkelä)
row_rename_table_for_mysql(): Specify the treatment of FOREIGN KEY
constraints in a 4-valued enum parameter. In cases where FOREIGN KEY
constraints cannot exist (partitioned tables, or internal tables of
FULLTEXT INDEX), we can use the mode RENAME_IGNORE_FK.
The mod RENAME_REBUILD is for any DDL operation that rebuilds the
table inside InnoDB, such as TRUNCATE and native ALTER TABLE
(or OPTIMIZE TABLE). The mode RENAME_ALTER_COPY is used solely
during non-native ALTER TABLE in ha_innobase::rename_table().
Normal ha_innobase::rename_table() will use the mode RENAME_FK.
CREATE OR REPLACE will rename the old table (if one exists) along
with its FOREIGN KEY constraints into a temporary name. The replacement
table will be initially created with another temporary name.
Unlike in ALTER TABLE, all FOREIGN KEY constraints must be renamed
and not inherited as part of these operations, using the mode RENAME_FK.
dict_get_referenced_table(): Let the callers convert names when needed.
create_table_info_t::create_foreign_keys(): CREATE OR REPLACE creates
the replacement table with a temporary name table, so for
self-references foreign->referenced_table will be a table with
temporary name and charset conversion must be skipped for it.
Reviewed by:
Michael Widenius <monty@mariadb.org>
73 files changed, 8639 insertions, 1106 deletions
diff --git a/mysql-test/include/binlog_formats.combinations b/mysql-test/include/binlog_formats.combinations new file mode 100644 index 00000000000..07042c2cbec --- /dev/null +++ b/mysql-test/include/binlog_formats.combinations @@ -0,0 +1,8 @@ +[row] +binlog-format=row + +[stmt] +binlog-format=statement + +[mix] +binlog-format=mixed diff --git a/mysql-test/include/binlog_formats.inc b/mysql-test/include/binlog_formats.inc new file mode 100644 index 00000000000..44d64293102 --- /dev/null +++ b/mysql-test/include/binlog_formats.inc @@ -0,0 +1,4 @@ +# This file adds combinations for all binlog formats: row, stmt, mix +# Under each combination a corresponding binlog-format option is set. + +--source include/have_log_bin.inc diff --git a/mysql-test/main/backup_log.result b/mysql-test/main/backup_log.result index 94590a220d4..6338425990c 100644 --- a/mysql-test/main/backup_log.result +++ b/mysql-test/main/backup_log.result @@ -69,7 +69,7 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY' create table t32 (a int) ; drop table if exists t30,t31,t32,tmp_t30; Warnings: -Note 1051 Unknown table 'test.t31,test.tmp_t30' +Note 1051 Unknown table 'test.tmp_t30' # # Testing create LIKE # @@ -182,56 +182,55 @@ CREATE,MyISAM,0,test,t30,id: 8,,0,,, CREATE,MyISAM,0,test,t31,id: 9,,0,,, DROP,MyISAM,0,test,t31,id: 9,,0,,, CREATE,MyISAM,0,test,t31,id: 10,,0,,, -DROP,MyISAM,0,test,t31,id: 10,,0,,, -DROP_AFTER_CREATE,MyISAM,0,test,t31,id: 11,,0,,, -CREATE,MyISAM,0,test,t32,id: 12,,0,,, +CREATE,MyISAM,0,test,t32,id: 11,,0,,, DROP,MyISAM,0,test,t30,id: 8,,0,,, -DROP,MyISAM,0,test,t32,id: 12,,0,,, -CREATE,MyISAM,0,test,t40,id: 13,,0,,, -CREATE,InnoDB,0,test,t41,id: 14,,0,,, -CREATE,MyISAM,0,test,t42,id: 15,,0,,, -DROP,MyISAM,0,test,t42,id: 15,,0,,, -CREATE,InnoDB,0,test,t42,id: 16,,0,,, -DROP,MyISAM,0,test,t40,id: 13,,0,,, -DROP,InnoDB,0,test,t41,id: 14,,0,,, -DROP,InnoDB,0,test,t42,id: 16,,0,,, -CREATE,MyISAM,0,test,t50,id: 17,,0,,, -CREATE,MyISAM,0,test,t51,id: 18,,0,,, -RENAME,MyISAM,0,test,t50,id: 17,MyISAM,0,test,t52,id: 17 -RENAME,MyISAM,0,test,t51,id: 18,MyISAM,0,test,t53,id: 18 -RENAME,MyISAM,0,test,t52,id: 17,MyISAM,0,test,tmp,id: 17 -RENAME,MyISAM,0,test,t53,id: 18,MyISAM,0,test,t52,id: 18 -RENAME,MyISAM,0,test,tmp,id: 17,MyISAM,0,test,t53,id: 17 -DROP,MyISAM,0,test,t52,id: 18,,0,,, -DROP,MyISAM,0,test,t53,id: 17,,0,,, -CREATE,Aria,0,test,t60,id: 19,,0,,, -CHANGE_INDEX,Aria,0,test,t60,id: 19,,0,,, -CHANGE_INDEX,Aria,0,test,t60,id: 19,,0,,, -DROP,Aria,0,test,t60,id: 19,,0,,, -CREATE,Aria,0,test,t70,id: 20,,0,,, -BULK_INSERT,Aria,0,test,t70,id: 20,,0,,, -BULK_INSERT,Aria,0,test,t70,id: 20,,0,,, -CREATE,Aria,0,test,t71,id: 21,,0,,, -BULK_INSERT,Aria,0,test,t71,id: 21,,0,,, -DROP,Aria,0,test,t70,id: 20,,0,,, -DROP,Aria,0,test,t71,id: 21,,0,,, -CREATE,MyISAM,0,test,t@00201,id: 22,,0,,, -DROP,MyISAM,0,test,t@00201,id: 22,,0,,, -CREATE,MyISAM,0,test,t80,id: 23,,0,,, +DROP,MyISAM,0,test,t31,id: 10,,0,,, +DROP,MyISAM,0,test,t32,id: 11,,0,,, +CREATE,MyISAM,0,test,t40,id: 12,,0,,, +CREATE,InnoDB,0,test,t41,id: 13,,0,,, +CREATE,MyISAM,0,test,t42,id: 14,,0,,, +DROP,MyISAM,0,test,t42,id: 14,,0,,, +CREATE,InnoDB,0,test,t42,id: 15,,0,,, +DROP,MyISAM,0,test,t40,id: 12,,0,,, +DROP,InnoDB,0,test,t41,id: 13,,0,,, +DROP,InnoDB,0,test,t42,id: 15,,0,,, +CREATE,MyISAM,0,test,t50,id: 16,,0,,, +CREATE,MyISAM,0,test,t51,id: 17,,0,,, +RENAME,MyISAM,0,test,t50,id: 16,MyISAM,0,test,t52,id: 16 +RENAME,MyISAM,0,test,t51,id: 17,MyISAM,0,test,t53,id: 17 +RENAME,MyISAM,0,test,t52,id: 16,MyISAM,0,test,tmp,id: 16 +RENAME,MyISAM,0,test,t53,id: 17,MyISAM,0,test,t52,id: 17 +RENAME,MyISAM,0,test,tmp,id: 16,MyISAM,0,test,t53,id: 16 +DROP,MyISAM,0,test,t52,id: 17,,0,,, +DROP,MyISAM,0,test,t53,id: 16,,0,,, +CREATE,Aria,0,test,t60,id: 18,,0,,, +CHANGE_INDEX,Aria,0,test,t60,id: 18,,0,,, +CHANGE_INDEX,Aria,0,test,t60,id: 18,,0,,, +DROP,Aria,0,test,t60,id: 18,,0,,, +CREATE,Aria,0,test,t70,id: 19,,0,,, +BULK_INSERT,Aria,0,test,t70,id: 19,,0,,, +BULK_INSERT,Aria,0,test,t70,id: 19,,0,,, +CREATE,Aria,0,test,t71,id: 20,,0,,, +BULK_INSERT,Aria,0,test,t71,id: 20,,0,,, +DROP,Aria,0,test,t70,id: 19,,0,,, +DROP,Aria,0,test,t71,id: 20,,0,,, +CREATE,MyISAM,0,test,t@00201,id: 21,,0,,, +DROP,MyISAM,0,test,t@00201,id: 21,,0,,, +CREATE,MyISAM,0,test,t80,id: 22,,0,,, CREATE,VIEW,0,test,v1,,,0,,, CREATE,TRIGGER,0,test,trg,,,0,,, DROP,TRIGGER,0,test,trg,,,0,,, DROP,VIEW,0,test,v1,,,0,,, -DROP,MyISAM,0,test,t80,id: 23,,0,,, -CREATE,MyISAM,0,test,t85,id: 24,,0,,, -ALTER,MyISAM,0,test,t85,id: 24,InnoDB,0,test,t85,id: 25 -DROP,InnoDB,0,test,t85,id: 25,,0,,, +DROP,MyISAM,0,test,t80,id: 22,,0,,, +CREATE,MyISAM,0,test,t85,id: 23,,0,,, +ALTER,MyISAM,0,test,t85,id: 23,InnoDB,0,test,t85,id: 24 +DROP,InnoDB,0,test,t85,id: 24,,0,,, CREATE,DATABASE,0,mysqltest,,,,0,,, -CREATE,MyISAM,0,mysqltest,t90,id: 26,,0,,, -CREATE,InnoDB,0,mysqltest,t91,id: 27,,0,,, +CREATE,MyISAM,0,mysqltest,t90,id: 25,,0,,, +CREATE,InnoDB,0,mysqltest,t91,id: 26,,0,,, ALTER,DATABASE,0,mysqltest,,,,0,,, -DROP,MyISAM,0,mysqltest,t90,id: 26,,0,,, -DROP,InnoDB,0,mysqltest,t91,id: 27,,0,,, +DROP,MyISAM,0,mysqltest,t90,id: 25,,0,,, +DROP,InnoDB,0,mysqltest,t91,id: 26,,0,,, DROP,DATABASE,0,mysqltest,,,,0,,, # # Cleanup diff --git a/mysql-test/main/backup_log_print.inc b/mysql-test/main/backup_log_print.inc new file mode 100644 index 00000000000..ad46dde49f9 --- /dev/null +++ b/mysql-test/main/backup_log_print.inc @@ -0,0 +1,7 @@ +--disable_query_log +--source include/print_ddl_log.inc +--connection con1 +backup stage end; +backup stage start; +--connection default +--enable_query_log diff --git a/mysql-test/main/create_not_windows.result b/mysql-test/main/create_not_windows.result index abe76fd3fbe..1ae0f96b728 100644 --- a/mysql-test/main/create_not_windows.result +++ b/mysql-test/main/create_not_windows.result @@ -29,3 +29,39 @@ select count(a) from t1; count(a) 0 drop table t1; +# +# MDEV-25292 Atomic CREATE OR REPLACE TABLE +# +# Test multi-byte characters in table name +set names utf8; +# Filename is too long because it is converted to @274e@274e@274e@274e... +# so each '❎' is 5 bytes in filesystem, 51 x 5 = 255 bytes +create table ❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎ (x int); +ERROR HY000: Can't create table `test`.`❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎` (errno: 36 "File name too long") +# Let's find out max length for '❎'... +# Acceptable name length: 50; Filename length: 254 +# OK with 64-characters table name, filesystem name is 40 x 5 + 24 = 224 bytes +create table tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎ (x int); +# Not OK with 65-characters table name +create table ttttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎ (x int); +ERROR 42000: Incorrect table name 'ttttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎' +show tables; +Tables_in_test +tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎ +create or replace table tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎ (y int); +show create table tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎; +Table Create Table +tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎ CREATE TABLE `tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎` ( + `y` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +set @@debug_dbug="+d,ddl_log_create_after_save_backup", @debug_crash_counter=1; +create or replace table tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎ (z int); +ERROR HY000: Lost connection to server during query +#sql-backup-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYD +#sql-backup-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYI +#sql-backup-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.frm +#sql-create-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYD +#sql-create-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYI +#sql-create-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.frm +drop table tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎; +set @@debug_dbug=""; diff --git a/mysql-test/main/create_not_windows.test b/mysql-test/main/create_not_windows.test index b612e31e3aa..d6dfc0d3fa1 100644 --- a/mysql-test/main/create_not_windows.test +++ b/mysql-test/main/create_not_windows.test @@ -1,6 +1,8 @@ # Non-windows specific create tests. --source include/not_windows.inc +--source include/have_debug.inc +--source include/not_embedded.inc # # Bug#19479:mysqldump creates invalid dump @@ -41,3 +43,64 @@ create table t1(a int, b int, c int); --echo "Try to select from the table. This should not crash the server" select count(a) from t1; drop table t1; + +--echo # +--echo # MDEV-25292 Atomic CREATE OR REPLACE TABLE +--echo # + +# This does not work on Windows because of max path limit 255 +# (actually it does not work for path 254 already) +# Note: on Windows use ER_BAD_DB_ERROR instead of ER_CANT_CREATE_TABLE +# unless MDEV-28746 is fixed. + +--echo # Test multi-byte characters in table name +set names utf8; +let $save_debug=`select @@debug_dbug`; +let $MYSQLD_DATADIR= `SELECT @@datadir`; +--echo # Filename is too long because it is converted to @274e@274e@274e@274e... +--echo # so each '❎' is 5 bytes in filesystem, 51 x 5 = 255 bytes +let $t= `select repeat('❎', 51)`; +--error ER_CANT_CREATE_TABLE +eval create table $t (x int); +# The below case is useful for experimenting on Windows +--echo # Let's find out max length for '❎'... +--disable_query_log +let $i= 50; +while ($i) +{ + let $t= `select repeat('❎', $i)`; + --error 0,ER_CANT_CREATE_TABLE + eval create table $t (x int); + let $good_len= $i; + dec $i; + if (!$mysql_errno) + { + let $i= 0; + } +} +let $fn_len= `select $good_len * 5 + 4`; # 4 is extension length +eval drop table $t; +--enable_query_log +--echo # Acceptable name length: $good_len; Filename length: $fn_len +--echo # OK with 64-characters table name, filesystem name is 40 x 5 + 24 = 224 bytes +let $t= `select concat(repeat('t', 24), repeat('❎', 40))`; +eval create table $t (x int); +--echo # Not OK with 65-characters table name +let $t2= `select concat(repeat('t', 25), repeat('❎', 40))`; +--error ER_WRONG_TABLE_NAME +eval create table $t2 (x int); +show tables; +# Let's try atomic replace with such long name and see what happens +eval create or replace table $t (y int); +eval show create table $t; +set @@debug_dbug="+d,ddl_log_create_after_save_backup", @debug_crash_counter=1; +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--disable_reconnect +--error 2013 +eval create or replace table $t (z int); +--replace_regex /-\w+-\w+-ttt/-PID-TID-ttt/ +--list_files $MYSQLD_DATADIR/test *sql* +--enable_reconnect +--source include/wait_until_connected_again.inc +eval drop table $t; +eval set @@debug_dbug="$save_debug"; diff --git a/mysql-test/main/create_or_replace.result b/mysql-test/main/create_or_replace.result index 178b7182666..46645bb910f 100644 --- a/mysql-test/main/create_or_replace.result +++ b/mysql-test/main/create_or_replace.result @@ -1,5 +1,3 @@ -SET @save_persistent=@@GLOBAL.innodb_stats_persistent; -SET GLOBAL innodb_stats_persistent=OFF; CREATE TABLE t2 (a int); INSERT INTO t2 VALUES(1),(2),(3); # @@ -260,7 +258,8 @@ Note 1051 Unknown table 'test.t1,mysqltest2.t2' create table test.t1 (i int) engine=myisam; create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DML NULL Backup lock @@ -272,24 +271,37 @@ create or replace table test.t1; ERROR 42000: A table must have at least 1 column show tables; Tables_in_test +t1 t2 -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DML NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 create or replace table mysqltest2.t2; ERROR 42000: A table must have at least 1 column -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME +# MDL_BACKUP_DDL NULL Backup lock +# MDL_BACKUP_DML NULL Backup lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +drop table mysqltest2.t2; +drop table t1; create table t1 (i int); drop table t1; create table test.t1 (i int); create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DML NULL Backup lock @@ -301,24 +313,37 @@ create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a'; ERROR 42S21: Duplicate column name 'a' show tables; Tables_in_test +t1 t2 -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DML NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a'; ERROR 42S21: Duplicate column name 'a' -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME +# MDL_BACKUP_DDL NULL Backup lock +# MDL_BACKUP_DML NULL Backup lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +drop table mysqltest2.t2; +drop table t1; create table t1 (i int); drop table t1; create table test.t1 (i int) engine=innodb; create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_BACKUP_DDL NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 @@ -330,7 +355,8 @@ drop table test.t1,mysqltest2.t2; create table test.t1 (i int) engine=aria transactional=1 checksum=1; create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_BACKUP_DDL NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 @@ -347,7 +373,8 @@ drop table test.t1; # create table t1 (i int); lock table t1 write; -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DML NULL Backup lock @@ -355,10 +382,12 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 create or replace table t1 (a char(1)) engine=Innodb select 'foo' as a; ERROR 22001: Data too long for column 'a' at row 1 +drop table t1; show tables; Tables_in_test t2 -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME create table t1 (i int); drop table t1; @@ -446,7 +475,8 @@ drop view t1; # create table t1 (a int); lock table t1 write, t2 read; -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DML NULL Backup lock @@ -454,7 +484,8 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 # MDL_SHARED_READ NULL Table metadata lock test t2 create or replace table t1 (i int); -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DML NULL Backup lock @@ -462,7 +493,8 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 # MDL_SHARED_READ NULL Table metadata lock test t2 create or replace table t1 like t2; -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DML NULL Backup lock @@ -470,7 +502,8 @@ THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 # MDL_SHARED_READ NULL Table metadata lock test t2 create or replace table t1 select 1 as f1; -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME # MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DML NULL Backup lock @@ -568,4 +601,243 @@ ERROR HY000: Table 't3' was not locked with LOCK TABLES UNLOCK TABLES; DROP TABLE t3; # End of 10.4 tests -SET GLOBAL innodb_stats_persistent=@save_persistent; +# +# MDEV-25292 Atomic CREATE OR REPLACE TABLE +# +create table t1 (a int); +insert t1 values (1), (1); +create table t2 (c int); +create or replace table t2 (a int, b int, key k (a), key k (b)); +ERROR 42000: Duplicate key name 'k' +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create or replace table t2 (a int, b int, key k (a), key k (b)) as select a, a as b from t1; +ERROR 42000: Duplicate key name 'k' +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create or replace table t2 (a int primary key) as select * from t1; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +set @old_mode= @@sql_mode; +set @@sql_mode='ALLOW_INVALID_DATES'; +create table t3 (dt datetime default '2008-02-31 00:00:00'); +set @@sql_mode= @old_mode; +create or replace table t2 like t3; +ERROR 42000: Invalid default value for 'dt' +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +# LOCK TABLES +lock tables t2 write, t1 write; +flush tables; +show open tables like 't2'; +Database Table In_use Name_locked +test t2 1 0 +create or replace table t2 (y int); +flush tables; +show open tables like 't2'; +Database Table In_use Name_locked +test t2 1 0 +create or replace table t2 like t1; +flush tables; +show open tables like 't2'; +Database Table In_use Name_locked +test t2 1 0 +create or replace table t2 (y int) as select * from t1; +flush tables; +show open tables like 't2'; +Database Table In_use Name_locked +test t2 1 0 +unlock tables; +# SP +create or replace procedure sp(n int) +begin +select concat('sp call ', n, ':') as ''; +show open tables like 't2'; +create or replace table t2 (y int); +select 'create or replace table t2 (y int);' as ''; +show open tables like 't2'; +insert into t2 values (2); +select 'insert into t2 values (2);' as ''; +show open tables like 't2'; +create or replace table t2 like t1; +select 'create or replace table t2 like t1;' as ''; +show open tables like 't2'; +create or replace table t2 (y int) as select * from t1; +select 'create or replace table t2 (y int) as select * from t1;' as ''; +show open tables like 't2'; +select 'select * from t2;' as ''; +select * from t2; +show open tables like 't2'; +end $ +flush tables; +call sp(1); + +sp call 1: +Database Table In_use Name_locked + +create or replace table t2 (y int); +Database Table In_use Name_locked + +insert into t2 values (2); +Database Table In_use Name_locked +test t2 0 0 + +create or replace table t2 like t1; +Database Table In_use Name_locked + +create or replace table t2 (y int) as select * from t1; +Database Table In_use Name_locked + +select * from t2; +y a +NULL 1 +NULL 1 +Database Table In_use Name_locked +test t2 0 0 +call sp(2); + +sp call 2: +Database Table In_use Name_locked +test t2 0 0 + +create or replace table t2 (y int); +Database Table In_use Name_locked + +insert into t2 values (2); +Database Table In_use Name_locked +test t2 0 0 + +create or replace table t2 like t1; +Database Table In_use Name_locked + +create or replace table t2 (y int) as select * from t1; +Database Table In_use Name_locked + +select * from t2; +y a +NULL 1 +NULL 1 +Database Table In_use Name_locked +test t2 0 0 +# SP under LOCK TABLES +lock tables t2 write, t1 write; +call sp(3); + +sp call 3: +Database Table In_use Name_locked +test t2 1 0 + +create or replace table t2 (y int); +Database Table In_use Name_locked +test t2 1 0 + +insert into t2 values (2); +Database Table In_use Name_locked +test t2 1 0 + +create or replace table t2 like t1; +Database Table In_use Name_locked +test t2 1 0 + +create or replace table t2 (y int) as select * from t1; +Database Table In_use Name_locked +test t2 1 0 + +select * from t2; +y a +NULL 1 +NULL 1 +Database Table In_use Name_locked +test t2 1 0 +call sp(4); + +sp call 4: +Database Table In_use Name_locked +test t2 1 0 + +create or replace table t2 (y int); +Database Table In_use Name_locked +test t2 1 0 + +insert into t2 values (2); +Database Table In_use Name_locked +test t2 1 0 + +create or replace table t2 like t1; +Database Table In_use Name_locked +test t2 1 0 + +create or replace table t2 (y int) as select * from t1; +Database Table In_use Name_locked +test t2 1 0 + +select * from t2; +y a +NULL 1 +NULL 1 +Database Table In_use Name_locked +test t2 1 0 +unlock tables; +drop procedure sp; +drop tables t1, t2, t3; +# Trigger +create table t1 (a int); +create trigger a before insert on t1 for each row set @s= 1; +create or replace table t1 (old int); +show create trigger a; +ERROR HY000: Trigger does not exist +drop table t1; +# Foreign keys +create table t1 (x int primary key, y int) engine innodb; +create table t2 (x int references t1(x)) engine innodb; +create or replace table t1 (x int primary key); +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (t2) +create or replace table t1 (x int primary key); +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (t2) +create table t3 (x int); +create or replace table t1 like t3; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (t2) +create or replace table t1 like t3; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (t2) +create or replace table t1 select * from t3; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (t2) +create or replace table t1 select * from t3; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (t2) +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`x`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop tables t3, t2, t1; +# UNIQUE +create table t1 (pk int auto_increment primary key, a varchar(2300), unique (a)) engine aria; +insert into t1 (a) values ('a'), ('b'), ('c'); +create table t2 (x int); +create or replace table t2 engine aria select * from t1; +select * from t2; +pk a +1 a +2 b +3 c +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `pk` int(11) NOT NULL DEFAULT 0, + `a` varchar(2300) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +drop tables t2, t1; diff --git a/mysql-test/main/create_or_replace.test b/mysql-test/main/create_or_replace.test index 573e0e177c2..7d783710c17 100644 --- a/mysql-test/main/create_or_replace.test +++ b/mysql-test/main/create_or_replace.test @@ -5,8 +5,7 @@ --source include/have_innodb.inc --source include/have_metadata_lock_info.inc -SET @save_persistent=@@GLOBAL.innodb_stats_persistent; -SET GLOBAL innodb_stats_persistent=OFF; +let $MYSQLD_DATADIR= `SELECT @@datadir`; # # Create help table @@ -215,18 +214,23 @@ create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; --error ER_TABLE_MUST_HAVE_COLUMNS create or replace table test.t1; show tables; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; --error ER_TABLE_MUST_HAVE_COLUMNS create or replace table mysqltest2.t2; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; +drop table mysqltest2.t2; +drop table t1; create table t1 (i int); drop table t1; @@ -235,18 +239,23 @@ create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; --error ER_DUP_FIELDNAME create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a'; show tables; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; --error ER_DUP_FIELDNAME create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a'; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; +drop table mysqltest2.t2; +drop table t1; create table t1 (i int); drop table t1; @@ -255,7 +264,8 @@ create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; unlock tables; drop table test.t1,mysqltest2.t2; @@ -264,7 +274,8 @@ create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; unlock tables; drop table t1; @@ -280,13 +291,16 @@ create table t1 (i int); lock table t1 write; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; --error ER_DATA_TOO_LONG create or replace table t1 (a char(1)) engine=Innodb select 'foo' as a; +drop table t1; show tables; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; create table t1 (i int); drop table t1; @@ -364,20 +378,24 @@ create table t1 (a int); lock table t1 write, t2 read; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; create or replace table t1 (i int); --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; create or replace table t1 like t2; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; create or replace table t1 select 1 as f1; --replace_column 1 # --sorted_result -select * from information_schema.metadata_lock_info; +select * from information_schema.metadata_lock_info +where table_schema!='mysql' or table_name not like 'innodb_%_stats'; drop table t1; unlock tables; @@ -510,4 +528,107 @@ DROP TABLE t3; --echo # End of 10.4 tests -SET GLOBAL innodb_stats_persistent=@save_persistent; +--echo # +--echo # MDEV-25292 Atomic CREATE OR REPLACE TABLE +--echo # +create table t1 (a int); +insert t1 values (1), (1); +create table t2 (c int); +--error ER_DUP_KEYNAME +create or replace table t2 (a int, b int, key k (a), key k (b)); +show create table t2; +--error ER_DUP_KEYNAME +create or replace table t2 (a int, b int, key k (a), key k (b)) as select a, a as b from t1; +show create table t2; +--error ER_DUP_ENTRY +create or replace table t2 (a int primary key) as select * from t1; +show create table t2; +set @old_mode= @@sql_mode; +set @@sql_mode='ALLOW_INVALID_DATES'; +create table t3 (dt datetime default '2008-02-31 00:00:00'); +set @@sql_mode= @old_mode; +--error ER_INVALID_DEFAULT +create or replace table t2 like t3; +show create table t2; +--echo # LOCK TABLES +lock tables t2 write, t1 write; +flush tables; +show open tables like 't2'; +create or replace table t2 (y int); +flush tables; +show open tables like 't2'; +create or replace table t2 like t1; +flush tables; +show open tables like 't2'; +create or replace table t2 (y int) as select * from t1; +flush tables; +show open tables like 't2'; +unlock tables; +--echo # SP +--delimiter $ +create or replace procedure sp(n int) +begin + select concat('sp call ', n, ':') as ''; + show open tables like 't2'; + create or replace table t2 (y int); + select 'create or replace table t2 (y int);' as ''; + show open tables like 't2'; + insert into t2 values (2); + select 'insert into t2 values (2);' as ''; + show open tables like 't2'; + create or replace table t2 like t1; + select 'create or replace table t2 like t1;' as ''; + show open tables like 't2'; + create or replace table t2 (y int) as select * from t1; + select 'create or replace table t2 (y int) as select * from t1;' as ''; + show open tables like 't2'; + select 'select * from t2;' as ''; + select * from t2; + show open tables like 't2'; +end $ +--delimiter ; +flush tables; +call sp(1); call sp(2); +--echo # SP under LOCK TABLES +lock tables t2 write, t1 write; +call sp(3); call sp(4); +unlock tables; +drop procedure sp; +drop tables t1, t2, t3; +--echo # Trigger +create table t1 (a int); +create trigger a before insert on t1 for each row set @s= 1; +create or replace table t1 (old int); +--error ER_TRG_DOES_NOT_EXIST +show create trigger a; +drop table t1; +--echo # Foreign keys +--list_files $MYSQLD_DATADIR/test *sql* +create table t1 (x int primary key, y int) engine innodb; +create table t2 (x int references t1(x)) engine innodb; +--error ER_ROW_IS_REFERENCED_2 +create or replace table t1 (x int primary key); +--list_files $MYSQLD_DATADIR/test *sql* +--error ER_ROW_IS_REFERENCED_2 +create or replace table t1 (x int primary key); +create table t3 (x int); +--error ER_ROW_IS_REFERENCED_2 +create or replace table t1 like t3; +--list_files $MYSQLD_DATADIR/test *sql* +--error ER_ROW_IS_REFERENCED_2 +create or replace table t1 like t3; +--error ER_ROW_IS_REFERENCED_2 +create or replace table t1 select * from t3; +--error ER_ROW_IS_REFERENCED_2 +create or replace table t1 select * from t3; +--list_files $MYSQLD_DATADIR/test *sql* +show create table t1; +drop tables t3, t2, t1; +--echo # UNIQUE +create table t1 (pk int auto_increment primary key, a varchar(2300), unique (a)) engine aria; +insert into t1 (a) values ('a'), ('b'), ('c'); +create table t2 (x int); +create or replace table t2 engine aria select * from t1; +select * from t2; +show create table t2; +drop tables t2, t1; diff --git a/mysql-test/main/create_or_replace2.result b/mysql-test/main/create_or_replace2.result index 6be0d46bdc1..f7bbb7417e6 100644 --- a/mysql-test/main/create_or_replace2.result +++ b/mysql-test/main/create_or_replace2.result @@ -21,7 +21,54 @@ connection slave; SHOW TABLES; Tables_in_test t1 +show create table t1; +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 connection master; drop temporary table if exists tmp; drop table t1; include/rpl_end.inc +# +# MDEV-25292 Atomic CREATE OR REPLACE TABLE +# +set @saved_debug_dbug= @@session.debug_dbug; +create table t1 (a int primary key) engine innodb; +insert t1 values (1), (2); +create table t2 (c int, a int constraint t1_a references t1 (a)) engine innodb; +insert into t2 values (2, 2); +lock tables t2 write, t1 write; +set session debug_dbug= '+d,atomic_replace_external_lock_fail'; +create or replace table t2 (y int) as select * from t1; +ERROR HY000: The total number of locks exceeds the lock table size +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c` int(11) DEFAULT NULL, + `a` int(11) DEFAULT NULL, + KEY `t1_a` (`a`), + CONSTRAINT `t1_a` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +select * from t2; +c a +2 2 +unlock tables; +drop tables t2, t1; +set session debug_dbug= @saved_debug_dbug; +# Test entry_pos in higher position, so drop chain executes before create chain +# (see commit message: On linking two chains together) +create table t1 (c int); +create or replace table t1 (a int, b int, key k (a), key k (b)); +ERROR 42000: Duplicate key name 'k' +create or replace table t1 (a int, b int, key k (a), key k (b)); +ERROR 42000: Duplicate key name 'k' +drop table t1; diff --git a/mysql-test/main/create_or_replace2.test b/mysql-test/main/create_or_replace2.test index 80c8b635d8d..227aff226d5 100644 --- a/mysql-test/main/create_or_replace2.test +++ b/mysql-test/main/create_or_replace2.test @@ -26,6 +26,7 @@ SHOW TABLES; show create table t1; --sync_slave_with_master SHOW TABLES; +show create table t1; --connection master --disable_warnings @@ -33,3 +34,34 @@ drop temporary table if exists tmp; --enable_warnings drop table t1; --source include/rpl_end.inc + + +--echo # +--echo # MDEV-25292 Atomic CREATE OR REPLACE TABLE +--echo # +set @saved_debug_dbug= @@session.debug_dbug; +create table t1 (a int primary key) engine innodb; +insert t1 values (1), (2); +create table t2 (c int, a int constraint t1_a references t1 (a)) engine innodb; +insert into t2 values (2, 2); +lock tables t2 write, t1 write; +set session debug_dbug= '+d,atomic_replace_external_lock_fail'; +--error ER_LOCK_TABLE_FULL +create or replace table t2 (y int) as select * from t1; +let $MYSQLD_DATADIR= `SELECT @@datadir`; +--list_files $MYSQLD_DATADIR/test *sql* +show create table t1; +show create table t2; +select * from t2; +unlock tables; +drop tables t2, t1; +set session debug_dbug= @saved_debug_dbug; + +--echo # Test entry_pos in higher position, so drop chain executes before create chain +--echo # (see commit message: On linking two chains together) +create table t1 (c int); +--error ER_DUP_KEYNAME +create or replace table t1 (a int, b int, key k (a), key k (b)); +--error ER_DUP_KEYNAME +create or replace table t1 (a int, b int, key k (a), key k (b)); +drop table t1; diff --git a/mysql-test/main/default.result b/mysql-test/main/default.result index 2d94c0695a0..52851694568 100644 --- a/mysql-test/main/default.result +++ b/mysql-test/main/default.result @@ -428,14 +428,6 @@ a b c e 2 -1 1 1 drop table t1; # -# Create or replace can delete a table on error -# -create table t1 (a int); -create or replace table t1 (a int default b, b int default a); -ERROR 01000: Expression for field `a` is referring to uninitialized field `b` -show create table t1; -ERROR 42S02: Table 'test.t1' doesn't exist -# # Refering to other columns # create or replace table t1 (a int default 1, b int default a); @@ -453,11 +445,11 @@ ERROR 01000: Expression for field `a` is referring to uninitialized field `a` create or replace table t1 (a int default b, b int default (1+1)); create or replace table t1 (a int default 1, b int as (c), c int as (a+1)); ERROR 01000: Expression for field `b` is referring to uninitialized field `c` -CREATE TABLE t1 (a INT DEFAULT (DEFAULT(a))); +CREATE OR REPLACE TABLE t1 (a INT DEFAULT (DEFAULT(a))); ERROR 01000: Expression for field `a` is referring to uninitialized field `a` -CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT(DEFAULT(a))); +CREATE OR REPLACE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT(DEFAULT(a))); ERROR 01000: Expression for field `a` is referring to uninitialized field `b` -CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)) NOT NULL, b INT DEFAULT(DEFAULT(a)) NOT NULL); +CREATE OR REPLACE TABLE t1 (a INT DEFAULT(DEFAULT(b)) NOT NULL, b INT DEFAULT(DEFAULT(a)) NOT NULL); ERROR 01000: Expression for field `a` is referring to uninitialized field `b` # # Allow defaults to refer to not default fields diff --git a/mysql-test/main/default.test b/mysql-test/main/default.test index 26fc2186533..36a616551d7 100644 --- a/mysql-test/main/default.test +++ b/mysql-test/main/default.test @@ -308,15 +308,6 @@ select * from t1; drop table t1; --echo # ---echo # Create or replace can delete a table on error ---echo # -create table t1 (a int); ---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD -create or replace table t1 (a int default b, b int default a); ---error ER_NO_SUCH_TABLE -show create table t1; - ---echo # --echo # Refering to other columns --echo # @@ -338,11 +329,11 @@ create or replace table t1 (a int default b, b int default (1+1)); --error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD create or replace table t1 (a int default 1, b int as (c), c int as (a+1)); --error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD -CREATE TABLE t1 (a INT DEFAULT (DEFAULT(a))); +CREATE OR REPLACE TABLE t1 (a INT DEFAULT (DEFAULT(a))); --error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD -CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT(DEFAULT(a))); +CREATE OR REPLACE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT(DEFAULT(a))); --error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD -CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)) NOT NULL, b INT DEFAULT(DEFAULT(a)) NOT NULL); +CREATE OR REPLACE TABLE t1 (a INT DEFAULT(DEFAULT(b)) NOT NULL, b INT DEFAULT(DEFAULT(a)) NOT NULL); --echo # --echo # Allow defaults to refer to not default fields diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result index 30c6aaf0f20..19d1f462aa0 100644 --- a/mysql-test/main/long_unique_bugs.result +++ b/mysql-test/main/long_unique_bugs.result @@ -397,7 +397,8 @@ c d create or replace table t2 (a int, b blob, unique(b)) as select * from t1; ERROR 23000: Duplicate entry 'bar' for key 'b' select * from t2; -ERROR 42S02: Table 'test.t2' doesn't exist +c d +3 bar create or replace table t2 (a int, b blob, unique(b)) ignore as select * from t1; Warnings: Warning 1062 Duplicate entry 'bar' for key 'b' diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index 18e430858b0..e522f5140ba 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -480,7 +480,6 @@ delete from t2 using t1, t2 where t1.a=t2.c and t1.b='foo'; # CREATE...SELECT --error ER_DUP_ENTRY create or replace table t2 (a int, b blob, unique(b)) as select * from t1; ---error ER_NO_SUCH_TABLE select * from t2; create or replace table t2 (a int, b blob, unique(b)) ignore as select * from t1; select * from t2; diff --git a/mysql-test/suite/atomic/create_replace,aria_notrans,row.result b/mysql-test/suite/atomic/create_replace,aria_notrans,row.result new file mode 100644 index 00000000000..0006c405608 --- /dev/null +++ b/mysql-test/suite/atomic/create_replace,aria_notrans,row.result @@ -0,0 +1,710 @@ +# Crash recovery +Table Create Table +const_table CREATE TABLE `const_table` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +insert into const_table values (1, 1), (2, 2); +flush tables; +# QUERY: CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 LIKE const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 engine=aria,transactional=0 SELECT * from const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=Aria PAGE_CHECKSUM=1 TRANSACTIONAL=0 +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 engine=aria,transactional=0 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=Aria PAGE_CHECKSUM=1 TRANSACTIONAL=0 +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 engine=aria,transactional=0 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=Aria PAGE_CHECKSUM=1 TRANSACTIONAL=0 +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 engine=aria,transactional=0 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=Aria PAGE_CHECKSUM=1 TRANSACTIONAL=0 +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 engine=aria,transactional=0 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +Warnings: +Note 1051 Unknown table 'test.t1' diff --git a/mysql-test/suite/atomic/create_replace,aria_notrans.result b/mysql-test/suite/atomic/create_replace,aria_notrans.result new file mode 100644 index 00000000000..a6ce2c40c7e --- /dev/null +++ b/mysql-test/suite/atomic/create_replace,aria_notrans.result @@ -0,0 +1,696 @@ +# Crash recovery +Table Create Table +const_table CREATE TABLE `const_table` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +insert into const_table values (1, 1), (2, 2); +flush tables; +# QUERY: CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) engine=aria,transactional=0 +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 LIKE const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 engine=aria,transactional=0 SELECT * from const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 engine=aria,transactional=0 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 engine=aria,transactional=0 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 engine=aria,transactional=0 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 engine=aria,transactional=0 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 engine=aria,transactional=0 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +Warnings: +Note 1051 Unknown table 'test.t1' diff --git a/mysql-test/suite/atomic/create_replace,expensive_rename,row.result b/mysql-test/suite/atomic/create_replace,expensive_rename,row.result new file mode 100644 index 00000000000..dd8ba62643f --- /dev/null +++ b/mysql-test/suite/atomic/create_replace,expensive_rename,row.result @@ -0,0 +1,584 @@ +# Crash recovery +Table Create Table +const_table CREATE TABLE `const_table` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +insert into const_table values (1, 1), (2, 2); +flush tables; +# QUERY: CREATE OR REPLACE TABLE t1 (new int) +# CRASH POINT: ddl_log_create_before_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_drop_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_rename_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_frm +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_drop +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_binlog +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 LIKE const_table +# CRASH POINT: ddl_log_create_before_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_drop_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_rename_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_frm +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_drop +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_binlog +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 SELECT * from const_table +# CRASH POINT: ddl_log_create_before_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_drop_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_rename_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_frm +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_drop +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_binlog +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_prepare_eof +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +Warnings: +Note 1051 Unknown table 'test.t1' diff --git a/mysql-test/suite/atomic/create_replace,expensive_rename.result b/mysql-test/suite/atomic/create_replace,expensive_rename.result new file mode 100644 index 00000000000..8d64a6cd950 --- /dev/null +++ b/mysql-test/suite/atomic/create_replace,expensive_rename.result @@ -0,0 +1,561 @@ +# Crash recovery +Table Create Table +const_table CREATE TABLE `const_table` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +insert into const_table values (1, 1), (2, 2); +flush tables; +# QUERY: CREATE OR REPLACE TABLE t1 (new int) +# CRASH POINT: ddl_log_create_before_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_drop_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_rename_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_frm +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_drop +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_binlog +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 LIKE const_table +# CRASH POINT: ddl_log_create_before_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_drop_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_rename_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_frm +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_drop +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_binlog +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 SELECT * from const_table +# CRASH POINT: ddl_log_create_before_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_drop_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_log_rename_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_frm +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_create_table +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_drop +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_install_new +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_before_binlog +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_prepare_eof +master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by ddl recovery */ +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +Warnings: +Note 1051 Unknown table 'test.t1' diff --git a/mysql-test/suite/atomic/create_replace,ib,row.result b/mysql-test/suite/atomic/create_replace,ib,row.result new file mode 100644 index 00000000000..84c0ccefcd9 --- /dev/null +++ b/mysql-test/suite/atomic/create_replace,ib,row.result @@ -0,0 +1,661 @@ +# Crash recovery +Table Create Table +const_table CREATE TABLE `const_table` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +insert into const_table values (1, 1), (2, 2); +flush tables; +# QUERY: CREATE OR REPLACE TABLE t1 (new int) +# CRASH POINT: ddl_log_create_before_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 LIKE const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 SELECT * from const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_save_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_binlog +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.TRG +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete2 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +Warnings: +Note 1051 Unknown table 'test.t1' diff --git a/mysql-test/suite/atomic/create_replace,ib.result b/mysql-test/suite/atomic/create_replace,ib.result new file mode 100644 index 00000000000..18b88211e06 --- /dev/null +++ b/mysql-test/suite/atomic/create_replace,ib.result @@ -0,0 +1,648 @@ +# Crash recovery +Table Create Table +const_table CREATE TABLE `const_table` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +insert into const_table values (1, 1), (2, 2); +flush tables; +# QUERY: CREATE OR REPLACE TABLE t1 (new int) +# CRASH POINT: ddl_log_create_before_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 LIKE const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 SELECT * from const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_save_backup +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +t1.TRG +t1.frm +t1.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_binlog +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.frm +t1.ibd +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +Warnings: +Note 1051 Unknown table 'test.t1' diff --git a/mysql-test/suite/atomic/create_replace,myisam,row.result b/mysql-test/suite/atomic/create_replace,myisam,row.result new file mode 100644 index 00000000000..cf4d48c436b --- /dev/null +++ b/mysql-test/suite/atomic/create_replace,myisam,row.result @@ -0,0 +1,710 @@ +# Crash recovery +Table Create Table +const_table CREATE TABLE `const_table` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +insert into const_table values (1, 1), (2, 2); +flush tables; +# QUERY: CREATE OR REPLACE TABLE t1 (new int) +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 LIKE const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 SELECT * from const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +Warnings: +Note 1051 Unknown table 'test.t1' diff --git a/mysql-test/suite/atomic/create_replace,row.result b/mysql-test/suite/atomic/create_replace,row.result new file mode 100644 index 00000000000..7d0a1888fc2 --- /dev/null +++ b/mysql-test/suite/atomic/create_replace,row.result @@ -0,0 +1,710 @@ +# Crash recovery +Table Create Table +const_table CREATE TABLE `const_table` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +insert into const_table values (1, 1), (2, 2); +flush tables; +# QUERY: CREATE OR REPLACE TABLE t1 (new int) +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 LIKE const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 SELECT * from const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) PAGE_CHECKSUM=1 +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) PAGE_CHECKSUM=1 +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) PAGE_CHECKSUM=1 +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) PAGE_CHECKSUM=1 +master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +Warnings: +Note 1051 Unknown table 'test.t1' diff --git a/mysql-test/suite/atomic/create_replace.combinations b/mysql-test/suite/atomic/create_replace.combinations new file mode 100644 index 00000000000..09eb352b1cd --- /dev/null +++ b/mysql-test/suite/atomic/create_replace.combinations @@ -0,0 +1,6 @@ +[ib] +[myisam] +[aria] +[aria_notrans] +[expensive_rename] +[lock_tables] diff --git a/mysql-test/suite/atomic/create_replace.result b/mysql-test/suite/atomic/create_replace.result new file mode 100644 index 00000000000..0bac8d8bb92 --- /dev/null +++ b/mysql-test/suite/atomic/create_replace.result @@ -0,0 +1,696 @@ +# Crash recovery +Table Create Table +const_table CREATE TABLE `const_table` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +insert into const_table values (1, 1), (2, 2); +flush tables; +# QUERY: CREATE OR REPLACE TABLE t1 (new int) +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 (new int) +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 LIKE const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# QUERY: CREATE OR REPLACE TABLE t1 SELECT * from const_table +# CRASH POINT: ddl_log_create_before_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_drop_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_log_rename_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_frm +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_create_table +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_drop +# No crash! +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_after_send_data +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_save_backup +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_install_new +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_before_binlog +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_prepare_eof +t1.DATA1 +t1.DATA2 +t1.TRG +t1.frm +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_after_binlog +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_fk_fail +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail2 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_fk_fail3 +t1.TRG +t1.frm +t1.ibd +t2.frm +t2.ibd +Table Create Table +t1 CREATE TABLE `t1` ( + `old` int(11) NOT NULL, + `y` int(11) DEFAULT NULL, + PRIMARY KEY (`old`) +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +old y +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +a INSERT t1 set @s= 1 BEFORE +# CRASH POINT: ddl_log_create_log_complete +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete2 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +# CRASH POINT: ddl_log_create_log_complete3 +t1.DATA1 +t1.DATA2 +t1.frm +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 SELECT * from const_table +Table Create Table +t1 CREATE TABLE `t1` ( + `new` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=ENGINE DEFAULT CHARSET=latin1 +new b +1 1 +2 2 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +Warnings: +Note 1051 Unknown table 'test.t1' diff --git a/mysql-test/suite/atomic/create_replace.test b/mysql-test/suite/atomic/create_replace.test new file mode 100644 index 00000000000..7cb6d349444 --- /dev/null +++ b/mysql-test/suite/atomic/create_replace.test @@ -0,0 +1,211 @@ +--source include/have_debug.inc +--source include/have_sequence.inc +--source include/have_innodb.inc +--source include/binlog_formats.inc +--source include/not_valgrind.inc + +--disable_query_log +let $default_engine=InnoDB; +let $extra_option= ''; +let $save_debug=`select @@debug_dbug`; +let $show_error=0; +let $drop_error=0; + +if ($MTR_COMBINATION_MYISAM) +{ + let $default_engine=MyISAM; +} +if ($MTR_COMBINATION_ARIA) +{ + let $default_engine=Aria; + call mtr.add_suppression("Checking table"); + call mtr.add_suppression("marked as crashed"); +} +if ($MTR_COMBINATION_ARIA_NOTRANS) +{ + let $default_engine=Aria; + let $extra_option=' engine=aria,transactional=0'; + call mtr.add_suppression("Checking table"); + call mtr.add_suppression("marked as crashed"); +} +if ($MTR_COMBINATION_EXPENSIVE_RENAME) +{ + # Disable atomic CREATE OR REPLACE (emulates HTON_EXPENSIVE_RENAME flag) + let $default_engine=MyISAM; + let $show_error=0, ER_NO_SUCH_TABLE; + let $drop_error=0, ER_BAD_TABLE_ERROR; + set @@debug_dbug="+d,ddl_log_expensive_rename"; +} +if ($MTR_COMBINATION_LOCK_TABLES) +{ + let $default_engine=Aria; + call mtr.add_suppression("Checking table"); + call mtr.add_suppression("marked as crashed"); +} + +if ($MTR_COMBINATION_STMT) +{ + let $binlog_format=include/set_binlog_format_statement.sql; +} +if ($MTR_COMBINATION_ROW) +{ + let $binlog_format=include/set_binlog_format_row.sql; +} +if ($MTR_COMBINATION_MIX) +{ + --skip same as stmt +} + +--eval set @@default_storage_engine=$default_engine +--enable_query_log + +--echo # Crash recovery + +let $MYSQLD_DATADIR= `SELECT @@datadir`; + +let $crash_count=19; +let $crash_points='ddl_log_create_before_install_new', + 'ddl_log_create_after_log_drop_backup', + 'ddl_log_create_after_log_rename_backup', + 'ddl_log_create_before_create_frm', + 'ddl_log_create_before_create_table', + 'ddl_log_create_after_create_table', + 'ddl_log_create_after_drop', + 'ddl_log_create_after_send_data', + 'ddl_log_create_after_save_backup', + 'ddl_log_create_after_install_new', + 'ddl_log_create_before_binlog', + 'ddl_log_create_after_prepare_eof', + 'ddl_log_create_after_binlog', + 'ddl_log_create_fk_fail', + 'ddl_log_create_fk_fail2', + 'ddl_log_create_fk_fail3', + 'ddl_log_create_log_complete', + 'ddl_log_create_log_complete2', + 'ddl_log_create_log_complete3'; + +#let $crash_count=1; +#let $crash_points='ddl_log_create_fk_fail'; +# 'ddl_log_create_before_binlog3', +# 'ddl_log_create_before_binlog4'; + +let $statement_count=3; +let $statements='CREATE OR REPLACE TABLE t1 (new int) EXTRA_OPTION', + 'CREATE OR REPLACE TABLE t1 LIKE const_table', + 'CREATE OR REPLACE TABLE t1 EXTRA_OPTION SELECT * from const_table'; + +#let $statement_count=1; +#let $statements='CREATE OR REPLACE TABLE t1 EXTRA_OPTION SELECT * from const_table'; + +--disable_query_log +let create_const=`select REPLACE('create table const_table (new int, b int) EXTRA_OPTION', ' EXTRA_OPTION', $extra_option)`; +eval $create_const; +--replace_result $default_engine ENGINE ' PAGE_CHECKSUM=1' '' ' TRANSACTIONAL=0' '' +show create table const_table; +--enable_query_log +insert into const_table values (1, 1), (2, 2); +flush tables; + +let $old_debug=`select @@debug_dbug`; + +let $keep_include_silent=1; +let $grep_script=CREATE|DROP; +--disable_query_log + +let $r=0; +while ($r < $statement_count) +{ + inc $r; + let $STATEMENT=`select REPLACE(ELT($r, $statements), ' EXTRA_OPTION', $extra_option)`; + --echo # QUERY: $STATEMENT + + let $c=0; + while ($c < $crash_count) + { + inc $c; + let $crash= `select ELT($c, $crash_points)`; + let $fk_error= `select '$crash' like 'ddl_log_create_fk_fail%'`; + + --eval set @@default_storage_engine=$default_engine + create or replace table t1 (old int); + if ($fk_error) + { + create or replace table t1 (old int primary key, y int) engine innodb; + create table t2 (x int references t1(old)) engine innodb; + } + create trigger a before insert on t1 for each row set @s= 1; + flush tables; + if ($MTR_COMBINATION_LOCK_TABLES) + { + lock tables t1 write, const_table read; + } + + --source $binlog_format + + 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 ($MTR_COMBINATION_LOCK_TABLES) + { + unlock tables; + } + } + # Check which tables still exists + --replace_result .MAD .DATA1 .MYD .DATA1 .MAI .DATA2 .MYI .DATA2 + --list_files $MYSQLD_DATADIR/test t* + --list_files $MYSQLD_DATADIR/test *sql* + + --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 + } + + if ($default_engine == Aria) + { + # Again we suppress 'marked as crashed', it works differently in --ps + --disable_warnings + } + --replace_result $default_engine ENGINE InnoDB ENGINE ' PAGE_CHECKSUM=1' '' ' TRANSACTIONAL=0' '' + --error $show_error + show create table t1; + --enable_warnings + if (`select locate('SELECT', '$STATEMENT')`) + { + --error $show_error + select * from t1; + } + --enable_warnings + --replace_column 6 '' 7 '' 8 '' 9 '' 10 '' 11 '' + show triggers; + # Drop the tables. The warnings will show what was dropped + if ($fk_error) + { + drop table t2; + } + --disable_warnings + --error $drop_error + drop table t1; + --enable_warnings + } +} +drop table if exists t1,const_table; +--eval set @@debug_dbug="$save_debug" + +--enable_query_log diff --git a/mysql-test/suite/atomic/create_table.result b/mysql-test/suite/atomic/create_table.result index acc78c76d25..aa22e3cb0ed 100644 --- a/mysql-test/suite/atomic/create_table.result +++ b/mysql-test/suite/atomic/create_table.result @@ -55,7 +55,6 @@ t2.MYI t2.frm master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int) crash point: ddl_log_create_log_complete -"No crash!" t1.MYD t1.MYI t1.frm @@ -63,40 +62,6 @@ t2.MYD t2.MYI t2.frm master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int) -query: CREATE OR REPLACE TABLE t2 (a int) -crash point: ddl_log_create_before_create_frm -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: storage_engine_middle_of_create -"No crash!" -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 (a int) -crash point: ddl_log_create_before_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_drop -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_before_binlog -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_prepare_eof -"No crash!" -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 (a int) -crash point: ddl_log_create_after_binlog -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 (a int) -crash point: ddl_log_create_log_complete -"No crash!" -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 (a int) query: CREATE TABLE t1 LIKE const_table crash point: ddl_log_create_before_create_frm t2.MYD @@ -150,7 +115,6 @@ t2.MYI t2.frm master-bin.000001 # Query # # use `test`; CREATE TABLE t1 LIKE const_table crash point: ddl_log_create_log_complete -"No crash!" t1.MYD t1.MYI t1.frm @@ -158,40 +122,6 @@ t2.MYD t2.MYI t2.frm master-bin.000001 # Query # # use `test`; CREATE TABLE t1 LIKE const_table -query: CREATE OR REPLACE TABLE t2 LIKE const_table -crash point: ddl_log_create_before_create_frm -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: storage_engine_middle_of_create -"No crash!" -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 LIKE const_table -crash point: ddl_log_create_before_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_drop -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_before_binlog -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_prepare_eof -"No crash!" -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 LIKE const_table -crash point: ddl_log_create_after_binlog -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 LIKE const_table -crash point: ddl_log_create_log_complete -"No crash!" -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 LIKE const_table query: CREATE TABLE t1 SELECT * from t2 crash point: ddl_log_create_before_create_frm t2.MYD @@ -238,16 +168,9 @@ t2.MYD t2.MYI t2.frm crash point: ddl_log_create_after_binlog -t1.MYD -t1.MYI -t1.frm t2.MYD t2.MYI t2.frm -master-bin.000001 # Query # # use `test`; CREATE TABLE `t1` ( - `seq` bigint(20) unsigned NOT NULL -) -master-bin.000001 # Annotate_rows # # CREATE TABLE t1 SELECT * from t2 crash point: ddl_log_create_log_complete t1.MYD t1.MYI @@ -259,47 +182,6 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE `t1` ( `seq` bigint(20) unsigned NOT NULL ) master-bin.000001 # Annotate_rows # # CREATE TABLE t1 SELECT * from t2 -query: CREATE OR REPLACE TABLE t2 SELECT * from const_table -crash point: ddl_log_create_before_create_frm -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: storage_engine_middle_of_create -"No crash!" -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t2` ( - `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT NULL -) -master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t2 SELECT * from const_table -crash point: ddl_log_create_before_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_drop -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_before_binlog -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_prepare_eof -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_binlog -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t2` ( - `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT NULL -) -master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t2 SELECT * from const_table -crash point: ddl_log_create_log_complete -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t2` ( - `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT NULL -) -master-bin.000001 # Annotate_rows # # CREATE OR REPLACE TABLE t2 SELECT * from const_table engine: innodb query: CREATE TABLE t1 (a int) crash point: ddl_log_create_before_create_frm @@ -342,42 +224,11 @@ t2.frm t2.ibd master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int) crash point: ddl_log_create_log_complete -"No crash!" t1.frm t1.ibd t2.frm t2.ibd master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int) -query: CREATE OR REPLACE TABLE t2 (a int) -crash point: ddl_log_create_before_create_frm -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: storage_engine_middle_of_create -"No crash!" -t2.frm -t2.ibd -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 (a int) -crash point: ddl_log_create_before_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_drop -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_before_binlog -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_prepare_eof -"No crash!" -t2.frm -t2.ibd -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 (a int) -crash point: ddl_log_create_after_binlog -t2.frm -t2.ibd -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 (a int) -crash point: ddl_log_create_log_complete -"No crash!" -t2.frm -t2.ibd -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 (a int) query: CREATE TABLE t1 LIKE const_table crash point: ddl_log_create_before_create_frm t2.frm @@ -423,47 +274,12 @@ t2.frm t2.ibd master-bin.000001 # Query # # use `test`; CREATE TABLE t1 LIKE const_table crash point: ddl_log_create_log_complete -"No crash!" t1.MYD t1.MYI t1.frm t2.frm t2.ibd master-bin.000001 # Query # # use `test`; CREATE TABLE t1 LIKE const_table -query: CREATE OR REPLACE TABLE t2 LIKE const_table -crash point: ddl_log_create_before_create_frm -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: storage_engine_middle_of_create -"No crash!" -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 LIKE const_table -crash point: ddl_log_create_before_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_drop -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_before_binlog -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_prepare_eof -"No crash!" -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 LIKE const_table -crash point: ddl_log_create_after_binlog -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 LIKE const_table -crash point: ddl_log_create_log_complete -"No crash!" -t2.MYD -t2.MYI -t2.frm -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 LIKE const_table query: CREATE TABLE t1 SELECT * from t2 crash point: ddl_log_create_before_create_frm t2.frm @@ -494,44 +310,17 @@ t2.ibd crash point: ddl_log_create_after_prepare_eof t2.frm t2.ibd -master-bin.000001 # Query # # use `test`; CREATE TABLE t1 SELECT * from t2 -master-bin.000002 # Query # # DROP TABLE IF EXISTS `test`.`t1` /* generated by ddl recovery */ crash point: ddl_log_create_after_binlog +t1.frm +t1.ibd t2.frm t2.ibd master-bin.000001 # Query # # use `test`; CREATE TABLE t1 SELECT * from t2 -master-bin.000002 # Query # # DROP TABLE IF EXISTS `test`.`t1` /* generated by ddl recovery */ crash point: ddl_log_create_log_complete t1.frm t1.ibd t2.frm t2.ibd master-bin.000001 # Query # # use `test`; CREATE TABLE t1 SELECT * from t2 -query: CREATE OR REPLACE TABLE t2 SELECT * from const_table -crash point: ddl_log_create_before_create_frm -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: storage_engine_middle_of_create -"No crash!" -t2.frm -t2.ibd -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 SELECT * from const_table -crash point: ddl_log_create_before_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_create_table -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_drop -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_before_binlog -master-bin.000002 # Query # # use `test`; DROP TABLE IF EXISTS `t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_prepare_eof -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 SELECT * from const_table -master-bin.000002 # Query # # DROP TABLE IF EXISTS `test`.`t2` /* generated by ddl recovery */ -crash point: ddl_log_create_after_binlog -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 SELECT * from const_table -master-bin.000002 # Query # # DROP TABLE IF EXISTS `test`.`t2` /* generated by ddl recovery */ -crash point: ddl_log_create_log_complete -t2.frm -t2.ibd -master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t2 SELECT * from const_table Warnings: Note 1051 Unknown table 'test.t1,test.t2' diff --git a/mysql-test/suite/atomic/create_table.test b/mysql-test/suite/atomic/create_table.test index ff53a12ebab..d2b63de877d 100644 --- a/mysql-test/suite/atomic/create_table.test +++ b/mysql-test/suite/atomic/create_table.test @@ -30,13 +30,10 @@ if ($engine_count == "") let $crash_count=9; let $crash_points='ddl_log_create_before_create_frm', 'storage_engine_middle_of_create', 'ddl_log_create_before_create_table', 'ddl_log_create_after_create_table', 'ddl_log_create_after_drop', 'ddl_log_create_before_binlog', 'ddl_log_create_after_prepare_eof', 'ddl_log_create_after_binlog', 'ddl_log_create_log_complete'; -let $statement_count=6; +let $statement_count=3; let $statements='CREATE TABLE t1 (a int)', - 'CREATE OR REPLACE TABLE t2 (a int)', 'CREATE TABLE t1 LIKE const_table', - 'CREATE OR REPLACE TABLE t2 LIKE const_table', - 'CREATE TABLE t1 SELECT * from t2', - 'CREATE OR REPLACE TABLE t2 SELECT * from const_table'; + 'CREATE TABLE t1 SELECT * from t2'; create table const_table (a int, b int) engine=myisam; insert into const_table values (1,1),(2,2); @@ -54,6 +51,8 @@ while ($e < $engine_count) inc $e; let $engine=`select ELT($e, $engines)`; let $default_engine=$engine; + # Note: $extra_option is not used. This dead code here is for conformity with + # other tests. let $extra_option=; if ($engine == "aria") diff --git a/mysql-test/suite/binlog/include/binlog.test b/mysql-test/suite/binlog/include/binlog.test index 9f3288b52f0..1061cf51018 100644 --- a/mysql-test/suite/binlog/include/binlog.test +++ b/mysql-test/suite/binlog/include/binlog.test @@ -419,6 +419,7 @@ create table t (old_table_field int); create or replace table t as select 1 as b, 2 as b; --error ER_DUP_FIELDNAME create or replace temporary table t as select 1 as b, 2 as b; +drop table t; create table t (new_table_field int); --source include/show_binlog_events.inc diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index fa111106cd6..c0e4e6f46be 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -1085,14 +1085,14 @@ create or replace table t as select 1 as b, 2 as b; ERROR 42S21: Duplicate column name 'b' create or replace temporary table t as select 1 as b, 2 as b; ERROR 42S21: Duplicate column name 'b' +drop table t; create table t (new_table_field int); include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create table t (old_table_field int) -master-bin.000001 # Gtid # # BEGIN GTID #-#-# -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */ -master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE `t` /* generated by server */ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create table t (new_table_field int) drop table t; diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index f48b624ec21..dc0b3c2b4a1 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -682,15 +682,16 @@ create or replace table t as select 1 as b, 2 as b; ERROR 42S21: Duplicate column name 'b' create or replace temporary table t as select 1 as b, 2 as b; ERROR 42S21: Duplicate column name 'b' +drop table t; create table t (new_table_field int); include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create table t (old_table_field int) master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */ -master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */ master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE `t` /* generated by server */ +master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create table t (new_table_field int) drop table t; diff --git a/mysql-test/suite/binlog/r/binlog_write_error.result b/mysql-test/suite/binlog/r/binlog_write_error.result index 46a233718d9..eb83a1805e6 100644 --- a/mysql-test/suite/binlog/r/binlog_write_error.result +++ b/mysql-test/suite/binlog/r/binlog_write_error.result @@ -9,6 +9,8 @@ CREATE TABLE t1 (a INT); ERROR HY000: Error writing file 'master-bin' ((errno: #) set @@global.debug_dbug = @saved_dbug; INSERT INTO t1 VALUES (1),(2),(3); +ERROR 42S02: Table 'test.t1' doesn't exist +CREATE TABLE t1 (a INT); set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; INSERT INTO t1 VALUES (4),(5),(6); diff --git a/mysql-test/suite/binlog/t/binlog_write_error.test b/mysql-test/suite/binlog/t/binlog_write_error.test index bd1cb5301b3..f62d1f1fd49 100644 --- a/mysql-test/suite/binlog/t/binlog_write_error.test +++ b/mysql-test/suite/binlog/t/binlog_write_error.test @@ -30,8 +30,11 @@ call mtr.add_suppression("Write to binary log failed: Error writing file*"); let $query= CREATE TABLE t1 (a INT); source include/binlog_inject_error.inc; +--error ER_NO_SUCH_TABLE INSERT INTO t1 VALUES (1),(2),(3); +CREATE TABLE t1 (a INT); + let $query= INSERT INTO t1 VALUES (4),(5),(6); source include/binlog_inject_error.inc; diff --git a/mysql-test/suite/binlog_encryption/binlog_write_error.result b/mysql-test/suite/binlog_encryption/binlog_write_error.result index 46a233718d9..eb83a1805e6 100644 --- a/mysql-test/suite/binlog_encryption/binlog_write_error.result +++ b/mysql-test/suite/binlog_encryption/binlog_write_error.result @@ -9,6 +9,8 @@ CREATE TABLE t1 (a INT); ERROR HY000: Error writing file 'master-bin' ((errno: #) set @@global.debug_dbug = @saved_dbug; INSERT INTO t1 VALUES (1),(2),(3); +ERROR 42S02: Table 'test.t1' doesn't exist +CREATE TABLE t1 (a INT); set @saved_dbug = @@global.debug_dbug; SET GLOBAL debug_dbug='d,injecting_fault_writing'; INSERT INTO t1 VALUES (4),(5),(6); diff --git a/mysql-test/suite/parts/r/backup_log.result b/mysql-test/suite/parts/r/backup_log.result index 3a220491027..9b745eb8fa0 100644 --- a/mysql-test/suite/parts/r/backup_log.result +++ b/mysql-test/suite/parts/r/backup_log.result @@ -67,7 +67,7 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY' create table t32 (a int) PARTITION BY HASH(a) PARTITIONS 2; drop table if exists t30,t31,t32,tmp_t30; Warnings: -Note 1051 Unknown table 'test.t31,test.tmp_t30' +Note 1051 Unknown table 'test.tmp_t30' # # Testing create LIKE # @@ -208,70 +208,69 @@ CREATE,MyISAM,1,test,t30,id: 8,,0,,, CREATE,MyISAM,1,test,t31,id: 9,,0,,, DROP,MyISAM,1,test,t31,id: 9,,0,,, CREATE,MyISAM,0,test,t31,id: 10,,0,,, -DROP,MyISAM,0,test,t31,id: 10,,0,,, -DROP_AFTER_CREATE,MyISAM,1,test,t31,id: 11,,0,,, -CREATE,MyISAM,1,test,t32,id: 12,,0,,, +CREATE,MyISAM,1,test,t32,id: 11,,0,,, DROP,MyISAM,1,test,t30,id: 8,,0,,, -DROP,MyISAM,1,test,t32,id: 12,,0,,, -CREATE,MyISAM,1,test,t40,id: 13,,0,,, -CREATE,InnoDB,1,test,t41,id: 14,,0,,, +DROP,MyISAM,0,test,t31,id: 10,,0,,, +DROP,MyISAM,1,test,t32,id: 11,,0,,, +CREATE,MyISAM,1,test,t40,id: 12,,0,,, +CREATE,InnoDB,1,test,t41,id: 13,,0,,, +CREATE,partition,0,test,t42,id: 14,,0,,, +DROP,MyISAM,1,test,t42,id: 14,,0,,, CREATE,partition,0,test,t42,id: 15,,0,,, -DROP,MyISAM,1,test,t42,id: 15,,0,,, -CREATE,partition,0,test,t42,id: 16,,0,,, -DROP,MyISAM,1,test,t40,id: 13,,0,,, -DROP,InnoDB,1,test,t41,id: 14,,0,,, -DROP,InnoDB,1,test,t42,id: 16,,0,,, -CREATE,MyISAM,1,test,t50,id: 17,,0,,, -CREATE,MyISAM,1,test,t51,id: 18,,0,,, -RENAME,MyISAM,1,test,t50,id: 17,MyISAM,1,test,t52,id: 17 -RENAME,MyISAM,1,test,t51,id: 18,MyISAM,1,test,t53,id: 18 -RENAME,MyISAM,1,test,t52,id: 17,MyISAM,1,test,tmp,id: 17 -RENAME,MyISAM,1,test,t53,id: 18,MyISAM,1,test,t52,id: 18 -RENAME,MyISAM,1,test,tmp,id: 17,MyISAM,1,test,t53,id: 17 -DROP,MyISAM,1,test,t52,id: 18,,0,,, -DROP,MyISAM,1,test,t53,id: 17,,0,,, -CREATE,Aria,1,test,t60,id: 19,,0,,, -CHANGE_INDEX,Aria,1,test,t60,id: 19,,0,,, -CHANGE_INDEX,Aria,1,test,t60,id: 19,,0,,, -DROP,Aria,1,test,t60,id: 19,,0,,, -CREATE,Aria,1,test,t70,id: 20,,0,,, -BULK_INSERT,Aria,1,test,t70,id: 20,,0,,, -BULK_INSERT,Aria,1,test,t70,id: 20,,0,,, -TRUNCATE,Aria,1,test,t70,id: 20,,0,,, -BULK_INSERT,Aria,1,test,t70,id: 20,,0,,, -BULK_INSERT,Aria,1,test,t70,id: 20,,0,,, -CREATE,Aria,1,test,t71,id: 21,,0,,, -BULK_INSERT,Aria,1,test,t71,id: 21,,0,,, -BULK_INSERT,Aria,1,test,t71,id: 21,,0,,, -DROP,Aria,1,test,t70,id: 20,,0,,, -DROP,Aria,1,test,t71,id: 21,,0,,, -CREATE,MyISAM,1,test,t@00201,id: 22,,0,,, -DROP,MyISAM,1,test,t@00201,id: 22,,0,,, -CREATE,MyISAM,1,test,t80,id: 23,,0,,, +DROP,MyISAM,1,test,t40,id: 12,,0,,, +DROP,InnoDB,1,test,t41,id: 13,,0,,, +DROP,InnoDB,1,test,t42,id: 15,,0,,, +CREATE,MyISAM,1,test,t50,id: 16,,0,,, +CREATE,MyISAM,1,test,t51,id: 17,,0,,, +RENAME,MyISAM,1,test,t50,id: 16,MyISAM,1,test,t52,id: 16 +RENAME,MyISAM,1,test,t51,id: 17,MyISAM,1,test,t53,id: 17 +RENAME,MyISAM,1,test,t52,id: 16,MyISAM,1,test,tmp,id: 16 +RENAME,MyISAM,1,test,t53,id: 17,MyISAM,1,test,t52,id: 17 +RENAME,MyISAM,1,test,tmp,id: 16,MyISAM,1,test,t53,id: 16 +DROP,MyISAM,1,test,t52,id: 17,,0,,, +DROP,MyISAM,1,test,t53,id: 16,,0,,, +CREATE,Aria,1,test,t60,id: 18,,0,,, +CHANGE_INDEX,Aria,1,test,t60,id: 18,,0,,, +CHANGE_INDEX,Aria,1,test,t60,id: 18,,0,,, +DROP,Aria,1,test,t60,id: 18,,0,,, +CREATE,Aria,1,test,t70,id: 19,,0,,, +BULK_INSERT,Aria,1,test,t70,id: 19,,0,,, +BULK_INSERT,Aria,1,test,t70,id: 19,,0,,, +TRUNCATE,Aria,1,test,t70,id: 19,,0,,, +BULK_INSERT,Aria,1,test,t70,id: 19,,0,,, +BULK_INSERT,Aria,1,test,t70,id: 19,,0,,, +CREATE,Aria,1,test,t71,id: 20,,0,,, +BULK_INSERT,Aria,1,test,t71,id: 20,,0,,, +BULK_INSERT,Aria,1,test,t71,id: 20,,0,,, +DROP,Aria,1,test,t70,id: 19,,0,,, +DROP,Aria,1,test,t71,id: 20,,0,,, +CREATE,MyISAM,1,test,t@00201,id: 21,,0,,, +DROP,MyISAM,1,test,t@00201,id: 21,,0,,, +CREATE,MyISAM,1,test,t80,id: 22,,0,,, CREATE,VIEW,0,test,v1,,,0,,, CREATE,TRIGGER,0,test,trg,,,0,,, DROP,TRIGGER,0,test,trg,,,0,,, DROP,VIEW,0,test,v1,,,0,,, -DROP,MyISAM,1,test,t80,id: 23,,0,,, -CREATE,MyISAM,1,test,t85,id: 24,,0,,, -ALTER,MyISAM,1,test,t85,id: 24,InnoDB,1,test,t85,id: 25 -DROP,InnoDB,1,test,t85,id: 25,,0,,, -CREATE,Aria,0,test,t200,id: 26,,0,,, -ALTER,Aria,0,test,t200,id: 26,Aria,1,test,t200,id: 27 -CREATE,Aria,0,test,t210,id: 28,,0,,, -EXCHANGE_PARTITION,Aria,1,test,t200,id: 27,Aria,0,test,t210,id: 28 -ALTER,Aria,1,test,t200,id: 27,Aria,1,test,t200,id: 29 +DROP,MyISAM,1,test,t80,id: 22,,0,,, +CREATE,MyISAM,1,test,t85,id: 23,,0,,, +ALTER,MyISAM,1,test,t85,id: 23,InnoDB,1,test,t85,id: 24 +DROP,InnoDB,1,test,t85,id: 24,,0,,, +CREATE,Aria,0,test,t200,id: 25,,0,,, +ALTER,Aria,0,test,t200,id: 25,Aria,1,test,t200,id: 26 +CREATE,Aria,0,test,t210,id: 27,,0,,, +EXCHANGE_PARTITION,Aria,1,test,t200,id: 26,Aria,0,test,t210,id: 27 +ALTER,Aria,1,test,t200,id: 26,Aria,1,test,t200,id: 28 +ALTER,Aria,1,test,t200,id: 28,Aria,1,test,t200,id: 29 ALTER,Aria,1,test,t200,id: 29,Aria,1,test,t200,id: 30 ALTER,Aria,1,test,t200,id: 30,Aria,1,test,t200,id: 31 ALTER,Aria,1,test,t200,id: 31,Aria,1,test,t200,id: 32 ALTER,Aria,1,test,t200,id: 32,Aria,1,test,t200,id: 33 ALTER,Aria,1,test,t200,id: 33,Aria,1,test,t200,id: 34 -ALTER,Aria,1,test,t200,id: 34,Aria,1,test,t200,id: 35 -ALTER,Aria,1,test,t200,id: 35,Aria,0,test,t200,id: 36 -DROP,Aria,0,test,t200,id: 36,,0,,, -DROP,Aria,0,test,t210,id: 28,,0,,, -CREATE,Aria,1,test,t220,id: 37,,0,,, -DROP,Aria,1,test,t220,id: 37,,0,,, +ALTER,Aria,1,test,t200,id: 34,Aria,0,test,t200,id: 35 +DROP,Aria,0,test,t200,id: 35,,0,,, +DROP,Aria,0,test,t210,id: 27,,0,,, +CREATE,Aria,1,test,t220,id: 36,,0,,, +DROP,Aria,1,test,t220,id: 36,,0,,, # # Cleanup # diff --git a/mysql-test/suite/rpl/r/create_or_replace2,stmt.rdiff b/mysql-test/suite/rpl/r/create_or_replace2,stmt.rdiff new file mode 100644 index 00000000000..52dd3828b38 --- /dev/null +++ b/mysql-test/suite/rpl/r/create_or_replace2,stmt.rdiff @@ -0,0 +1,17 @@ +--- create_or_replace2.result ++++ create_or_replace2,stmt.reject +@@ -34,9 +34,11 @@ + master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) + RETURN ( SELECT MAX(a) FROM t1 ) + master-bin.000001 # Gtid # # GTID #-#-# +-master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( +- `b` int(11) DEFAULT NULL +-) ENGINE=InnoDB ++master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tmp (b INT) ENGINE=InnoDB ++master-bin.000001 # Gtid # # GTID #-#-# ++master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE t1 LIKE tmp ++master-bin.000001 # Gtid # # GTID #-#-# ++master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `tmp` + drop function f1; + drop table t1; + include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/create_or_replace2.result b/mysql-test/suite/rpl/r/create_or_replace2.result index b96a0f8ae13..a179c261281 100644 --- a/mysql-test/suite/rpl/r/create_or_replace2.result +++ b/mysql-test/suite/rpl/r/create_or_replace2.result @@ -26,6 +26,17 @@ unlock tables; connection default; ERROR 42S22: Unknown column 'a' in 'field list' disconnect con1; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) ENGINE=InnoDB +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN ( SELECT MAX(a) FROM t1 ) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t1` ( + `b` int(11) DEFAULT NULL +) ENGINE=InnoDB drop function f1; drop table t1; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/create_or_replace_mix.result b/mysql-test/suite/rpl/r/create_or_replace_mix.result index 9036ab425ae..75f7ca2a828 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_mix.result +++ b/mysql-test/suite/rpl/r/create_or_replace_mix.result @@ -64,13 +64,12 @@ create table t1 (a int); create or replace table t1; ERROR 42000: A table must have at least 1 column drop table if exists t1; -Warnings: -Note 1051 Unknown table 'test.t1' -create or replace table t1 (a int primary key) select a from t2; +create or replace table t1 (b int primary key) select a as b from t2; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' -create table t1 (a int); -create or replace table t1 (a int primary key) select a from t2; +create table t1 (c int); +create or replace table t1 (d int primary key) select a as d from t2; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +drop table t1; create temporary table t9 (a int); create or replace temporary table t9 (a int primary key) select a from t2; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' @@ -80,34 +79,26 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create table t1 (a int) master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; create or replace table t1 -master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; create table t1 (a int) +master-bin.000001 # Query # # use `test`; create table t1 (c int) master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */ +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create temporary table t9 (a int) -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t9`/* Generated to handle failed CREATE OR REPLACE */ connection server_2; show tables; Tables_in_test t2 connection server_1; -create table t1 (a int); +create table t1 (e int); create or replace table t1 (a int, a int) select * from t2; ERROR 42S21: Duplicate column name 'a' include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; create table t1 (a int) -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */ +master-bin.000001 # Query # # use `test`; create table t1 (e int) drop table if exists t1,t2; -Warnings: -Note 1051 Unknown table 'test.t1' drop temporary table if exists t9; Warnings: Note 1051 Unknown table 'test.t9' @@ -159,7 +150,7 @@ slave-bin.000001 # Query # # use `test`; create table t4 (server_2_to_be_delete slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # use `test`; create table t1 (new_table int) slave-bin.000001 # Gtid # # BEGIN GTID #-#-# -slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t2` ( +slave-bin.000001 # Query # # use `test`; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL ) slave-bin.000001 # Annotate_rows # # create table t2 select * from t9 @@ -217,7 +208,7 @@ drop table t1; # connection server_2; connection server_1; -create table t1 (a int); +create table t1 (f int); insert into t1 values (0),(1),(2); create table t2 engine=myisam select * from t1; create or replace table t2 engine=innodb select * from t1; @@ -226,7 +217,7 @@ binlog from server 2 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Gtid # # GTID #-#-# -slave-bin.000001 # Query # # use `test`; create table t1 (a int) +slave-bin.000001 # Query # # use `test`; create table t1 (f int) slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Query # # use `test`; insert into t1 values (0),(1),(2) slave-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/rpl/r/create_or_replace_row.result b/mysql-test/suite/rpl/r/create_or_replace_row.result index 16f92b5e4b6..9b3ffb6777e 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_row.result +++ b/mysql-test/suite/rpl/r/create_or_replace_row.result @@ -92,13 +92,12 @@ create table t1 (a int); create or replace table t1; ERROR 42000: A table must have at least 1 column drop table if exists t1; -Warnings: -Note 1051 Unknown table 'test.t1' -create or replace table t1 (a int primary key) select a from t2; +create or replace table t1 (b int primary key) select a as b from t2; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' -create table t1 (a int); -create or replace table t1 (a int primary key) select a from t2; +create table t1 (c int); +create or replace table t1 (d int primary key) select a as d from t2; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +drop table t1; create temporary table t9 (a int); create or replace temporary table t9 (a int primary key) select a from t2; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' @@ -108,32 +107,24 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create table t1 (a int) master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; create or replace table t1 -master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; create table t1 (a int) -master-bin.000001 # Gtid # # BEGIN GTID #-#-# -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */ -master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # use `test`; create table t1 (c int) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ connection server_2; show tables; Tables_in_test t2 connection server_1; -create table t1 (a int); +create table t1 (e int); create or replace table t1 (a int, a int) select * from t2; ERROR 42S21: Duplicate column name 'a' include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; create table t1 (a int) -master-bin.000001 # Gtid # # BEGIN GTID #-#-# -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */ -master-bin.000001 # Query # # ROLLBACK +master-bin.000001 # Query # # use `test`; create table t1 (e int) drop table if exists t1,t2; -Warnings: -Note 1051 Unknown table 'test.t1' drop temporary table if exists t9; Warnings: Note 1051 Unknown table 'test.t9' @@ -243,7 +234,7 @@ drop table t1; # connection server_2; connection server_1; -create table t1 (a int); +create table t1 (f int); insert into t1 values (0),(1),(2); create table t2 engine=myisam select * from t1; create or replace table t2 engine=innodb select * from t1; @@ -252,7 +243,7 @@ binlog from server 2 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Gtid # # GTID #-#-# -slave-bin.000001 # Query # # use `test`; create table t1 (a int) +slave-bin.000001 # Query # # use `test`; create table t1 (f int) slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Annotate_rows # # insert into t1 values (0),(1),(2) slave-bin.000001 # Table_map # # table_id: # (test.t1) @@ -260,7 +251,7 @@ slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE TABLE `t2` ( - `a` int(11) DEFAULT NULL + `f` int(11) DEFAULT NULL ) ENGINE=MyISAM slave-bin.000001 # Annotate_rows # # create table t2 engine=myisam select * from t1 slave-bin.000001 # Table_map # # table_id: # (test.t2) @@ -268,7 +259,7 @@ slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F slave-bin.000001 # Query # # COMMIT slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t2` ( - `a` int(11) DEFAULT NULL + `f` int(11) DEFAULT NULL ) ENGINE=InnoDB slave-bin.000001 # Annotate_rows # # create or replace table t2 engine=innodb select * from t1 slave-bin.000001 # Table_map # # table_id: # (test.t2) diff --git a/mysql-test/suite/rpl/r/create_or_replace_statement.result b/mysql-test/suite/rpl/r/create_or_replace_statement.result index 9036ab425ae..75f7ca2a828 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_statement.result +++ b/mysql-test/suite/rpl/r/create_or_replace_statement.result @@ -64,13 +64,12 @@ create table t1 (a int); create or replace table t1; ERROR 42000: A table must have at least 1 column drop table if exists t1; -Warnings: -Note 1051 Unknown table 'test.t1' -create or replace table t1 (a int primary key) select a from t2; +create or replace table t1 (b int primary key) select a as b from t2; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' -create table t1 (a int); -create or replace table t1 (a int primary key) select a from t2; +create table t1 (c int); +create or replace table t1 (d int primary key) select a as d from t2; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' +drop table t1; create temporary table t9 (a int); create or replace temporary table t9 (a int primary key) select a from t2; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' @@ -80,34 +79,26 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create table t1 (a int) master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; create or replace table t1 -master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; create table t1 (a int) +master-bin.000001 # Query # # use `test`; create table t1 (c int) master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */ +master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create temporary table t9 (a int) -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t9`/* Generated to handle failed CREATE OR REPLACE */ connection server_2; show tables; Tables_in_test t2 connection server_1; -create table t1 (a int); +create table t1 (e int); create or replace table t1 (a int, a int) select * from t2; ERROR 42S21: Duplicate column name 'a' include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; create table t1 (a int) -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t1`/* Generated to handle failed CREATE OR REPLACE */ +master-bin.000001 # Query # # use `test`; create table t1 (e int) drop table if exists t1,t2; -Warnings: -Note 1051 Unknown table 'test.t1' drop temporary table if exists t9; Warnings: Note 1051 Unknown table 'test.t9' @@ -159,7 +150,7 @@ slave-bin.000001 # Query # # use `test`; create table t4 (server_2_to_be_delete slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # use `test`; create table t1 (new_table int) slave-bin.000001 # Gtid # # BEGIN GTID #-#-# -slave-bin.000001 # Query # # use `test`; CREATE OR REPLACE TABLE `t2` ( +slave-bin.000001 # Query # # use `test`; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL ) slave-bin.000001 # Annotate_rows # # create table t2 select * from t9 @@ -217,7 +208,7 @@ drop table t1; # connection server_2; connection server_1; -create table t1 (a int); +create table t1 (f int); insert into t1 values (0),(1),(2); create table t2 engine=myisam select * from t1; create or replace table t2 engine=innodb select * from t1; @@ -226,7 +217,7 @@ binlog from server 2 include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Gtid # # GTID #-#-# -slave-bin.000001 # Query # # use `test`; create table t1 (a int) +slave-bin.000001 # Query # # use `test`; create table t1 (f int) slave-bin.000001 # Gtid # # BEGIN GTID #-#-# slave-bin.000001 # Query # # use `test`; insert into t1 values (0),(1),(2) slave-bin.000001 # Query # # COMMIT diff --git a/mysql-test/suite/rpl/r/rpl_gtid_strict.result b/mysql-test/suite/rpl/r/rpl_gtid_strict.result index 27e7d105125..8cbc917a1a8 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_strict.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_strict.result @@ -59,7 +59,7 @@ master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) master-bin.000001 # Xid # # COMMIT /* XID */ -*** Test non-transactional GTID error (cannot be rolled back). *** +*** Test non-transactional GTID error. *** SET server_id= 3; SET gtid_seq_no= 1; ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled @@ -68,9 +68,6 @@ SET gtid_seq_no= 1; SET SESSION debug_dbug=@old_dbug; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled -SET sql_log_bin= 0; -DROP TABLE t2; -SET sql_log_bin= 1; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; SET gtid_seq_no= 1; ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-3-5, and gtid strict mode is enabled diff --git a/mysql-test/suite/rpl/t/create_or_replace.inc b/mysql-test/suite/rpl/t/create_or_replace.inc index df46cc36e97..bdde953f7dc 100644 --- a/mysql-test/suite/rpl/t/create_or_replace.inc +++ b/mysql-test/suite/rpl/t/create_or_replace.inc @@ -47,12 +47,13 @@ create or replace table t1; drop table if exists t1; # The following is not logged as t1 does not exists; --error ER_DUP_ENTRY -create or replace table t1 (a int primary key) select a from t2; +create or replace table t1 (b int primary key) select a as b from t2; -create table t1 (a int); +create table t1 (c int); # This should as a delete as we will delete t1 --error ER_DUP_ENTRY -create or replace table t1 (a int primary key) select a from t2; +create or replace table t1 (d int primary key) select a as d from t2; +drop table t1; # Same with temporary table create temporary table t9 (a int); @@ -69,7 +70,7 @@ show tables; connection server_1; --let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1) -create table t1 (a int); +create table t1 (e int); --error ER_DUP_FIELDNAME create or replace table t1 (a int, a int) select * from t2; --source include/show_binlog_events.inc @@ -169,7 +170,7 @@ sync_with_master; --let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1) connection server_1; -create table t1 (a int); +create table t1 (f int); insert into t1 values (0),(1),(2); create table t2 engine=myisam select * from t1; create or replace table t2 engine=innodb select * from t1; diff --git a/mysql-test/suite/rpl/t/create_or_replace2.test b/mysql-test/suite/rpl/t/create_or_replace2.test index f0091db7fb9..0208be577a7 100644 --- a/mysql-test/suite/rpl/t/create_or_replace2.test +++ b/mysql-test/suite/rpl/t/create_or_replace2.test @@ -36,6 +36,8 @@ unlock tables; --reap --disconnect con1 +--source include/show_binlog_events.inc + # Cleanup drop function f1; drop table t1; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_strict.test b/mysql-test/suite/rpl/t/rpl_gtid_strict.test index 56ebba824c4..7cbd6304c10 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_strict.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_strict.test @@ -49,7 +49,7 @@ INSERT INTO t1 VALUES (4); SELECT * FROM t1 ORDER BY 1; --source include/show_binlog_events.inc ---echo *** Test non-transactional GTID error (cannot be rolled back). *** +--echo *** Test non-transactional GTID error. *** SET server_id= 3; --error ER_GTID_STRICT_OUT_OF_ORDER SET gtid_seq_no= 1; @@ -58,11 +58,6 @@ SET gtid_seq_no= 1; SET SESSION debug_dbug=@old_dbug; --error ER_GTID_STRICT_OUT_OF_ORDER CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; -# The table is still created, DDL cannot be rolled back. -# Fix it up for replication. -SET sql_log_bin= 0; -DROP TABLE t2; -SET sql_log_bin= 1; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; --error ER_GTID_STRICT_OUT_OF_ORDER diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc index 35a3f54e61f..afcf2e6497e 100644 --- a/sql/ddl_log.cc +++ b/sql/ddl_log.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2010, 2021, MariaDB + Copyright (c) 2010, 2022, MariaDB 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 @@ -135,6 +135,13 @@ public: char current_db[NAME_LEN]; uint execute_entry_pos; ulonglong xid; + void free() + { + drop_table.free(); + drop_view.free(); + query.free(); + db.free(); + } }; static st_global_ddl_log global_ddl_log; @@ -455,7 +462,7 @@ bool ddl_log_disable_execute_entry(DDL_LOG_MEMORY_ENTRY **active_entry) static bool is_execute_entry_active(uint entry_pos) { uchar buff[1]; - DBUG_ENTER("disable_execute_entry"); + DBUG_ENTER("is_execute_entry_active"); if (mysql_file_pread(global_ddl_log.file_id, buff, sizeof(buff), global_ddl_log.io_size * entry_pos + @@ -963,11 +970,12 @@ static bool build_filename_and_delete_tmp_file(char *path, size_t path_length, const LEX_CSTRING *db, const LEX_CSTRING *name, const char *ext, - PSI_file_key psi_key) + PSI_file_key psi_key, + uint flags) { bool deleted; uint length= build_table_filename(path, path_length-1, - db->str, name->str, ext, 0); + db->str, name->str, ext, flags); path[length]= '~'; path[length+1]= 0; deleted= mysql_file_delete(psi_key, path, MYF(0)) != 0; @@ -1081,15 +1089,15 @@ static handler *create_handler(THD *thd, MEM_ROOT *mem_root, 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) +static int 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; + int error; DBUG_ENTER("execute_rename_table"); if (file->needs_lower_case_filenames()) @@ -1104,12 +1112,12 @@ static void execute_rename_table(DDL_LOG_ENTRY *ddl_log_entry, handler *file, { fr_length= build_table_filename(from_path, FN_REFLEN, from_db->str, from_table->str, "", - flags & FN_TO_IS_TMP); + flags & FN_FROM_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); + error= file->ha_rename_table(from_path, to_path); if (file->needs_lower_case_filenames()) { /* @@ -1130,7 +1138,7 @@ static void execute_rename_table(DDL_LOG_ENTRY *ddl_log_entry, handler *file, } if (!access(from_path, F_OK)) (void) mysql_file_rename(key_file_frm, from_path, to_path, MYF(MY_WME)); - DBUG_VOID_RETURN; + DBUG_RETURN(error); } @@ -1144,7 +1152,7 @@ static void execute_rename_table(DDL_LOG_ENTRY *ddl_log_entry, handler *file, */ static void rename_triggers(THD *thd, DDL_LOG_ENTRY *ddl_log_entry, - bool swap_tables) + bool swap_tables, uint flags) { 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]; @@ -1166,10 +1174,10 @@ static void rename_triggers(THD *thd, DDL_LOG_ENTRY *ddl_log_entry, build_filename_and_delete_tmp_file(from_path, sizeof(from_path), &from_db, &from_table, - TRG_EXT, key_file_trg); + TRG_EXT, key_file_trg, flags & FN_FROM_IS_TMP); build_filename_and_delete_tmp_file(to_path, sizeof(to_path), &to_db, &to_table, - TRG_EXT, key_file_trg); + TRG_EXT, key_file_trg, flags & FN_TO_IS_TMP); if (lower_case_table_names) { uint errors; @@ -1295,15 +1303,15 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root, handlerton *hton= 0; ddl_log_error_handler no_such_table_handler; uint entry_pos= ddl_log_entry->entry_pos; - int error; + int error= 0; + uint fn_flags= 0; bool frm_action= FALSE; DBUG_ENTER("ddl_log_execute_action"); mysql_mutex_assert_owner(&LOCK_gdl); DBUG_PRINT("ddl_log", - ("pos: %u=>%u->%u type: %u action: %u (%s) phase: %u " + ("pos: %u->%u type: %u action: %u (%s) phase: %u " "handler: '%s' name: '%s' from_name: '%s' tmp_name: '%s'", - recovery_state.execute_entry_pos, ddl_log_entry->entry_pos, ddl_log_entry->next_entry, (uint) ddl_log_entry->entry_type, @@ -1331,6 +1339,11 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root, hton= file->ht; } + if (ddl_log_entry->flags & DDL_LOG_FLAG_FROM_IS_TMP) + fn_flags|= FN_FROM_IS_TMP; + if (ddl_log_entry->flags & DDL_LOG_FLAG_TO_IS_TMP) + fn_flags|= FN_TO_IS_TMP; + switch (ddl_log_entry->action_type) { case DDL_LOG_REPLACE_ACTION: case DDL_LOG_DELETE_ACTION: @@ -1374,24 +1387,28 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root, /* fall through */ case DDL_LOG_RENAME_ACTION: { - error= TRUE; if (frm_action) { strxmov(to_path, ddl_log_entry->name.str, reg_ext, NullS); strxmov(from_path, ddl_log_entry->from_name.str, reg_ext, NullS); - (void) mysql_file_rename(key_file_frm, from_path, to_path, MYF(MY_WME)); + error= mysql_file_rename(key_file_frm, from_path, to_path, MYF(MY_WME)); #ifdef WITH_PARTITION_STORAGE_ENGINE strxmov(to_path, ddl_log_entry->name.str, PAR_EXT, NullS); strxmov(from_path, ddl_log_entry->from_name.str, PAR_EXT, NullS); - (void) mysql_file_rename(key_file_partition_ddl_log, from_path, to_path, - MYF(MY_WME)); + int err2= mysql_file_rename(key_file_partition_ddl_log, from_path, + to_path, MYF(MY_WME)); + if (!error) + error= err2; #endif } else - (void) file->ha_rename_table(ddl_log_entry->from_name.str, + error= file->ha_rename_table(ddl_log_entry->from_name.str, ddl_log_entry->name.str); if (increment_phase(entry_pos)) + { + error= -1; break; + } break; } case DDL_LOG_EXCHANGE_ACTION: @@ -1445,25 +1462,40 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root, */ switch (ddl_log_entry->phase) { case DDL_RENAME_PHASE_TRIGGER: - rename_triggers(thd, ddl_log_entry, 0); + rename_triggers(thd, ddl_log_entry, 0, fn_flags); if (increment_phase(entry_pos)) break; /* fall through */ case DDL_RENAME_PHASE_STAT: - /* - 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; + if (fn_flags & FN_TO_IS_TMP) + { + /* + Only executed in case of CREATE OR REPLACE table when renaming + the orignal table to a temporary name. + + If new code is added here please finish this block like this: + + if (increment_phase(entry_pos)) + break; + */ + } + else + { + /* + Stat tables must be updated last so that we can handle a rename of + a stat table. For now we just remember 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 */ - 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); + error= 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_flags, from_path, to_path); if (ddl_log_entry->flags & DDL_LOG_FLAG_UPDATE_STAT) { @@ -1491,11 +1523,11 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root, &ddl_log_entry->db, &ddl_log_entry->name, reg_ext, - key_file_fileparser); + key_file_fileparser, 0); build_filename_and_delete_tmp_file(from_path, sizeof(from_path) - 1, &ddl_log_entry->from_db, &ddl_log_entry->from_name, - reg_ext, key_file_fileparser); + reg_ext, key_file_fileparser, 0); /* Rename view back if the original rename did succeed */ if (!access(to_path, F_OK)) @@ -1570,25 +1602,39 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root, /* Fall through */ case DDL_DROP_PHASE_TRIGGER: Table_triggers_list::drop_all_triggers(thd, &db, &table, + fn_flags, MYF(MY_WME | MY_IGNORE_ENOENT)); if (increment_phase(entry_pos)) break; /* Fall through */ case DDL_DROP_PHASE_BINLOG: - if (strcmp(recovery_state.current_db, db.str)) + if (fn_flags & FN_IS_TMP) { - append_identifier(thd, &recovery_state.drop_table, &db); - recovery_state.drop_table.append('.'); - } - append_identifier(thd, &recovery_state.drop_table, &table); - recovery_state.drop_table.append(','); - /* We don't increment phase as we want to retry this in case of crash */ + /* + If new code is added here please finish this block like this: - if (ddl_log_drop_to_binary_log(thd, ddl_log_entry, - &recovery_state.drop_table)) + if (increment_phase(entry_pos)) + break; + */ + } + else { - if (increment_phase(entry_pos)) - break; + if (strcmp(recovery_state.current_db, db.str)) + { + append_identifier(thd, &recovery_state.drop_table, &db); + recovery_state.drop_table.append('.'); + } + append_identifier(thd, &recovery_state.drop_table, &table); + recovery_state.drop_table.append(','); + /* + We don't increment phase as we want to retry this in case of crash. + */ + if (ddl_log_drop_to_binary_log(thd, ddl_log_entry, + &recovery_state.drop_table)) + { + if (increment_phase(entry_pos)) + break; + } } break; case DDL_DROP_PHASE_RESET: @@ -1644,7 +1690,7 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root, &ddl_log_entry->db, &ddl_log_entry->name, TRG_EXT, - key_file_fileparser)) + key_file_fileparser, 0)) { /* Temporary file existed and was deleted, nothing left to do */ (void) update_phase(entry_pos, DDL_LOG_FINAL_PHASE); @@ -1869,11 +1915,11 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root, (void) build_filename_and_delete_tmp_file(to_path, sizeof(to_path) - 1, &db, &table, TRG_EXT, - key_file_fileparser); + key_file_fileparser, 0); (void) build_filename_and_delete_tmp_file(to_path, sizeof(to_path) - 1, &db, &trigger, TRN_EXT, - key_file_fileparser); + key_file_fileparser, 0); switch (ddl_log_entry->phase) { case DDL_CREATE_TRIGGER_PHASE_DELETE_COPY: { @@ -2182,7 +2228,7 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root, if (is_renamed) { // rename_triggers will rename from: from_db.from_name -> db.extra_name - rename_triggers(thd, ddl_log_entry, 1); + rename_triggers(thd, ddl_log_entry, 1, 0); (void) update_phase(entry_pos, DDL_ALTER_TABLE_PHASE_UPDATE_STATS); } } @@ -2858,6 +2904,7 @@ void ddl_log_release() } my_free(global_ddl_log.file_entry_buf); global_ddl_log.file_entry_buf= 0; + recovery_state.free(); close_ddl_log(); create_ddl_log_file_name(file_name, 0); @@ -3041,7 +3088,8 @@ static bool ddl_log_write(DDL_LOG_STATE *ddl_state, mysql_mutex_lock(&LOCK_gdl); error= ((ddl_log_write_entry(ddl_log_entry, &log_entry)) || - ddl_log_write_execute_entry(log_entry->entry_pos, 0, + ddl_log_write_execute_entry(log_entry->entry_pos, + ddl_state->master_chain_pos, &ddl_state->execute_entry)); mysql_mutex_unlock(&LOCK_gdl); if (error) @@ -3057,7 +3105,10 @@ static bool ddl_log_write(DDL_LOG_STATE *ddl_state, /** - Logging of rename table + Logging of rename + + @param phase Starting phase (usually DDL_RENAME_PHASE_TABLE) + @param flags Rename flags (FN_FROM_IS_TMP, FN_TO_IS_TMP) */ bool ddl_log_rename_table(DDL_LOG_STATE *ddl_state, @@ -3065,7 +3116,9 @@ bool ddl_log_rename_table(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *org_db, const LEX_CSTRING *org_alias, const LEX_CSTRING *new_db, - const LEX_CSTRING *new_alias) + const LEX_CSTRING *new_alias, + enum_ddl_log_rename_table_phase phase, + uint16 flags) { DDL_LOG_ENTRY ddl_log_entry; DBUG_ENTER("ddl_log_rename_file"); @@ -3080,7 +3133,8 @@ bool ddl_log_rename_table(DDL_LOG_STATE *ddl_state, ddl_log_entry.name= *const_cast<LEX_CSTRING*>(new_alias); ddl_log_entry.from_db= *const_cast<LEX_CSTRING*>(org_db); ddl_log_entry.from_name= *const_cast<LEX_CSTRING*>(org_alias); - ddl_log_entry.phase= DDL_RENAME_PHASE_TABLE; + ddl_log_entry.phase= (uchar) phase; + ddl_log_entry.flags= flags; DBUG_RETURN(ddl_log_write(ddl_state, &ddl_log_entry)); } @@ -3126,7 +3180,7 @@ static bool ddl_log_drop_init(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *comment) { DDL_LOG_ENTRY ddl_log_entry; - DBUG_ENTER("ddl_log_drop_file"); + DBUG_ENTER("ddl_log_drop_init"); bzero(&ddl_log_entry, sizeof(ddl_log_entry)); @@ -3161,6 +3215,15 @@ bool ddl_log_drop_view_init(DDL_LOG_STATE *ddl_state, be stored in call order instead of reverse order, which is the normal case for all other events. See also comment before ddl_log_drop_init(). + + @param ddl_state DDL log chain + @param action_code DDL_LOG_DROP_TABLE_ACTION or DDL_LOG_DROP_VIEW_ACTION + @param phase Starting phase (for table DDL_DROP_PHASE_TABLE) + @param hton Handlerton + @param path Table filepath without extension + @param db DB name + @param table Table name + @param flags DDL_LOG_FLAG_FROM_IS_TMP or DDL_LOG_FLAG_TO_IS_TMP */ static bool ddl_log_drop(DDL_LOG_STATE *ddl_state, @@ -3169,13 +3232,16 @@ static bool ddl_log_drop(DDL_LOG_STATE *ddl_state, handlerton *hton, const LEX_CSTRING *path, const LEX_CSTRING *db, - const LEX_CSTRING *table) + const LEX_CSTRING *table, + uint16 flags) { DDL_LOG_ENTRY ddl_log_entry; DDL_LOG_MEMORY_ENTRY *log_entry; DBUG_ENTER("ddl_log_drop"); DBUG_ASSERT(ddl_state->list); + DBUG_ASSERT(action_code == DDL_LOG_DROP_TABLE_ACTION || + action_code == DDL_LOG_DROP_VIEW_ACTION); bzero(&ddl_log_entry, sizeof(ddl_log_entry)); ddl_log_entry.action_type= action_code; @@ -3186,6 +3252,7 @@ static bool ddl_log_drop(DDL_LOG_STATE *ddl_state, ddl_log_entry.name= *const_cast<LEX_CSTRING*>(table); ddl_log_entry.tmp_name= *const_cast<LEX_CSTRING*>(path); ddl_log_entry.phase= (uchar) phase; + ddl_log_entry.flags= flags; mysql_mutex_lock(&LOCK_gdl); if (ddl_log_write_entry(&ddl_log_entry, &log_entry)) @@ -3209,19 +3276,36 @@ error: } +/** + @param ddl_state DDL log chain + @param hton Handlerton + @param path Table filepath without extension + @param db DB name + @param table Table name + @param flags DDL_LOG_FLAG_FROM_IS_TMP or DDL_LOG_FLAG_TO_IS_TMP +*/ + bool ddl_log_drop_table(DDL_LOG_STATE *ddl_state, handlerton *hton, const LEX_CSTRING *path, const LEX_CSTRING *db, - const LEX_CSTRING *table) + const LEX_CSTRING *table, + uint16 flags) { DBUG_ENTER("ddl_log_drop_table"); DBUG_RETURN(ddl_log_drop(ddl_state, DDL_LOG_DROP_TABLE_ACTION, DDL_DROP_PHASE_TABLE, - hton, path, db, table)); + hton, path, db, table, flags)); } +/** + @param ddl_state DDL log chain + @param path Table filepath without extension + @param db DB name + @param table Table name +*/ + bool ddl_log_drop_view(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *path, const LEX_CSTRING *db, @@ -3230,7 +3314,7 @@ bool ddl_log_drop_view(DDL_LOG_STATE *ddl_state, DBUG_ENTER("ddl_log_drop_view"); DBUG_RETURN(ddl_log_drop(ddl_state, DDL_LOG_DROP_VIEW_ACTION, 0, - (handlerton*) 0, path, db, table)); + (handlerton*) 0, path, db, table, 0)); } @@ -3324,6 +3408,8 @@ bool ddl_log_create_table(DDL_LOG_STATE *ddl_state, 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_FLAG_ONLY_FRM : 0; + /* Needed for finalize_atomic_replace() which logs 2 events. */ + ddl_log_entry.next_entry= ddl_state->list ? ddl_state->list->entry_pos : 0; DBUG_RETURN(ddl_log_write(ddl_state, &ddl_log_entry)); } @@ -3576,3 +3662,17 @@ bool ddl_log_delete_frm(DDL_LOG_STATE *ddl_state, const char *to_path) ddl_log_add_entry(ddl_state, log_entry); DBUG_RETURN(0); } + +/* + Link the ddl_log_state to another (master) chain. If the master + chain is active during DDL recovery, this event will not be executed. + + This is used for DROP TABLE of the original table when + CREATE OR REPLACE ... is used. +*/ + +void ddl_log_link_chains(DDL_LOG_STATE *state, DDL_LOG_STATE *master_state) +{ + DBUG_ASSERT(master_state->execute_entry); + state->master_chain_pos= master_state->execute_entry->entry_pos; +} diff --git a/sql/ddl_log.h b/sql/ddl_log.h index 87b7af57102..809b51a0e10 100644 --- a/sql/ddl_log.h +++ b/sql/ddl_log.h @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2010, 2021, MariaDB + Copyright (c) 2010, 2022, MariaDB 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 @@ -173,6 +173,8 @@ enum enum_ddl_log_alter_table_phase { engine is not changed */ #define DDL_LOG_FLAG_ALTER_PARTITION (1 << 4) +#define DDL_LOG_FLAG_FROM_IS_TMP (1 << 5) +#define DDL_LOG_FLAG_TO_IS_TMP (1 << 6) /* Setting ddl_log_entry.phase to this has the same effect as setting @@ -248,6 +250,7 @@ typedef struct st_ddl_log_state */ DDL_LOG_MEMORY_ENTRY *main_entry; uint16 flags; /* Cache for flags */ + uint master_chain_pos; bool is_active() { return list != 0; } } DDL_LOG_STATE; @@ -286,7 +289,9 @@ bool ddl_log_rename_table(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *org_db, const LEX_CSTRING *org_alias, const LEX_CSTRING *new_db, - const LEX_CSTRING *new_alias); + const LEX_CSTRING *new_alias, + enum_ddl_log_rename_table_phase phase, + uint16 flags); bool ddl_log_rename_view(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *org_db, const LEX_CSTRING *org_alias, @@ -301,7 +306,8 @@ bool ddl_log_drop_table(DDL_LOG_STATE *ddl_state, handlerton *hton, const LEX_CSTRING *path, const LEX_CSTRING *db, - const LEX_CSTRING *table); + const LEX_CSTRING *table, + uint16 flags); bool ddl_log_drop_view(DDL_LOG_STATE *ddl_state, const LEX_CSTRING *path, const LEX_CSTRING *db, @@ -348,5 +354,6 @@ bool ddl_log_alter_table(DDL_LOG_STATE *ddl_state, bool ddl_log_store_query(THD *thd, DDL_LOG_STATE *ddl_log_state, const char *query, size_t length); bool ddl_log_delete_frm(DDL_LOG_STATE *ddl_state, const char *to_path); +void ddl_log_link_chains(DDL_LOG_STATE *state, DDL_LOG_STATE *master_state); extern mysql_mutex_t LOCK_gdl; #endif /* DDL_LOG_INCLUDED */ diff --git a/sql/handler.cc b/sql/handler.cc index 6a42643919f..4d7c2eb228f 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4993,7 +4993,7 @@ void handler::mark_trx_read_write_internal() table_share can be NULL, for example, in ha_delete_table() or ha_rename_table(). */ - if (table_share == NULL || table_share->tmp_table == NO_TMP_TABLE) + if (table_share == NULL || table_share->tmp_table <= NO_TMP_TABLE) ha_info->set_trx_read_write(); } } @@ -7037,8 +7037,7 @@ int handler::binlog_log_row(TABLE *table, THD *thd= table->in_use; DBUG_ENTER("binlog_log_row"); - if (!thd->binlog_table_maps && - thd->binlog_write_table_maps()) + if (!thd->binlog_table_maps && thd->binlog_write_table_maps(table)) DBUG_RETURN(HA_ERR_RBR_LOGGING_FAILED); error= (*log_func)(thd, table, row_logging_has_trans, @@ -7587,7 +7586,7 @@ int handler::ha_write_row(const uchar *buf) error= binlog_log_row(table, 0, buf, log_func); } #ifdef WITH_WSREP - if (WSREP_NNULL(ha_thd()) && table_share->tmp_table == NO_TMP_TABLE && + if (WSREP_NNULL(ha_thd()) && table_share->tmp_table <= NO_TMP_TABLE && ht->flags & HTON_WSREP_REPLICATION && !error && (error= wsrep_after_row(ha_thd()))) { @@ -7661,7 +7660,7 @@ int handler::ha_update_row(const uchar *old_data, const uchar *new_data) " can not mark as PA unsafe"); } - if (!error && table_share->tmp_table == NO_TMP_TABLE && + if (!error && table_share->tmp_table <= NO_TMP_TABLE && ht->flags & HTON_WSREP_REPLICATION) error= wsrep_after_row(thd); } @@ -7739,7 +7738,7 @@ int handler::ha_delete_row(const uchar *buf) " can not mark as PA unsafe"); } - if (!error && table_share->tmp_table == NO_TMP_TABLE && + if (!error && table_share->tmp_table <= NO_TMP_TABLE && ht->flags & HTON_WSREP_REPLICATION) error= wsrep_after_row(thd); } @@ -8615,8 +8614,8 @@ bool Table_period_info::check_field(const Create_field* f, } bool Table_scope_and_contents_source_st::check_fields( - THD *thd, Alter_info *alter_info, - const Lex_table_name &table_name, const Lex_table_name &db) + THD *thd, Alter_info *alter_info, const Lex_table_name &table_name, + const Lex_table_name &db) { return (vers_check_system_fields(thd, alter_info, table_name, db) || check_period_fields(thd, alter_info)); diff --git a/sql/handler.h b/sql/handler.h index 65da0e69fca..b6124765b6b 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -35,6 +35,7 @@ #include "sql_array.h" /* Dynamic_array<> */ #include "mdl.h" #include "vers_string.h" +#include "backup.h" #include "sql_analyze_stmt.h" // for Exec_time_tracker @@ -1780,6 +1781,12 @@ handlerton *ha_default_tmp_handlerton(THD *thd); */ #define HTON_REQUIRES_NOTIFY_TABLEDEF_CHANGED_AFTER_COMMIT (1 << 20) +/* + Indicates that rename table is expensive operation. + When set atomic CREATE OR REPLACE TABLE is not used. +*/ +#define HTON_EXPENSIVE_RENAME (1 << 21) + class Ha_trx_info; struct THD_TRANS @@ -2225,6 +2232,11 @@ struct Table_scope_and_contents_source_pod_st // For trivial members { bzero(this, sizeof(*this)); } + /* + NOTE: share->tmp_table (tmp_table_type) is superset of this + HA_LEX_CREATE_TMP_TABLE which means TEMPORARY keyword in + CREATE TEMPORARY TABLE statement. + */ bool tmp_table() const { return options & HA_LEX_CREATE_TMP_TABLE; } void use_default_db_type(THD *thd) { @@ -2266,17 +2278,81 @@ struct Table_scope_and_contents_source_st: bool vers_check_system_fields(THD *thd, Alter_info *alter_info, const Lex_table_name &table_name, const Lex_table_name &db); +}; + +typedef struct st_ddl_log_state DDL_LOG_STATE; + +struct Atomic_info +{ + Table_name tmp_name; + Table_name backup_name; + DDL_LOG_STATE *ddl_log_state_create; + DDL_LOG_STATE *ddl_log_state_rm; + handlerton *old_hton; + backup_log_info drop_entry; + + Atomic_info() + { + bzero(this, sizeof(*this)); + } + Atomic_info(DDL_LOG_STATE *ddl_log_state_rm) + { + bzero(this, sizeof(*this)); + Atomic_info::ddl_log_state_rm= ddl_log_state_rm; + } + + bool is_atomic_replace() const + { + return tmp_name.table_name.str != NULL; + } }; +/* + mysql_create_table_no_lock can be called in one of the following + mutually exclusive situations: + + - Just a normal ordinary CREATE TABLE statement that explicitly + defines the table structure. + + - CREATE TABLE ... SELECT. It is special, because only in this case, + the list of fields is allowed to have duplicates, as long as one of the + duplicates comes from the select list, and the other doesn't. For + example in + + CREATE TABLE t1 (a int(5) NOT NUL) SELECT b+10 as a FROM t2; + + the list in alter_info->create_list will have two fields `a`. + + - ALTER TABLE, that creates a temporary table #sql-xxx, which will be later + renamed to replace the original table. + + - ALTER TABLE as above, but which only modifies the frm file, it only + creates an frm file for the #sql-xxx, the table in the engine is not + created. + + - Assisted discovery, CREATE TABLE statement without the table structure. + + These situations are distinguished by the following "create table mode" + values, except CREATE ... SELECT which is denoted by non-zero + Alter_info::select_field_count. +*/ + +#define C_ORDINARY_CREATE 0 +#define C_ALTER_TABLE 1 +#define C_ALTER_TABLE_FRM_ONLY 2 +#define C_ASSISTED_DISCOVERY 4 + + /** This struct is passed to handler table routines, e.g. ha_create(). It does not include the "OR REPLACE" and "IF NOT EXISTS" parts, as these parts are handled on the SQL level and are not needed on the handler level. */ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st, - public Schema_specification_st + public Schema_specification_st, + public Atomic_info { /* TODO: remove after MDEV-20865 */ Alter_info *alter_info; @@ -2298,6 +2374,17 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st, const Lex_table_charset_collation_attrs_st &default_cscl, const Lex_table_charset_collation_attrs_st &convert_cscl, const Charset_collation_context &ctx); + bool is_atomic_replace_usable() const + { + return !tmp_table() && !sequence && + !(db_type->flags & HTON_EXPENSIVE_RENAME) && + !DBUG_IF("ddl_log_expensive_rename"); + } + bool finalize_atomic_replace(THD *thd, TABLE_LIST *orig_table); + void finalize_ddl(THD *thd, bool roll_back); + bool finalize_locked_tables(THD *thd); + bool make_tmp_table_list(THD *thd, TABLE_LIST **create_table, + int *create_table_mode); }; @@ -2377,6 +2464,10 @@ struct Table_specification_st: public HA_CREATE_INFO, convert_charset_collation, ctx); } + bool is_atomic_replace() const + { + return or_replace() && is_atomic_replace_usable(); + } }; diff --git a/sql/log.cc b/sql/log.cc index 06bb073134d..850b79998a1 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -6101,9 +6101,12 @@ bool THD::binlog_write_annotated_row(Log_event_writer *writer) Also write annotate events and start transactions. This is using the "tables_with_row_logging" list prepared by THD::binlog_prepare_for_row_logging + + Atomic CREATE OR REPLACE .. SELECT logs row events via temporary table, + so it is missed in locks. We write table map for that specially via cur_table. */ -bool THD::binlog_write_table_maps() +bool THD::binlog_write_table_maps(TABLE *cur_table) { bool with_annotate; MYSQL_LOCK *locks[2], **locks_end= locks; @@ -6156,6 +6159,16 @@ bool THD::binlog_write_table_maps() } } } + if (cur_table->s->tmp_table && cur_table->file->row_logging) + { + /* + This is a temporary table created with CREATE OR REPLACE ... SELECT. + As these types of tables are not locked, we have to write the bitmap + separately. + */ + if (binlog_write_table_map(cur_table, with_annotate)) + DBUG_RETURN(1); + } binlog_table_maps= 1; // Table maps written DBUG_RETURN(0); } diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index 1d5875733ac..5ec576bec56 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2016, 2020, MariaDB Corporation + Copyright (c) 2016, 2022, 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 @@ -30,6 +30,7 @@ Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root) key_list(rhs.key_list, mem_root), alter_rename_key_list(rhs.alter_rename_key_list, mem_root), create_list(rhs.create_list, mem_root), + select_field_count(rhs.select_field_count), alter_index_ignorability_list(rhs.alter_index_ignorability_list, mem_root), check_constraint_list(rhs.check_constraint_list, mem_root), flags(rhs.flags), partition_flags(rhs.partition_flags), diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 9279e2eccde..8b987914697 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1950,8 +1950,9 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx) DBUG_PRINT("info",("Using locked table")); #ifdef WITH_PARTITION_STORAGE_ENGINE part_names_error= set_partitions_as_used(table_list, table); - if (!part_names_error - && table->vers_switch_partition(thd, table_list, ot_ctx)) + if (!part_names_error && + table_list->lock_type >= TL_WRITE_ALLOW_WRITE && + table->vers_switch_partition(thd, table_list, ot_ctx)) DBUG_RETURN(true); #endif goto reset; @@ -2212,6 +2213,7 @@ retry_share: #ifdef WITH_PARTITION_STORAGE_ENGINE if (!part_names_error && + table_list->lock_type >= TL_WRITE_ALLOW_WRITE && table->vers_switch_partition(thd, table_list, ot_ctx)) { MYSQL_UNBIND_TABLE(table->file); @@ -3152,7 +3154,7 @@ ret: static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry) { if (Table_triggers_list::check_n_load(thd, &share->db, - &share->table_name, entry, 0)) + &share->table_name, entry, false, 0)) return TRUE; /* diff --git a/sql/sql_class.h b/sql/sql_class.h index ee51b1828da..01e180a6cce 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2909,7 +2909,7 @@ public: bool prepare_handlers_for_update(uint flag); bool binlog_write_annotated_row(Log_event_writer *writer); void binlog_prepare_for_row_logging(); - bool binlog_write_table_maps(); + bool binlog_write_table_maps(TABLE *cur_table); bool binlog_write_table_map(TABLE *table, bool with_annotate); static void binlog_prepare_row_images(TABLE* table); @@ -6095,6 +6095,11 @@ class select_insert :public select_result_interceptor { ulonglong autoinc_value_of_last_inserted_row; // autogenerated or not COPY_INFO info; bool insert_into_view; + bool binary_logged; // true if query was binlogged + bool atomic_replace; // true for atomic create or replace + bool tmp_table; + Table_specification_st *create_info; + select_insert(THD *thd_arg, TABLE_LIST *table_list_par, TABLE *table_par, List<Item> *fields_par, List<Item> *update_fields, List<Item> *update_values, enum_duplicates duplic, @@ -6106,6 +6111,7 @@ class select_insert :public select_result_interceptor { virtual void store_values(List<Item> &values); virtual bool can_rollback_data() { return 0; } bool prepare_eof(); + bool binlog_query(); bool send_ok_packet(); bool send_eof(); virtual void abort_result_set(); @@ -6115,7 +6121,7 @@ class select_insert :public select_result_interceptor { class select_create: public select_insert { - Table_specification_st *create_info; + TABLE_LIST *orig_table; TABLE_LIST *select_tables; Alter_info *alter_info; Field **field; @@ -6132,19 +6138,7 @@ public: Table_specification_st *create_info_par, Alter_info *alter_info_arg, List<Item> &select_fields,enum_duplicates duplic, bool ignore, - TABLE_LIST *select_tables_arg): - select_insert(thd_arg, table_arg, NULL, &select_fields, 0, 0, duplic, - ignore, NULL), - create_info(create_info_par), - select_tables(select_tables_arg), - alter_info(alter_info_arg), - m_plock(NULL), exit_done(0), - saved_tmp_table_share(0) - { - DBUG_ASSERT(create_info->default_table_charset); - bzero(&ddl_log_state_create, sizeof(ddl_log_state_create)); - bzero(&ddl_log_state_rm, sizeof(ddl_log_state_rm)); - } + TABLE_LIST *select_tables_arg); int prepare(List<Item> &list, SELECT_LEX_UNIT *u); void store_values(List<Item> &values); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index aa0c38411ba..6fc46e5818c 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3877,7 +3877,8 @@ select_insert::select_insert(THD *thd_arg, TABLE_LIST *table_list_par, sel_result(result), table_list(table_list_par), table(table_par), fields(fields_par), autoinc_value_of_last_inserted_row(0), - insert_into_view(table_list_par && table_list_par->view != 0) + insert_into_view(table_list_par && table_list_par->view != 0), + binary_logged(false), atomic_replace(false), create_info(NULL) { bzero((char*) &info,sizeof(info)); info.handle_duplicates= duplic; @@ -3886,6 +3887,37 @@ select_insert::select_insert(THD *thd_arg, TABLE_LIST *table_list_par, info.update_values= update_values; info.view= (table_list_par->view ? table_list_par : 0); info.table_list= table_list_par; + tmp_table= table ? table->s->tmp_table != NO_TMP_TABLE : false; +} + + +select_create::select_create(THD *thd, TABLE_LIST *table_arg, + Table_specification_st *create_info_par, + Alter_info *alter_info_arg, + List<Item> &select_fields, + enum_duplicates duplic, bool ignore, + TABLE_LIST *select_tables_arg): + select_insert(thd, table_arg, NULL, &select_fields, 0, 0, duplic, + ignore, NULL), + orig_table(table_arg), + select_tables(select_tables_arg), + alter_info(alter_info_arg), + m_plock(NULL), exit_done(0), + saved_tmp_table_share(0) +{ + DBUG_ASSERT(create_info_par->default_table_charset); + bzero(&ddl_log_state_create, sizeof(ddl_log_state_create)); + bzero(&ddl_log_state_rm, sizeof(ddl_log_state_rm)); + create_info= create_info_par; + if (!thd->is_current_stmt_binlog_format_row() || + !ha_check_storage_engine_flag(create_info->db_type, + HTON_NO_BINLOG_ROW_OPT)) + atomic_replace= create_info->is_atomic_replace(); + else + DBUG_ASSERT(!atomic_replace); + create_info->ddl_log_state_create= &ddl_log_state_create; + create_info->ddl_log_state_rm= &ddl_log_state_rm; + tmp_table= create_info->tmp_table(); } @@ -4226,10 +4258,10 @@ void select_insert::store_values(List<Item> &values) bool select_insert::prepare_eof() { int error; +#ifndef DBUG_OFF bool const trans_table= table->file->has_transactions_and_rollback(); +#endif bool changed; - bool binary_logged= 0; - killed_state killed_status= thd->killed; DBUG_ENTER("select_insert::prepare_eof"); DBUG_PRINT("enter", ("trans_table: %d, table_type: '%s'", @@ -4247,12 +4279,31 @@ bool select_insert::prepare_eof() error= thd->get_stmt_da()->sql_errno(); if (info.ignore || info.handle_duplicates != DUP_ERROR) - if (table->file->ha_table_flags() & HA_DUPLICATE_POS) - table->file->ha_rnd_end(); + if (table->file->ha_table_flags() & HA_DUPLICATE_POS) + table->file->ha_rnd_end(); table->file->extra(HA_EXTRA_END_ALTER_COPY); table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); + if (atomic_replace) + { + DBUG_ASSERT(table->s->tmp_table); + + /* + Note: InnoDB does autocommit on external unlock. + We cannot do commit twice and we must commit after binlog + (flush row events is done at commit), so we cannot do it here. + Test: rpl.create_or_replace_row + */ + ulonglong save_options_bits= thd->variables.option_bits; + thd->variables.option_bits|= OPTION_NOT_AUTOCOMMIT; + int lock_error= table->file->ha_external_lock(thd, F_UNLCK); + thd->variables.option_bits= save_options_bits; + + if (lock_error) + DBUG_RETURN(true); /* purecov: inspected */ + } + if (likely((changed= (info.copied || info.deleted || info.updated)))) { /* @@ -4270,19 +4321,54 @@ bool select_insert::prepare_eof() DBUG_ASSERT(trans_table || !changed || thd->transaction->stmt.modified_non_trans_table); + if (unlikely(error)) + { + if ((thd->transaction->stmt.modified_non_trans_table || + thd->log_current_statement()) && !atomic_replace) + { + if (binlog_query()) + table->file->print_error(error,MYF(0)); + } + else + table->file->ha_release_auto_increment(); + DBUG_RETURN(true); + } + + DBUG_RETURN(false); +} + +bool select_insert::binlog_query() +{ + /* For atomic_replace table was already closed in send_eof(). */ + DBUG_ASSERT(table || atomic_replace); + const bool trans_table= table ? table->file->has_transactions_and_rollback() : + false; + killed_state killed_status= thd->killed; + DBUG_ENTER("select_insert::binlog_query"); + /* Write to binlog before commiting transaction. No statement will be written by the binlog_query() below in RBR mode. All the events are in the transaction cache and will be written when ha_autocommit_or_rollback() is issued below. */ - if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) && - (likely(!error) || thd->transaction->stmt.modified_non_trans_table || - thd->log_current_statement())) + if ((WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())) { + + debug_crash_here("ddl_log_create_before_binlog"); + + if (create_info && !create_info->tmp_table()) + { + thd->binlog_xid= thd->query_id; + /* Remember xid's for the case of row based logging */ + ddl_log_update_xid(create_info->ddl_log_state_create, thd->binlog_xid); + if (create_info->ddl_log_state_rm->is_active() && !atomic_replace) + ddl_log_update_xid(create_info->ddl_log_state_rm, thd->binlog_xid); + } + int errcode= 0; int res; - if (likely(!error)) + if (thd->is_error()) thd->clear_error(); else errcode= query_error_code(thd, killed_status == NOT_KILLED); @@ -4291,20 +4377,24 @@ bool select_insert::prepare_eof() res= thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(), thd->query_length(), trans_table, FALSE, FALSE, errcode); + /* + NOTE: binlog_xid must be cleared after commit because pending row events + are written at commit phase. + */ if (res > 0) { - table->file->ha_release_auto_increment(); + thd->binlog_xid= 0; + if (table) + table->file->ha_release_auto_increment(); DBUG_RETURN(true); } - binary_logged= res == 0 || !table->s->tmp_table; + binary_logged= res == 0 || !tmp_table; } - table->s->table_creation_was_logged|= binary_logged; - table->file->ha_release_auto_increment(); - - if (unlikely(error)) + if (table) { - table->file->print_error(error,MYF(0)); - DBUG_RETURN(true); + /* NOTE: used in binlog_drop_table(), not needed for atomic_replace */ + table->s->table_creation_was_logged|= binary_logged; + table->file->ha_release_auto_increment(); } DBUG_RETURN(false); @@ -4351,7 +4441,8 @@ bool select_insert::send_eof() { bool res; DBUG_ENTER("select_insert::send_eof"); - res= (prepare_eof() || (!suppress_my_ok && send_ok_packet())); + res= (prepare_eof() || binlog_query() || + (!suppress_my_ok && send_ok_packet())); DBUG_RETURN(res); } @@ -4416,7 +4507,11 @@ void select_insert::abort_result_set() res= thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(), thd->query_length(), transactional_table, FALSE, FALSE, errcode); - binary_logged= res == 0 || !table->s->tmp_table; + + /* TODO: Update binary_logged in do_postlock() for RBR? */ + const bool tmp_table= create_info ? create_info->tmp_table() : + (bool) table->s->tmp_table; + binary_logged= res == 0 || !tmp_table; } if (changed) query_cache_invalidate3(thd, table, 1); @@ -4494,6 +4589,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, List_iterator_fast<Item> it(*items); Item *item; bool save_table_creation_was_logged; + int create_table_mode= C_ORDINARY_CREATE; + LEX_CUSTRING frm= {0, 0}; DBUG_ENTER("select_create::create_table_from_items"); tmp_table.s= &share; @@ -4564,6 +4661,13 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, create_info->mdl_ticket= table_list->table->mdl_ticket; } + if (atomic_replace) + { + if (create_info->make_tmp_table_list(thd, &table_list, + &create_table_mode)) + DBUG_RETURN(NULL); + } + /* Create and lock table. @@ -4581,11 +4685,14 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, open_table(). */ - if (!mysql_create_table_no_lock(thd, &ddl_log_state_create, &ddl_log_state_rm, + if (!mysql_create_table_no_lock(thd, + &orig_table->db, + &orig_table->table_name, &table_list->db, &table_list->table_name, create_info, alter_info, NULL, - C_ORDINARY_CREATE, table_list)) + create_table_mode, table_list, + atomic_replace ? &frm : NULL)) { DEBUG_SYNC(thd,"create_table_select_before_open"); @@ -4595,7 +4702,58 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, */ table_list->table= 0; - if (!create_info->tmp_table()) + if (atomic_replace) + { + char tmp_path[FN_REFLEN + 1]; + build_table_filename(tmp_path, sizeof(tmp_path) - 1, table_list->db.str, + table_list->table_name.str, "", FN_IS_TMP); + + table_list->table= + thd->create_and_open_tmp_table(&frm, tmp_path, orig_table->db.str, + orig_table->table_name.str, false); + /* + NOTE: if create_and_open_tmp_table() fails the table is dropped by + ddl_log_state_create + */ + if (table_list->table) + { + table_list->table->s->tmp_table= TMP_TABLE_ATOMIC_REPLACE; + /* + NOTE: Aria tables require table locking to work in transactional + mode. Since we don't lock our temporary table we get problems with + unproperly initialized transactional mode: seg-fault while accessing + uninitialized trn member (reproduced by + atomic.create_replace,aria,stmt). + + This hack disables logging for Aria table (that is not needed anyway + for a temporary table). + */ + TABLE *table= table_list->table; + int error; + + /* Disable logging of inserted rows */ + mysql_trans_prepare_alter_copy_data(thd); + + if ((DBUG_IF("atomic_replace_external_lock_fail") && + (error= HA_ERR_LOCK_TABLE_FULL)) || + (error= table->file->ha_external_lock(thd, F_WRLCK))) + { + table->file->print_error(error, MYF(0)); + /* + Enable transaction logging. We cannot call ha_enable_transaction() + as this would write the transaction to the binary log + */ + thd->transaction->on= true; + table->file->ha_reset(); + thd->drop_temporary_table(table, NULL, false); + table_list->table= 0; + goto err; + } + + table_list->table->s->can_do_row_logging= 1; + } + } + else if (!create_info->tmp_table()) { Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN); TABLE_LIST::enum_open_strategy save_open_strategy; @@ -4636,13 +4794,18 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, } else table_list->table= 0; // Create failed - + +err: + DBUG_ASSERT(!table_list->table || frm.str || !atomic_replace); + my_free(const_cast<uchar *>(frm.str)); + if (unlikely(!(table= table_list->table))) { - if (likely(!thd->is_error())) // CREATE ... IF NOT EXISTS - my_ok(thd); // succeed, but did nothing - ddl_log_complete(&ddl_log_state_rm); - ddl_log_complete(&ddl_log_state_create); + const bool error= thd->is_error(); + /* CREATE ... IF NOT EXISTS succeed, but did nothing */ + if (likely(!error)) + my_ok(thd); + create_info->finalize_ddl(thd, error); DBUG_RETURN(NULL); } @@ -4661,9 +4824,13 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, mysql_lock_tables() below should never fail with request to reopen table since it won't wait for the table lock (we have exclusive metadata lock on the table) and thus can't get aborted. + + In case of atomic_replace we have already called ha_external_lock() above + on the newly created temporary table. */ - if (unlikely(!((*lock)= mysql_lock_tables(thd, &table, 1, 0)) || - postlock(thd, &table))) + if ((!atomic_replace && + unlikely(!((*lock)= mysql_lock_tables(thd, &table, 1, 0)))) || + postlock(thd, &table)) { /* purecov: begin tested */ /* @@ -4680,13 +4847,24 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, *lock= 0; } drop_open_table(thd, table, &table_list->db, &table_list->table_name); - ddl_log_complete(&ddl_log_state_rm); - ddl_log_complete(&ddl_log_state_create); + if (atomic_replace) + create_info->finalize_ddl(thd, 1); + else + { + debug_crash_here("ddl_log_create_log_complete"); + ddl_log_complete(&ddl_log_state_create); + debug_crash_here("ddl_log_create_log_complete2"); + } + thd->transaction->on= true; DBUG_RETURN(NULL); /* purecov: end */ } + DBUG_ASSERT( + create_info->tmp_table() || + thd->mdl_context.is_lock_owner(MDL_key::TABLE, orig_table->db.str, + orig_table->table_name.str, MDL_SHARED)); table->s->table_creation_was_logged= save_table_creation_was_logged; - if (!table->s->tmp_table) + if (!create_info->tmp_table()) table->file->prepare_for_row_logging(); /* @@ -4734,11 +4912,10 @@ int select_create::postlock(THD *thd, TABLE **tables) if (unlikely(error)) return error; - TABLE const *const table = *tables; - if (thd->is_current_stmt_binlog_format_row() && - !table->s->tmp_table) - return binlog_show_create_table(thd, *tables, create_info); - return 0; + if (thd->is_current_stmt_binlog_format_row() && !create_info->tmp_table()) + error= binlog_show_create_table(thd, *tables, create_info); + + return error; } @@ -4765,7 +4942,11 @@ select_create::prepare(List<Item> &_values, SELECT_LEX_UNIT *u) if (!(table= create_table_from_items(thd, &values, &extra_lock))) { - if (create_info->or_replace()) + /* + TODO: Use create_info->table_was_deleted + (now binlog.binlog_stm_binlog fails). + */ + if (create_info->or_replace() && !atomic_replace) { /* Original table was deleted. We have to log it */ log_drop_table(thd, &table_list->db, &table_list->table_name, @@ -4779,6 +4960,8 @@ select_create::prepare(List<Item> &_values, SELECT_LEX_UNIT *u) DBUG_RETURN(-1); } + DBUG_ASSERT(table == table_list->table); + if (create_info->tmp_table()) { /* @@ -4788,17 +4971,26 @@ select_create::prepare(List<Item> &_values, SELECT_LEX_UNIT *u) list to keep them inaccessible from inner statements. e.g. CREATE TEMPORARY TABLE `t1` AS SELECT * FROM `t1`; */ - saved_tmp_table_share= thd->save_tmp_table_share(table_list->table); + saved_tmp_table_share= thd->save_tmp_table_share(table); } if (extra_lock) { DBUG_ASSERT(m_plock == NULL); - if (create_info->tmp_table()) + if (table->s->tmp_table) + { + /* Table is a temporary table, don't write table map to binary log */ m_plock= &m_lock; + } else + { + /* + Table is a normal table. Inform binlog_write_table_maps() that + it should write the table map for the current table. + */ m_plock= &thd->extra_lock; + } *m_plock= extra_lock; } @@ -4890,6 +5082,14 @@ static int binlog_show_create_table(THD *thd, TABLE *table, create_info, WITH_DB_NAME); DBUG_ASSERT(result == 0); /* show_create_table() always return 0 */ + /* + NOTE: why it does show_create_table() even if !mysql_bin_log.is_open()? + + Because Galera needs it even if there is no binlog. + (I assume Galera will hijack the binlog information and use it itself + if there is no binlog). That is the the only thing that makes sence + looking at the if statement... Monty + */ if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open()) { int errcode= query_error_code(thd, thd->killed == NOT_KILLED); @@ -5011,30 +5211,12 @@ bool select_create::send_eof() is in select_insert::prepare_eof(). For that reason, we mark the flag at this point. */ - if (table->s->tmp_table) + if (create_info->tmp_table()) thd->transaction->stmt.mark_created_temp_table(); if (thd->slave_thread) thd->variables.binlog_annotate_row_events= 0; - debug_crash_here("ddl_log_create_before_binlog"); - - /* - In case of crash, we have to add DROP TABLE to the binary log as - the CREATE TABLE will already be logged if we are not using row based - replication. - */ - if (!thd->is_current_stmt_binlog_format_row()) - { - if (ddl_log_state_create.is_active()) // Not temporary table - ddl_log_update_phase(&ddl_log_state_create, DDL_CREATE_TABLE_PHASE_LOG); - /* - We can ignore if we replaced an old table as ddl_log_state_create will - now handle the logging of the drop if needed. - */ - ddl_log_complete(&ddl_log_state_rm); - } - if (prepare_eof()) { abort_result_set(); @@ -5042,7 +5224,7 @@ bool select_create::send_eof() } debug_crash_here("ddl_log_create_after_prepare_eof"); - if (table->s->tmp_table) + if (create_info->tmp_table()) { /* Now is good time to add the new table to THD temporary tables list. @@ -5068,11 +5250,11 @@ bool select_create::send_eof() tables. This can fail, but we should unlock the table nevertheless. */ - if (!table->s->tmp_table) + if (!create_info->tmp_table()) { #ifdef WITH_WSREP if (WSREP(thd) && - table->file->ht->db_type == DB_TYPE_INNODB) + create_info->db_type->db_type == DB_TYPE_INNODB) { if (thd->wsrep_trx_id() == WSREP_UNDEFINED_TRX_ID) { @@ -5107,15 +5289,46 @@ bool select_create::send_eof() thd->get_stmt_da()->set_overwrite_status(true); } #endif /* WITH_WSREP */ - thd->binlog_xid= thd->query_id; - /* Remember xid's for the case of row based logging */ - ddl_log_update_xid(&ddl_log_state_create, thd->binlog_xid); - ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid); + if (atomic_replace) + { + table_list= orig_table; + create_info->table= orig_table->table; + thd->transaction->on= true; + table->file->ha_reset(); + /* + Remove the temporary table structures from memory but keep the table + files. + */ + thd->drop_temporary_table(table, NULL, false); + table= NULL; + + if (create_info->finalize_atomic_replace(thd, orig_table)) + { + abort_result_set(); + DBUG_RETURN(true); + } + } + + if (binlog_query()) + { + abort_result_set(); + DBUG_RETURN(true); + } + + debug_crash_here("ddl_log_create_after_binlog"); trans_commit_stmt(thd); if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) trans_commit_implicit(thd); thd->binlog_xid= 0; + /* + If are using statement based replication the table will be deleted here + in case of a crash as we can't use xid to check if the query was logged + (as the query was logged before commit!) + */ + create_info->finalize_ddl(thd, false); + + #ifdef WITH_WSREP if (WSREP(thd)) { @@ -5147,17 +5360,22 @@ bool select_create::send_eof() ddl_log.org_database= table_list->db; ddl_log.org_table= table_list->table_name; ddl_log.org_table_id= create_info->tabledef_version; + /* + Since atomic replace doesn't do mysql_rm_table_no_locks() we have + to log DROP entry now. It was already prepared in create_table_impl(). + */ + if (create_info->drop_entry.query.length) + { + DBUG_ASSERT(atomic_replace); + backup_log_ddl(&create_info->drop_entry); + } backup_log_ddl(&ddl_log); } - /* - If are using statement based replication the table will be deleted here - in case of a crash as we can't use xid to check if the query was logged - (as the query was logged before commit!) - */ - debug_crash_here("ddl_log_create_after_binlog"); - ddl_log_complete(&ddl_log_state_rm); - ddl_log_complete(&ddl_log_state_create); - debug_crash_here("ddl_log_create_log_complete"); + else if (binlog_query()) + { + abort_result_set(); + DBUG_RETURN(true); + } /* exit_done must only be set after last potential call to @@ -5165,10 +5383,9 @@ bool select_create::send_eof() */ exit_done= 1; // Avoid double calls - send_ok_packet(); - if (m_plock) { + DBUG_ASSERT(!atomic_replace); MYSQL_LOCK *lock= *m_plock; *m_plock= NULL; m_plock= NULL; @@ -5187,11 +5404,20 @@ bool select_create::send_eof() create_info-> pos_in_locked_tables, table, lock)) + { + send_ok_packet(); DBUG_RETURN(false); // ok + } /* Fail. Continue without locking the table */ + thd->clear_error(); } mysql_unlock_tables(thd, lock); } + else if (atomic_replace && create_info->pos_in_locked_tables && + create_info->finalize_locked_tables(thd)) + DBUG_RETURN(true); + + send_ok_packet(); DBUG_RETURN(false); } @@ -5229,6 +5455,7 @@ void select_create::abort_result_set() thd->variables.option_bits&= ~OPTION_BIN_LOG; select_insert::abort_result_set(); thd->transaction->stmt.modified_non_trans_table= FALSE; + thd->transaction->on= true; thd->variables.option_bits= save_option_bits; /* possible error of writing binary log is ignored deliberately */ @@ -5236,9 +5463,7 @@ void select_create::abort_result_set() if (table) { - bool tmp_table= table->s->tmp_table; - bool table_creation_was_logged= (!tmp_table || - table->s->table_creation_was_logged); + bool tmp_table= create_info->tmp_table(); if (tmp_table) { DBUG_ASSERT(saved_tmp_table_share); @@ -5260,7 +5485,14 @@ void select_create::abort_result_set() m_plock= NULL; } - drop_open_table(thd, table, &table_list->db, &table_list->table_name); + if (atomic_replace) + { + (void) table->file->ha_external_lock(thd, F_UNLCK); + (void) thd->drop_temporary_table(table, NULL, true); + } + else + drop_open_table(thd, table, &table_list->db, + &table_list->table_name); table=0; // Safety if (thd->log_current_statement()) { @@ -5268,23 +5500,8 @@ void select_create::abort_result_set() { /* Remove logging of drop, create + insert rows */ binlog_reset_cache(thd); - /* Original table was deleted. We have to log it */ - if (table_creation_was_logged) - { - thd->binlog_xid= thd->query_id; - ddl_log_update_xid(&ddl_log_state_create, thd->binlog_xid); - ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid); - debug_crash_here("ddl_log_create_before_binlog"); - log_drop_table(thd, &table_list->db, &table_list->table_name, - &create_info->org_storage_engine_name, - create_info->db_type == partition_hton, - &create_info->tabledef_version, - tmp_table); - debug_crash_here("ddl_log_create_after_binlog"); - thd->binlog_xid= 0; - } } - else if (!tmp_table) + else if (!tmp_table && !atomic_replace) { backup_log_info ddl_log; bzero(&ddl_log, sizeof(ddl_log)); @@ -5299,8 +5516,8 @@ void select_create::abort_result_set() } } - ddl_log_complete(&ddl_log_state_rm); - ddl_log_complete(&ddl_log_state_create); + create_info->finalize_ddl(thd, !binary_logged); + DBUG_ASSERT(!thd->binlog_xid); if (create_info->table_was_deleted) { @@ -5308,6 +5525,7 @@ void select_create::abort_result_set() (void) trans_rollback_stmt(thd); thd->locked_tables_list.unlock_locked_table(thd, create_info->mdl_ticket); } - + else if (atomic_replace && create_info->pos_in_locked_tables) + (void) create_info->finalize_locked_tables(thd); DBUG_VOID_RETURN; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 8b8ab430308..3219116c891 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7526,9 +7526,11 @@ void THD::reset_for_next_command(bool do_clear_error) DBUG_ENTER("THD::reset_for_next_command"); DBUG_ASSERT(!spcont); /* not for substatements of routines */ DBUG_ASSERT(!in_sub_stmt); + DBUG_ASSERT(transaction->on); + /* Table maps should have been reset after previous statement except in the - case where we have locked tables + case where we have locked ables */ DBUG_ASSERT(binlog_table_maps == 0 || locked_tables_mode == LTM_LOCK_TABLES); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 3eb78b2439b..500f2affd19 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -7079,6 +7079,8 @@ static void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt, { THD *thd= lpt->thd; partition_info *part_info= lpt->part_info->get_clone(thd); + /* TABLE is going to be released, we should not access old part_info anymore */ + lpt->part_info= part_info; TABLE *table= lpt->table; DBUG_ENTER("handle_alter_part_error"); DBUG_ASSERT(table->needs_reopen()); diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index 05ebdbf144a..658afd57f9b 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -199,7 +199,7 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent, else { /* Revert the renames of normal tables with the help of the ddl log */ - ddl_log_revert(thd, &ddl_log_state); + error|= ddl_log_revert(thd, &ddl_log_state); } err: @@ -228,18 +228,6 @@ rename_temporary_table(THD *thd, TABLE_LIST *ren_table, TABLE_LIST *new_table) /** - Parameters for rename_table_and_triggers() -*/ - -struct rename_param -{ - LEX_CSTRING old_alias, new_alias; - LEX_CUSTRING old_version; - handlerton *from_table_hton; -}; - - -/** Check pre-conditions for rename - From table should exists - To table should not exists. @@ -255,7 +243,7 @@ struct rename_param @retval <0 Can't do rename, but no error */ -static int +int rename_check_preconditions(THD *thd, rename_param *param, Table_name *ren_table, const LEX_CSTRING *new_db, @@ -281,7 +269,8 @@ rename_check_preconditions(THD *thd, rename_param *param, if (!ha_table_exists(thd, &ren_table->db, ¶m->old_alias, ¶m->old_version, NULL, - ¶m->from_table_hton, NULL, 0) || + ¶m->from_table_hton, NULL, + (param->rename_flags & FN_FROM_IS_TMP)) || !param->from_table_hton) { my_error(ER_NO_SUCH_TABLE, MYF(if_exists ? ME_NOTE : 0), @@ -301,7 +290,8 @@ rename_check_preconditions(THD *thd, rename_param *param, DBUG_RETURN(-1); } - if (ha_table_exists(thd, new_db, ¶m->new_alias, NULL, NULL, NULL, NULL, 0)) + if (ha_table_exists(thd, new_db, ¶m->new_alias, NULL, NULL, NULL, NULL, + (param->rename_flags & FN_TO_IS_TMP))) { my_error(ER_TABLE_EXISTS_ERROR, MYF(0), param->new_alias.str); DBUG_RETURN(1); // This can't be skipped @@ -325,12 +315,17 @@ rename_check_preconditions(THD *thd, rename_param *param, Rename a single table or a view. In case of failure, all changes will be reverted + Even if mysql_rename_tables() cannot be used with LOCK TABLES, + the table can still be locked if we come here from CREATE ... REPLACE. + + If ddl_log_state is NULL then we will not log the rename to the ddl log. + RETURN false Ok true rename failed */ -static bool +bool rename_table_and_triggers(THD *thd, rename_param *param, DDL_LOG_STATE *ddl_log_state, Table_name *ren_table, const LEX_CSTRING *new_db, @@ -340,6 +335,7 @@ rename_table_and_triggers(THD *thd, rename_param *param, handlerton *hton; LEX_CSTRING *old_alias, *new_alias; TRIGGER_RENAME_PARAM rename_param; + rename_param.rename_flags= param->rename_flags; DBUG_ENTER("rename_table_and_triggers"); DBUG_PRINT("enter", ("skip_error: %d", (int) skip_error)); @@ -347,15 +343,19 @@ rename_table_and_triggers(THD *thd, rename_param *param, new_alias= ¶m->new_alias; hton= param->from_table_hton; - DBUG_ASSERT(!thd->locked_tables_mode); - #ifdef WITH_WSREP if (WSREP(thd) && hton && hton != view_pseudo_hton && !wsrep_should_replicate_ddl(thd, hton)) DBUG_RETURN(1); #endif - tdc_remove_table(thd, ren_table->db.str, ren_table->table_name.str); + if (!(param->rename_flags & FN_FROM_IS_TMP)) + tdc_remove_table(thd, ren_table->db.str, ren_table->table_name.str); + + /* + In case of CREATE..REPLACE the temporary table does not have a + MDL lock + */ if (hton != view_pseudo_hton) { @@ -373,19 +373,23 @@ rename_table_and_triggers(THD *thd, rename_param *param, thd->replication_flags= 0; - if (ddl_log_rename_table(ddl_log_state, hton, - &ren_table->db, old_alias, new_db, new_alias)) + if (ddl_log_state && + ddl_log_rename_table(ddl_log_state, hton, + &ren_table->db, old_alias, new_db, new_alias, + DDL_RENAME_PHASE_TABLE, 0)) DBUG_RETURN(1); debug_crash_here("ddl_log_rename_before_rename_table"); if (!(rc= mysql_rename_table(hton, &ren_table->db, old_alias, - new_db, new_alias, ¶m->old_version, 0))) + new_db, new_alias, ¶m->old_version, + param->rename_flags))) { /* Table rename succeded. It's safe to start recovery at rename trigger phase */ debug_crash_here("ddl_log_rename_before_phase_trigger"); - ddl_log_update_phase(ddl_log_state, DDL_RENAME_PHASE_TRIGGER); + if (ddl_log_state) + ddl_log_update_phase(ddl_log_state, DDL_RENAME_PHASE_TRIGGER); debug_crash_here("ddl_log_rename_before_rename_trigger"); @@ -398,10 +402,13 @@ rename_table_and_triggers(THD *thd, rename_param *param, new_alias))) { debug_crash_here("ddl_log_rename_before_stat_tables"); - (void) rename_table_in_stat_tables(thd, &ren_table->db, - &ren_table->table_name, - new_db, new_alias); - debug_crash_here("ddl_log_rename_after_stat_tables"); + if (!(param->rename_flags & FN_IS_TMP)) + { + (void) rename_table_in_stat_tables(thd, &ren_table->db, + &ren_table->table_name, + new_db, new_alias); + debug_crash_here("ddl_log_rename_after_stat_tables"); + } } else { @@ -416,7 +423,8 @@ rename_table_and_triggers(THD *thd, rename_param *param, &ren_table->db, old_alias, ¶m->old_version, NO_FK_CHECKS); debug_crash_here("ddl_log_rename_after_revert_rename_table"); - ddl_log_disable_entry(ddl_log_state); + if (ddl_log_state) + ddl_log_disable_entry(ddl_log_state); debug_crash_here("ddl_log_rename_after_disable_entry"); } } @@ -437,6 +445,7 @@ rename_table_and_triggers(THD *thd, rename_param *param, DBUG_RETURN(1); } + DBUG_ASSERT(ddl_log_state); ddl_log_rename_view(ddl_log_state, &ren_table->db, &ren_table->table_name, new_db, new_alias); debug_crash_here("ddl_log_rename_before_rename_view"); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b76ec6d14f3..45fed46e375 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -55,6 +55,7 @@ #include "sql_window.h" #include "tztime.h" +#include "debug.h" #include "debug_sync.h" // DEBUG_SYNC #include <m_ctype.h> #include <my_bit.h> @@ -23005,6 +23006,7 @@ end_send(JOIN *join, JOIN_TAB *join_tab, bool end_of_records) // error < 0 => duplicate row join->duplicate_rows++; } + debug_crash_here("ddl_log_create_after_send_data"); } join->send_records++; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ed82e6deae3..0dee0beae76 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2107,7 +2107,8 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list, !create_info_arg->or_replace_slave_generated()) || create_info_arg->table_was_deleted)) packet->append(STRING_WITH_LEN("OR REPLACE ")); - if (share->tmp_table) + if (share->tmp_table && + !(create_info_arg && create_info_arg->is_atomic_replace())) packet->append(STRING_WITH_LEN("TEMPORARY ")); packet->append(STRING_WITH_LEN("TABLE ")); if (create_info_arg && create_info_arg->if_not_exists()) @@ -5049,7 +5050,7 @@ static int fill_schema_table_from_frm(THD *thd, TABLE *table, init_sql_alloc(key_memory_table_triggers_list, &tbl.mem_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0)); if (!Table_triggers_list::check_n_load(thd, db_name, - table_name, &tbl, 1)) + table_name, &tbl, true, 0)) { table_list.table= &tbl; res= schema_table->process_table(thd, &table_list, table, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index dd940b24f61..48761ee1945 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1242,6 +1242,69 @@ static uint32 get_comment(THD *thd, uint32 comment_pos, return 0; } + +static +bool make_tmp_name(THD *thd, const char *prefix, const Table_name *orig, + Table_name *res) +{ + char res_name[NAME_LEN + 1]; + char file_name[NAME_LEN + 1]; + LEX_CSTRING table_name; + + size_t len= my_snprintf(res_name, sizeof(res_name) - 1, + tmp_file_prefix "-%s-%lx-%llx-", prefix, + current_pid, thd->thread_id); + + uint len2= tablename_to_filename(orig->table_name.str, file_name, + sizeof(res_name) - len - 1); + + DBUG_ASSERT(len + len2 < sizeof(res_name) - 1); + memcpy(res_name + len, file_name, len2 + 1); + len+= len2; + + table_name.str= strmake_root(thd->mem_root, res_name, len); + if (!table_name.str) + return true; + + table_name.length= len; + res->db= orig->db; + res->table_name= table_name; + res->alias= table_name; + return false; +} + + +/** + Helper for making utility table names for atomic CREATE OR REPLACE. + + Creates two temporary names: "create" (used for new table) + and "backup" (used for saving old table). + + @param create_table[in/out] Original table name, on output holds new name + @param create_table_mode[out] Create flags or-ed with C_ALTER_TABLE +*/ + +bool HA_CREATE_INFO::make_tmp_table_list(THD *thd, TABLE_LIST **create_table, + int *create_table_mode) +{ + TABLE_LIST *new_table; + if (make_tmp_name(thd, "create", *create_table, &tmp_name) || + make_tmp_name(thd, "backup", *create_table, &backup_name) || + !(new_table= (TABLE_LIST *)thd->alloc(sizeof(TABLE_LIST)))) + { + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return true; + } + (*create_table_mode)|= C_ALTER_TABLE; + DBUG_ASSERT(!(options & HA_CREATE_TMP_ALTER)); + options|= HA_CREATE_TMP_ALTER; + new_table->init_one_table(&tmp_name.db, &tmp_name.table_name, + &tmp_name.alias, (*create_table)->lock_type); + *create_table= new_table; + return false; +} + + /** Execute the drop of a sequence, view or table (normal or temporary). @@ -1494,12 +1557,13 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db.str, table_name.str, MDL_SHARED)); + /* NOTE: alias holds original table name, table_name holds lowercase name */ alias= (lower_case_table_names == 2) ? table->alias : table_name; /* remove .frm file and engine files */ path_length= build_table_filename(path, sizeof(path) - 1, db.str, alias.str, reg_ext, 0); path_end= path + path_length - reg_ext_length; - } + } /* if (!drop_temporary) */ DEBUG_SYNC(thd, "rm_table_no_locks_before_delete_table"); if (drop_temporary) @@ -1598,7 +1662,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, &table_name); else res= ddl_log_drop_table(ddl_log_state, hton, &cpath, &db, - &table_name); + &table_name, 0); if (res) { error= -1; @@ -1675,8 +1739,17 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, int ferror= 0; DBUG_ASSERT(!was_view); + /* + We where not able to drop the table for the engine. We will now try + to drop the table for any engines (to handle the case where we don't have + an .frm file or when the the information in the .frm does not match the + engine type). + We start by discarding the previous drop attempt, as we have tried + this drop already and it failed. + */ + ddl_log_disable_entry(ddl_log_state); if (ddl_log_drop_table(ddl_log_state, 0, &cpath, &db, - &table_name)) + &table_name, 0)) { error= -1; goto err; @@ -1715,17 +1788,24 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, if (!was_view) { - debug_crash_here("ddl_log_drop_before_drop_trigger"); - ddl_log_update_phase(ddl_log_state, DDL_DROP_PHASE_TRIGGER); - debug_crash_here("ddl_log_drop_before_drop_trigger2"); + if (likely(!error) || non_existing_table_error(error)) + { + debug_crash_here("ddl_log_drop_before_drop_trigger"); + ddl_log_update_phase(ddl_log_state, DDL_DROP_PHASE_TRIGGER); + debug_crash_here("ddl_log_drop_before_drop_trigger2"); + if (Table_triggers_list::drop_all_triggers(thd, &db, &table_name, 0, + MYF(MY_WME | + MY_IGNORE_ENOENT))) + error= error ? error : -1; + } + else + { + /* NOTE: table may not be dropped due to FK error */ + DBUG_ASSERT(error); + ddl_log_update_phase(ddl_log_state, DDL_DROP_PHASE_END); + } } - if (likely(!error) || non_existing_table_error(error)) - { - if (Table_triggers_list::drop_all_triggers(thd, &db, &table_name, - MYF(MY_WME | MY_IGNORE_ENOENT))) - error= error ? error : -1; - } debug_crash_here("ddl_log_drop_after_drop_trigger"); report_error: @@ -1792,7 +1872,12 @@ report_error: backup_log_ddl(&ddl_log); } } - if (!was_view) + /* + Foreign key check may fail and we didn't drop the table. + We are already at DDL_DROP_PHASE_END in this case and we + must not binlog DROP query. + */ + if (!was_view && table_dropped) ddl_log_update_phase(ddl_log_state, DDL_DROP_PHASE_BINLOG); if (!dont_log_query && @@ -2741,7 +2826,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, List_iterator_fast<Create_field> it(alter_info->create_list); List_iterator<Create_field> it2(alter_info->create_list); uint total_uneven_bit_length= 0; - bool tmp_table= create_table_mode == C_ALTER_TABLE; + bool tmp_table= (create_table_mode & C_ALTER_TABLE); const bool create_simple= thd->lex->create_simple(); bool is_hash_field_needed= false; const Column_derived_attributes dattr(create_info->default_table_charset); @@ -2994,6 +3079,18 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, } else fk_key->ref_columns.append(&fk_key->columns); + /* + If this is a self refering table from CREATE ... SELECT, + update the foreign key table name to the used (temporary) table name. + */ + if (create_info->tmp_name.is_set() && + (!fk_key->ref_db.str || + !lex_string_cmp(table_alias_charset, &db, &fk_key->ref_db)) && + !lex_string_cmp(table_alias_charset, &table_name, + &fk_key->ref_table)) + { + fk_key->ref_table= create_info->tmp_name.table_name; + } continue; } (*key_count)++; @@ -4275,11 +4372,170 @@ err: /** + Finalize atomic CREATE OR REPLACE. + + Renames old table to backup table (in case it exists), rename tmp table to + new table. These operations are covered with DDL logging in two chains: + + ddl_log_state_create: rolls back the tables to the original state before + the command was started. + + ddl_log_state_rm: keep the new table and drop the backup table. + + finalize_ddl() executes one of the above chains depending on error or success + state. + + @return true in case of error +*/ + +bool HA_CREATE_INFO::finalize_atomic_replace(THD *thd, TABLE_LIST *orig_table) +{ + rename_param param; + bool dummy; + const LEX_CSTRING db= orig_table->db; + const LEX_CSTRING table_name= orig_table->table_name; + LEX_CSTRING cpath; + char path[FN_REFLEN + 1]; + cpath.str= path; + + debug_crash_here("ddl_log_create_before_install_new"); + if (old_hton) + { + /* Old table exists, rename it to backup_name */ + ddl_log_link_chains(ddl_log_state_rm, ddl_log_state_create); + + cpath.length= build_table_filename(path, sizeof(path) - 1, + backup_name.db.str, + backup_name.table_name.str, + "", FN_IS_TMP); + + if (ddl_log_drop_table_init(ddl_log_state_rm, &backup_name.db, + &empty_clex_str) || + ddl_log_drop_table(ddl_log_state_rm, old_hton, &cpath, + &backup_name.db, &backup_name.table_name, + DDL_LOG_FLAG_FROM_IS_TMP)) + return true; + + debug_crash_here("ddl_log_create_after_log_drop_backup"); + if (ddl_log_rename_table(ddl_log_state_create, old_hton, + &db, &table_name, + &backup_name.db, &backup_name.table_name, + DDL_RENAME_PHASE_TRIGGER, + DDL_LOG_FLAG_FROM_IS_TMP)) + return true; + + debug_crash_here("ddl_log_create_after_log_rename_backup"); + + if (thd->locked_tables_mode == LTM_LOCK_TABLES || + thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES) + { + DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db.str, + table_name.str, + MDL_EXCLUSIVE)); + + close_all_tables_for_name(thd, table->s, + HA_EXTRA_PREPARE_FOR_DROP, NULL); + table= NULL; + orig_table->table= NULL; + } + + param.rename_flags= FN_TO_IS_TMP; + param.from_table_hton= old_hton; + param.old_version= org_tabledef_version; + param.old_alias= lower_case_table_names == 2 ? orig_table->alias : + table_name; + param.new_alias= backup_name.table_name; + if (rename_table_and_triggers(thd, ¶m, NULL, orig_table, + &backup_name.db, false, &dummy)) + return true; + debug_crash_here("ddl_log_create_after_save_backup"); + } + + cpath.length= build_table_filename(path, sizeof(path) - 1, db.str, + table_name.str, "", 0); + param.rename_flags= FN_FROM_IS_TMP; + param.from_table_hton= db_type; + param.old_version= tabledef_version; + param.old_alias= tmp_name.table_name; + param.new_alias= table_name; + if (ddl_log_create_table(ddl_log_state_create, param.from_table_hton, + &cpath, &db, &table_name, false) || + rename_table_and_triggers(thd, ¶m, NULL, &tmp_name, &db, false, + &dummy)) + return true; + debug_crash_here("ddl_log_create_after_install_new"); + return false; +} + + +/** + Execute ddl_log_state_rm or ddl_log_state_create depending on error or success + state. +*/ + +void HA_CREATE_INFO::finalize_ddl(THD *thd, bool roll_back) +{ + if (roll_back) + { + /* + Statement failed + - Forget drop of backup table + - Rollback create (drop temporary table, rename backup to original) + */ + debug_crash_here("ddl_log_create_fk_fail"); + ddl_log_complete(ddl_log_state_rm); + debug_crash_here("ddl_log_create_fk_fail2"); + (void) ddl_log_revert(thd, ddl_log_state_create); + debug_crash_here("ddl_log_create_fk_fail3"); + } + else + { + /* + Statement succeded + - Forget revert of create table + - Drop backup table + */ + debug_crash_here("ddl_log_create_log_complete"); + ddl_log_complete(ddl_log_state_create); + debug_crash_here("ddl_log_create_log_complete2"); + (void) ddl_log_revert(thd, ddl_log_state_rm); + debug_crash_here("ddl_log_create_log_complete3"); + } +} + + +bool HA_CREATE_INFO::finalize_locked_tables(THD *thd) +{ + DBUG_ASSERT(pos_in_locked_tables); + DBUG_ASSERT(thd->locked_tables_mode); + DBUG_ASSERT(thd->variables.option_bits & OPTION_TABLE_LOCK); + /* + Add back the deleted table and re-created table as a locked table + This should always work as we have a meta lock on the table. + */ + thd->locked_tables_list.add_back_last_deleted_lock(pos_in_locked_tables); + if (thd->locked_tables_list.reopen_tables(thd, false)) + { + thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0); + return true; + } + /* + The lock was made exclusive in create_table_impl(). We have now + to bring it back to it's orginal state + */ + TABLE *table= pos_in_locked_tables->table; + table->mdl_ticket->downgrade_lock(MDL_SHARED_NO_READ_WRITE); + + return false; +} + + +/** Create a table @param thd Thread object - @param orig_db Database for error messages - @param orig_table_name Table name for error messages + @param orig_db Database for error messages or atomic replace + @param orig_table_name Table name for error messages or atomic replace (it's different from table_name for ALTER TABLE) @param db Database @param table_name Table name @@ -4314,8 +4570,6 @@ err: static int create_table_impl(THD *thd, - DDL_LOG_STATE *ddl_log_state_create, - DDL_LOG_STATE *ddl_log_state_rm, const LEX_CSTRING &orig_db, const LEX_CSTRING &orig_table_name, const LEX_CSTRING &db, const LEX_CSTRING &table_name, @@ -4324,24 +4578,23 @@ int create_table_impl(THD *thd, int create_table_mode, bool *is_trans, KEY **key_info, uint *key_count, LEX_CUSTRING *frm) { - LEX_CSTRING *alias; + LEX_CSTRING *alias= const_cast<LEX_CSTRING*>(table_case_name(create_info, &table_name)); handler *file= 0; int error= 1; - bool frm_only= create_table_mode == C_ALTER_TABLE_FRM_ONLY; - bool internal_tmp_table= create_table_mode == C_ALTER_TABLE || frm_only; + bool frm_only= (create_table_mode & C_ALTER_TABLE_FRM_ONLY); + bool atomic_replace= create_info->is_atomic_replace(); + bool internal_tmp_table= (!atomic_replace && + (create_table_mode & C_ALTER_TABLE)) || + frm_only; + /* Easy check for ddl logging if we are creating a temporary table */ + DDL_LOG_STATE *ddl_log_state_create= + create_info->tmp_table() ? 0 : create_info->ddl_log_state_create; DBUG_ENTER("create_table_impl"); DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d path: %s", db.str, table_name.str, internal_tmp_table, path.str)); DBUG_ASSERT(create_info->default_table_charset); - /* Easy check for ddl logging if we are creating a temporary table */ - if (create_info->tmp_table()) - { - ddl_log_state_create= 0; - ddl_log_state_rm= 0; - } - if (fix_constraints_names(thd, &alter_info->check_constraint_list, create_info)) DBUG_RETURN(1); @@ -4370,8 +4623,6 @@ int create_table_impl(THD *thd, goto err; } - alias= const_cast<LEX_CSTRING*>(table_case_name(create_info, &table_name)); - /* Check if table exists */ if (create_info->tmp_table()) { @@ -4425,12 +4676,16 @@ int create_table_impl(THD *thd, goto err; } - handlerton *db_type; + handlerton *db_type= NULL; + LEX_CSTRING partition_engine_name= {NULL, 0}; + if (!internal_tmp_table && ha_table_exists(thd, &orig_db, &orig_table_name, &create_info->org_tabledef_version, - NULL, &db_type, NULL, 0)) + &partition_engine_name, &db_type, NULL, 0)) { + create_info->old_hton= db_type; + if (ha_check_if_updates_are_ignored(thd, db_type, "CREATE")) { /* Don't create table. CREATE will still be logged in binary log */ @@ -4440,44 +4695,115 @@ int create_table_impl(THD *thd, if (options.or_replace()) { - (void) delete_statistics_for_table(thd, &db, &table_name); + (void) delete_statistics_for_table(thd, &orig_db, &orig_table_name); TABLE_LIST table_list; - table_list.init_one_table(&db, &table_name, 0, TL_WRITE_ALLOW_WRITE); - table_list.table= create_info->table; + TABLE *table= create_info->table; + table_list.init_one_table(&orig_db, &orig_table_name, 0, TL_READ); + table_list.table= table; if (check_if_log_table(&table_list, TRUE, "CREATE OR REPLACE")) goto err; - - /* - Rollback the empty transaction started in mysql_create_table() - call to open_and_lock_tables() when we are using LOCK TABLES. - */ - (void) trans_rollback_stmt(thd); - /* Remove normal table without logging. Keep tables locked */ - if (mysql_rm_table_no_locks(thd, &table_list, &thd->db, - ddl_log_state_rm, - 0, 0, 0, 0, 1, 1)) - goto err; - debug_crash_here("ddl_log_create_after_drop"); - - /* - We have to log this query, even if it failed later to ensure the - drop is done. - */ - thd->variables.option_bits|= OPTION_BINLOG_THIS; - create_info->table_was_deleted= 1; lex_string_set(&create_info->org_storage_engine_name, - ha_resolve_storage_engine_name(db_type)); - DBUG_EXECUTE_IF("send_kill_after_delete", - thd->set_killed(KILL_QUERY);); - /* - Restart statement transactions for the case of CREATE ... SELECT. - */ - if (thd->lex->first_select_lex()->item_list.elements && - restart_trans_for_tables(thd, thd->lex->query_tables)) - goto err; + ha_resolve_storage_engine_name(db_type)); + + if (db_type == view_pseudo_hton) + atomic_replace= false; + + if (atomic_replace) + { + /* NOTE: here FK referencing is checked */ + if (!(thd->variables.option_bits & OPTION_NO_FOREIGN_KEY_CHECKS)) + { + Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN); + if (!create_info->table) + { + if (open_table(thd, &table_list, &ot_ctx)) + goto err; + table= table_list.table; + } + FOREIGN_KEY_INFO *fk; + bool res= table->referenced_by_foreign_table(thd, &fk); + if (!create_info->table) + { + (void) close_thread_table(thd, &thd->open_tables); + table= NULL; + } + if (res) + { + if (fk) + my_error(ER_ROW_IS_REFERENCED_2, MYF(0), fk->foreign_table->str); + goto err; + } + } + + if (thd->locked_tables_mode == LTM_LOCK_TABLES || + thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES) + { + if (wait_while_table_is_used(thd, table, HA_EXTRA_NOT_USED)) + goto err; + } + else + { + DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, + orig_db.str, + orig_table_name.str, + MDL_EXCLUSIVE)); + } + + /* + Prepare DROP entry for backup log. It will be logged before logging + the CREATE entry when the command succeeds. + */ + backup_log_info *drop_entry= &create_info->drop_entry; + drop_entry->query= { C_STRING_WITH_LEN("DROP") }; + if ((drop_entry->org_partitioned= (partition_engine_name.str != 0))) + drop_entry->org_storage_engine_name= partition_engine_name; + else + lex_string_set(&drop_entry->org_storage_engine_name, + ha_resolve_storage_engine_name(db_type)); + drop_entry->org_database= orig_db; + drop_entry->org_table= orig_table_name; + drop_entry->org_table_id= create_info->org_tabledef_version; + + DBUG_EXECUTE_IF("send_kill_after_delete", thd->set_killed(KILL_QUERY);); + } + else + { + /* + Rollback the empty transaction started in mysql_create_table() + call to open_and_lock_tables() when we are using LOCK TABLES. + */ + (void) trans_rollback_stmt(thd); + + /* Remove normal table without logging. Keep tables locked */ + if (mysql_rm_table_no_locks(thd, &table_list, &thd->db, + create_info->ddl_log_state_rm, + 0, 0, 0, 0, 1, 1)) + goto err; + + /* Locked table was closed */ + create_info->table= table_list.table; + + debug_crash_here("ddl_log_create_after_drop"); + + /* + We have to log this query, even if it failed later to ensure the + drop is done. + */ + thd->variables.option_bits|= OPTION_BINLOG_THIS; + create_info->table_was_deleted= 1; + + DBUG_EXECUTE_IF("send_kill_after_delete", thd->set_killed(KILL_QUERY);); + + /* + Restart statement transactions for the case of CREATE ... SELECT. + */ + if (thd->lex->first_select_lex()->item_list.elements && + restart_trans_for_tables(thd, thd->lex->query_tables)) + goto err; + } } else if (options.if_not_exists()) { @@ -4496,18 +4822,19 @@ int create_table_impl(THD *thd, } else { - my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name.str); + DBUG_ASSERT(!atomic_replace); + my_error(ER_TABLE_EXISTS_ERROR, MYF(0), orig_table_name.str); goto err; } - } - } + } /* ha_table_exists() */ + } /* else (!create_info->tmp_table()) */ THD_STAGE_INFO(thd, stage_creating_table); if (check_engine(thd, orig_db.str, orig_table_name.str, create_info)) goto err; - if (create_table_mode == C_ASSISTED_DISCOVERY) + if (create_table_mode & C_ASSISTED_DISCOVERY) { /* check that it's used correctly */ DBUG_ASSERT(alter_info->create_list.elements == 0); @@ -4593,8 +4920,8 @@ int create_table_impl(THD *thd, if (!frm_only) { debug_crash_here("ddl_log_create_before_create_table"); - if (ha_create_table(thd, path.str, db.str, table_name.str, create_info, - frm, 0)) + if (ha_create_table(thd, path.str, orig_db.str, orig_table_name.str, + create_info, frm, 0)) { file->ha_create_partitioning_metadata(path.str, NULL, CHF_DELETE_FLAG); deletefrm(path.str); @@ -4650,21 +4977,40 @@ warn: Simple wrapper around create_table_impl() to be used in various version of CREATE TABLE statement. + @param thd Thread object + @param orig_db Database for error messages or atomic replace + @param orig_table_name Table name for error messages or atomic replace + (it's different from table_name for ALTER TABLE) + @param db Database + @param table_name Table name + @param create_info Create information (like MAX_ROWS) + @param alter_info Description of fields and keys for new table + @param[out] is_trans Identifies the type of engine where the table + was created: either trans or non-trans. + @param create_table_mode C_ORDINARY_CREATE, C_ALTER_TABLE, + C_ASSISTED_DISCOVERY or C_ALTER_TABLE_FRM_ONLY. + or any positive number (for C_CREATE_SELECT). + If set to C_ALTER_TABLE_FRM_ONY then no frm or + table is created, only the frm image in memory. + @param[out] frm The frm image. + @result 1 unspecifed error 2 error; Don't log create statement 0 ok -1 Table was used with IF NOT EXISTS and table existed (warning, not error) + + TODO: orig_db, orig_table_name, db, table_name should be moved to create_info */ -int mysql_create_table_no_lock(THD *thd, - DDL_LOG_STATE *ddl_log_state_create, - DDL_LOG_STATE *ddl_log_state_rm, +int mysql_create_table_no_lock(THD *thd, const LEX_CSTRING *orig_db, + const LEX_CSTRING *orig_table_name, const LEX_CSTRING *db, const LEX_CSTRING *table_name, Table_specification_st *create_info, Alter_info *alter_info, bool *is_trans, - int create_table_mode, TABLE_LIST *table_list) + int create_table_mode, TABLE_LIST *table_list, + LEX_CUSTRING *frm) { KEY *not_used_1; uint not_used_2; @@ -4672,7 +5018,14 @@ int mysql_create_table_no_lock(THD *thd, uint path_length; char path[FN_REFLEN + 1]; LEX_CSTRING cpath; - LEX_CUSTRING frm= {0,0}; + LEX_CUSTRING frm_local; + + if (!frm) + { + /* Used in atomic replace */ + frm_local= {0, 0}; + frm= &frm_local; + } DBUG_ASSERT(create_info->default_table_charset); @@ -4681,9 +5034,9 @@ int mysql_create_table_no_lock(THD *thd, else { const LEX_CSTRING *alias= table_case_name(create_info, table_name); + uint flags= (create_info->options & HA_CREATE_TMP_ALTER) ? FN_IS_TMP : 0; path_length= build_table_filename(path, sizeof(path) - 1, db->str, - alias->str, - "", 0); + alias->str, "", flags); // Check if we hit FN_REFLEN bytes along with file extension. if (path_length+reg_ext_length > FN_REFLEN) { @@ -4694,12 +5047,12 @@ int mysql_create_table_no_lock(THD *thd, } lex_string_set3(&cpath, path, path_length); - res= create_table_impl(thd, ddl_log_state_create, ddl_log_state_rm, - *db, *table_name, *db, *table_name, cpath, - *create_info, create_info, - alter_info, create_table_mode, - is_trans, ¬_used_1, ¬_used_2, &frm); - my_free(const_cast<uchar*>(frm.str)); + res= create_table_impl(thd, *orig_db, *orig_table_name, *db, *table_name, + cpath, *create_info, create_info, alter_info, + create_table_mode, is_trans, ¬_used_1, ¬_used_2, + frm); + if (frm == &frm_local) + my_free(const_cast<uchar *>(frm_local.str)); if (!res && create_info->sequence) { @@ -4714,8 +5067,7 @@ int mysql_create_table_no_lock(THD *thd, DBUG_ASSERT(thd->is_error()); /* Drop the table as it wasn't completely done */ if (!mysql_rm_table_no_locks(thd, table_list, &thd->db, - (DDL_LOG_STATE*) 0, - 1, + NULL, 1, create_info->tmp_table(), false, true /* Sequence*/, true /* Don't log_query */, @@ -4756,7 +5108,9 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, int create_table_mode; uint save_thd_create_info_options; bool is_trans= FALSE; - bool result; + int result; + TABLE_LIST *orig_table= create_table; + const bool atomic_replace= create_info->is_atomic_replace(); DBUG_ENTER("mysql_create_table"); DBUG_ASSERT(create_info->default_table_charset); @@ -4765,6 +5119,8 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, bzero(&ddl_log_state_create, sizeof(ddl_log_state_create)); bzero(&ddl_log_state_rm, sizeof(ddl_log_state_rm)); + create_info->ddl_log_state_create= &ddl_log_state_create; + create_info->ddl_log_state_rm= &ddl_log_state_rm; /* Copy temporarily the statement flags to thd for lock_table_names() */ save_thd_create_info_options= thd->lex->create_info.options; @@ -4793,6 +5149,7 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, if ((create_info->table= create_table->table)) { pos_in_locked_tables= create_info->table->pos_in_locked_tables; + create_info->pos_in_locked_tables= pos_in_locked_tables; mdl_ticket= create_table->table->mdl_ticket; } @@ -4810,42 +5167,33 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, /* We can abort create table for any table type */ thd->abort_on_warning= thd->is_strict_mode(); - if (mysql_create_table_no_lock(thd, &ddl_log_state_create, &ddl_log_state_rm, - &create_table->db, &create_table->table_name, - create_info, alter_info, &is_trans, - create_table_mode, create_table) > 0) + if (atomic_replace && + create_info->make_tmp_table_list(thd, &create_table, &create_table_mode)) { result= 1; goto err; } - /* - Check if we are doing CREATE OR REPLACE TABLE under LOCK TABLES - on a non temporary table - */ - if (thd->locked_tables_mode && pos_in_locked_tables && - create_info->or_replace()) + if (mysql_create_table_no_lock(thd, + &orig_table->db, + &orig_table->table_name, + &create_table->db, + &create_table->table_name, create_info, + alter_info, + &is_trans, create_table_mode, + create_table) > 0) { - DBUG_ASSERT(thd->variables.option_bits & OPTION_TABLE_LOCK); - /* - Add back the deleted table and re-created table as a locked table - This should always work as we have a meta lock on the table. - */ - thd->locked_tables_list.add_back_last_deleted_lock(pos_in_locked_tables); - if (thd->locked_tables_list.reopen_tables(thd, false)) - { - thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0); - result= 1; - goto err; - } - else - { - TABLE *table= pos_in_locked_tables->table; - table->mdl_ticket->downgrade_lock(MDL_SHARED_NO_READ_WRITE); - } + result= 1; + goto err; } err: + if (atomic_replace) + { + create_table= orig_table; + create_info->table= orig_table->table; + } + thd->abort_on_warning= 0; /* In RBR or readonly server we don't need to log CREATE TEMPORARY TABLE */ @@ -4858,6 +5206,8 @@ err: if (create_info->tmp_table()) thd->transaction->stmt.mark_created_temp_table(); + else if (!result && atomic_replace) + result= create_info->finalize_atomic_replace(thd, orig_table); /* Write log if no error or if we already deleted a table */ if (!result || thd->log_current_statement()) @@ -4878,12 +5228,16 @@ err: we should log a delete of it. If create_info->table was not set, it's a normal table and table_creation_was_logged will be set when the share is created. + + NOTE: this is only needed for non-atomic CREATE OR REPLACE and + CREATE TEMPORARY TABLE. */ + DBUG_ASSERT(!atomic_replace); create_info->table->s->table_creation_was_logged= 1; } thd->binlog_xid= thd->query_id; ddl_log_update_xid(&ddl_log_state_create, thd->binlog_xid); - if (ddl_log_state_rm.is_active()) + if (ddl_log_state_rm.is_active() && !atomic_replace) ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid); debug_crash_here("ddl_log_create_before_binlog"); if (unlikely(write_bin_log(thd, result ? FALSE : TRUE, thd->query(), @@ -4902,11 +5256,25 @@ err: ddl_log.org_database= create_table->db; ddl_log.org_table= create_table->table_name; ddl_log.org_table_id= create_info->tabledef_version; + if (create_info->drop_entry.query.length) + { + DBUG_ASSERT(atomic_replace); + backup_log_ddl(&create_info->drop_entry); + } backup_log_ddl(&ddl_log); } } - ddl_log_complete(&ddl_log_state_rm); - ddl_log_complete(&ddl_log_state_create); + + create_info->finalize_ddl(thd, result); + + /* + Check if we are doing CREATE OR REPLACE TABLE under LOCK TABLES + on a non temporary table + */ + if (thd->locked_tables_mode && pos_in_locked_tables && + create_info->or_replace()) + result|= (int) create_info->finalize_locked_tables(thd); + DBUG_RETURN(result); } @@ -5214,10 +5582,15 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, bool src_table_exists= FALSE; uint not_used; int create_res; + TABLE_LIST *orig_table= table; + const bool atomic_replace= create_info->is_atomic_replace(); + int create_table_mode= C_ORDINARY_CREATE; DBUG_ENTER("mysql_create_like_table"); bzero(&ddl_log_state_create, sizeof(ddl_log_state_create)); bzero(&ddl_log_state_rm, sizeof(ddl_log_state_rm)); + local_create_info.ddl_log_state_create= &ddl_log_state_create; + local_create_info.ddl_log_state_rm= &ddl_log_state_rm; #ifdef WITH_WSREP if (WSREP(thd) && !thd->wsrep_applier && @@ -5325,14 +5698,22 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, /* The following is needed only in case of lock tables */ if ((local_create_info.table= thd->lex->query_tables->table)) - pos_in_locked_tables= local_create_info.table->pos_in_locked_tables; + { + pos_in_locked_tables= local_create_info.table->pos_in_locked_tables; + local_create_info.pos_in_locked_tables= pos_in_locked_tables; + } + + if (atomic_replace && + local_create_info.make_tmp_table_list(thd, &table, &create_table_mode)) + goto err; res= ((create_res= mysql_create_table_no_lock(thd, - &ddl_log_state_create, &ddl_log_state_rm, + &orig_table->db, + &orig_table->table_name, &table->db, &table->table_name, &local_create_info, &local_alter_info, - &is_trans, C_ORDINARY_CREATE, + &is_trans, create_table_mode, table)) > 0); /* Remember to log if we deleted something */ do_logging= thd->log_current_statement(); @@ -5340,46 +5721,18 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, goto err; /* - Check if we are doing CREATE OR REPLACE TABLE under LOCK TABLES - on a non temporary table + Ensure that we have an exclusive lock on target table if we are creating + non-temporary table. We don't have or need the lock if the create failed + because of existing table when using "if exists". */ - if (thd->locked_tables_mode && pos_in_locked_tables && - create_info->or_replace()) - { - /* - Add back the deleted table and re-created table as a locked table - This should always work as we have a meta lock on the table. - */ - thd->locked_tables_list.add_back_last_deleted_lock(pos_in_locked_tables); - if (thd->locked_tables_list.reopen_tables(thd, false)) - { - thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0); - res= 1; // We got an error - } - else - { - /* - Get pointer to the newly opened table. We need this to ensure we - don't reopen the table when doing statment logging below. - */ - table->table= pos_in_locked_tables->table; - table->table->mdl_ticket->downgrade_lock(MDL_SHARED_NO_READ_WRITE); - } - } - else - { - /* - Ensure that we have an exclusive lock on target table if we are creating - non-temporary table. We don't have or need the lock if the create failed - because of existing table when using "if exists". - */ - DBUG_ASSERT((create_info->tmp_table()) || create_res < 0 || - thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, - table->table_name.str, - MDL_EXCLUSIVE) || - (thd->locked_tables_mode && pos_in_locked_tables && - create_info->if_not_exists())); - } + DBUG_ASSERT((thd->locked_tables_mode && pos_in_locked_tables && + create_info->or_replace()) || atomic_replace || + (create_info->tmp_table()) || create_res < 0 || + thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str, + table->table_name.str, + MDL_EXCLUSIVE) || + (thd->locked_tables_mode && pos_in_locked_tables && + create_info->if_not_exists())); DEBUG_SYNC(thd, "create_table_like_before_binlog"); @@ -5404,10 +5757,20 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, if (thd->is_current_stmt_binlog_format_row() || force_generated_create) { /* - Since temporary tables are not replicated under row-based - replication, CREATE TABLE ... LIKE ... needs special - treatement. We have some cases to consider, according to the - following decision table: + The logging for CREATE .. LIKE is a bit different from normal + create as we want in statement-based logging use the original statement. + + Generated statement means the CREATE TABLE statement without LIKE. Same + thing we do with CREATE .. SELECT in row based logging. It is needed to + get replication working if the original table didn't exists. + + However as an engine can change a table definition, it is probly better to + use CREATE TABLE instead of LIKE to ensure the table definition will be + same on both side. (This is just a guess). + + Since temporary tables are not replicated under row-based replication, + CREATE TABLE .. LIKE needs special treatment. We have some cases to + consider, according to the following decision table: ==== ========= ========= ============================== Case Target Source Write to binary log @@ -5431,7 +5794,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, query.length(0); // Have to zero it since constructor doesn't Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN | MYSQL_OPEN_IGNORE_KILLED); - bool new_table= FALSE; // Whether newly created table is open. + bool opened_new_table= FALSE; // Whether newly created table is open. if (create_res != 0) { @@ -5450,6 +5813,22 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, save_open_strategy= table->open_strategy; table->open_strategy= TABLE_LIST::OPEN_NORMAL; + if (atomic_replace) + { + /* + NOTE: We acquire explicit lock for temporary table just to make + close_thread_table() happy. We open it like a normal table + because it's too complex to open it like tmp_table here. + */ + table->mdl_request.duration= MDL_EXPLICIT; + if (thd->mdl_context.acquire_lock(&table->mdl_request, + thd->variables.lock_wait_timeout)) + { + res= 1; + goto err; + } + } + /* In order for show_create_table() to work we need to open destination table if it is not already open (i.e. if it @@ -5466,7 +5845,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, res= 1; goto err; } - new_table= TRUE; + opened_new_table= TRUE; } /* We have to re-test if the table was a view as the view may not @@ -5489,26 +5868,52 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, */ create_info->used_fields|= HA_CREATE_USED_ENGINE; + const LEX_CSTRING *const db= + table->schema_table ? &INFORMATION_SCHEMA_NAME : &orig_table->db; + const char *force_db= NULL; + if (!thd->db.str || cmp(db, &thd->db)) + force_db= db->str; + int result __attribute__((unused))= - show_create_table(thd, table, &query, create_info, WITH_DB_NAME); + show_create_table_ex(thd, table, + force_db, orig_table->table_name.str, + &query, create_info, WITH_DB_NAME); DBUG_ASSERT(result == 0); // show_create_table() always return 0 do_logging= FALSE; + + thd->binlog_xid= thd->query_id; + ddl_log_update_xid(&ddl_log_state_create, thd->binlog_xid); + if (ddl_log_state_rm.is_active() && !atomic_replace) + ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid); + debug_crash_here("ddl_log_create_before_binlog"); + if (write_bin_log(thd, TRUE, query.ptr(), query.length())) { res= 1; + thd->binlog_xid= 0; goto err; } - if (new_table) + debug_crash_here("ddl_log_create_after_binlog"); + thd->binlog_xid= 0; + + if (opened_new_table) { DBUG_ASSERT(thd->open_tables == table->table); /* When opening the table, we ignored the locked tables (MYSQL_OPEN_GET_NEW_TABLE). Now we can close the table without risking to close some locked table. + + For atomic_replace we must remove TABLE and TABLE_SHARE + from cache since they are the objects for temporary table. */ + if (atomic_replace) + table->table->s->tdc->flushed= true; close_thread_table(thd, &thd->open_tables); + if (atomic_replace) + thd->mdl_context.release_lock(table->mdl_request.ticket); } } } @@ -5532,7 +5937,11 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, /* Remember that tmp table creation was logged so that we know if we should log a delete of it. + + NOTE: this is only needed for non-atomic CREATE OR REPLACE and + CREATE TEMPORARY TABLE. */ + DBUG_ASSERT(!atomic_replace); local_create_info.table->s->table_creation_was_logged= 1; } } @@ -5540,13 +5949,26 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, } err: + if (atomic_replace) + { + table= orig_table; + local_create_info.table= orig_table->table; + + if (!res) + { + res= local_create_info.finalize_atomic_replace(thd, orig_table); + if (res) + do_logging= false; + } + } + if (do_logging) { thd->binlog_xid= thd->query_id; ddl_log_update_xid(&ddl_log_state_create, thd->binlog_xid); - if (ddl_log_state_rm.is_active()) + if (ddl_log_state_rm.is_active() && !atomic_replace) ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid); - debug_crash_here("ddl_log_create_before_binlog"); + debug_crash_here("ddl_log_create_before_binlog"); if (res && create_info->table_was_deleted) { /* @@ -5554,6 +5976,7 @@ err: We have to log it. */ DBUG_ASSERT(ddl_log_state_rm.is_active()); + DBUG_ASSERT(!atomic_replace); log_drop_table(thd, &table->db, &table->table_name, &create_info->org_storage_engine_name, create_info->db_type == partition_hton, @@ -5579,11 +6002,24 @@ err: ddl_log.org_database= table->db; ddl_log.org_table= table->table_name; ddl_log.org_table_id= local_create_info.tabledef_version; + if (local_create_info.drop_entry.query.length) + { + DBUG_ASSERT(atomic_replace); + backup_log_ddl(&local_create_info.drop_entry); + } backup_log_ddl(&ddl_log); } - ddl_log_complete(&ddl_log_state_rm); - ddl_log_complete(&ddl_log_state_create); + local_create_info.finalize_ddl(thd, res); + + /* + Check if we are doing CREATE OR REPLACE TABLE under LOCK TABLES + on a non temporary table + */ + if (thd->locked_tables_mode && pos_in_locked_tables && + create_info->or_replace()) + res|= (int) local_create_info.finalize_locked_tables(thd); + DBUG_RETURN(res != 0); } @@ -9449,7 +9885,8 @@ simple_rename_or_index_change(THD *thd, TABLE_LIST *table_list, (void) ddl_log_rename_table(&ddl_log_state, old_db_type, &alter_ctx->db, &alter_ctx->table_name, - &alter_ctx->new_db, &alter_ctx->new_alias); + &alter_ctx->new_db, &alter_ctx->new_alias, + DDL_RENAME_PHASE_TABLE, 0); if (mysql_rename_table(old_db_type, &alter_ctx->db, &alter_ctx->table_name, &alter_ctx->new_db, &alter_ctx->new_alias, &table_version, 0)) @@ -10543,8 +10980,7 @@ do_continue:; 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, + error= create_table_impl(thd, alter_ctx.db, alter_ctx.table_name, alter_ctx.new_db, alter_ctx.tmp_name, alter_ctx.get_tmp_cstring_path(), thd->lex->create_info, create_info, alter_info, diff --git a/sql/sql_table.h b/sql/sql_table.h index 4d74aadc02a..2cead6fa683 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -27,8 +27,10 @@ class Alter_info; class Alter_table_ctx; +struct Atomic_info; class Column_definition; class Create_field; +struct Table_name; struct TABLE_LIST; class THD; struct TABLE; @@ -94,49 +96,15 @@ uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen); bool add_keyword_to_query(THD *thd, String *result, const LEX_CSTRING *keyword, const LEX_CSTRING *add); -/* - mysql_create_table_no_lock can be called in one of the following - mutually exclusive situations: - - - Just a normal ordinary CREATE TABLE statement that explicitly - defines the table structure. - - - CREATE TABLE ... SELECT. It is special, because only in this case, - the list of fields is allowed to have duplicates, as long as one of the - duplicates comes from the select list, and the other doesn't. For - example in - - CREATE TABLE t1 (a int(5) NOT NUL) SELECT b+10 as a FROM t2; - - the list in alter_info->create_list will have two fields `a`. - - - ALTER TABLE, that creates a temporary table #sql-xxx, which will be later - renamed to replace the original table. - - - ALTER TABLE as above, but which only modifies the frm file, it only - creates an frm file for the #sql-xxx, the table in the engine is not - created. - - - Assisted discovery, CREATE TABLE statement without the table structure. - - These situations are distinguished by the following "create table mode" - values, where a CREATE ... SELECT is denoted by any non-negative number - (which should be the number of fields in the SELECT ... part), and other - cases use constants as defined below. -*/ -#define C_ORDINARY_CREATE 0 -#define C_ALTER_TABLE 1 -#define C_ALTER_TABLE_FRM_ONLY 2 -#define C_ASSISTED_DISCOVERY 3 - int mysql_create_table_no_lock(THD *thd, - DDL_LOG_STATE *ddl_log_state, - DDL_LOG_STATE *ddl_log_state_rm, + const LEX_CSTRING *orig_db, + const LEX_CSTRING *orig_table_name, const LEX_CSTRING *db, const LEX_CSTRING *table_name, Table_specification_st *create_info, Alter_info *alter_info, bool *is_trans, - int create_table_mode, TABLE_LIST *table); + int create_table_mode, TABLE_LIST *table, + LEX_CUSTRING *frm= NULL); handler *mysql_create_frm_image(THD *thd, const LEX_CSTRING &db, @@ -170,6 +138,31 @@ bool mysql_compare_tables(TABLE *table, HA_CREATE_INFO *create_info, bool *metadata_equal); bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool table_copy); +/** + Parameters for rename_table_and_triggers() +*/ +struct rename_param +{ + LEX_CSTRING old_alias, new_alias; + LEX_CUSTRING old_version; + handlerton *from_table_hton; + int rename_flags; /* FN_FROM_IS_TMP, FN_TO_IS_TMP, etc */ + rename_param() : + from_table_hton(NULL), + rename_flags(0) {} +}; +bool +rename_table_and_triggers(THD *thd, rename_param *param, + DDL_LOG_STATE *ddl_log_state, + Table_name *ren_table, const LEX_CSTRING *new_db, + bool skip_error, bool *force_if_exists); +int +rename_check_preconditions(THD *thd, rename_param *param, + Table_name *ren_table, + const LEX_CSTRING *new_db, + const LEX_CSTRING *new_table_name, + const LEX_CSTRING *new_table_alias, + bool if_exists); bool mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db, const LEX_CSTRING *old_name, const LEX_CSTRING *new_db, const LEX_CSTRING *new_name, LEX_CUSTRING *id, diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 77035219d2f..6fe0d5384a9 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1195,9 +1195,11 @@ bool Trigger::add_to_file_list(void* param_arg) */ static bool rm_trigger_file(char *path, const LEX_CSTRING *db, - const LEX_CSTRING *table_name, myf MyFlags) + const LEX_CSTRING *table_name, uint flags, + myf MyFlags) { - build_table_filename(path, FN_REFLEN-1, db->str, table_name->str, TRG_EXT, 0); + build_table_filename(path, FN_REFLEN - 1, db->str, table_name->str, TRG_EXT, + flags); return mysql_file_delete(key_file_trg, path, MyFlags); } @@ -1239,7 +1241,8 @@ bool rm_trigname_file(char *path, const LEX_CSTRING *db, */ bool Table_triggers_list::save_trigger_file(THD *thd, const LEX_CSTRING *db, - const LEX_CSTRING *table_name) + const LEX_CSTRING *table_name, + uint flags) { char file_buff[FN_REFLEN]; LEX_CSTRING file; @@ -1249,7 +1252,7 @@ bool Table_triggers_list::save_trigger_file(THD *thd, const LEX_CSTRING *db, DBUG_RETURN(true); file.length= build_table_filename(file_buff, FN_REFLEN - 1, db->str, table_name->str, - TRG_EXT, 0); + TRG_EXT, flags); file.str= file_buff; DBUG_RETURN(sql_create_definition_file(NULL, &file, &triggers_file_type, (uchar*) this, @@ -1359,12 +1362,12 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables, drop or create ddl_log recovery will ensure that all related trigger files are deleted or the original ones are restored. */ - if (rm_trigger_file(path, &tables->db, &tables->table_name, MYF(MY_WME))) + if (rm_trigger_file(path, &tables->db, &tables->table_name, 0, MYF(MY_WME))) goto err; } else { - if (save_trigger_file(thd, &tables->db, &tables->table_name)) + if (save_trigger_file(thd, &tables->db, &tables->table_name, 0)) goto err; } @@ -1523,7 +1526,8 @@ bool Table_triggers_list::prepare_record_accessors(TABLE *table) bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *table_name, TABLE *table, - bool names_only) + bool names_only, + uint flags) { char path_buff[FN_REFLEN]; LEX_CSTRING path; @@ -1532,7 +1536,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const LEX_CSTRING *db, DBUG_ENTER("Table_triggers_list::check_n_load"); path.length= build_table_filename(path_buff, FN_REFLEN - 1, - db->str, table_name->str, TRG_EXT, 0); + db->str, table_name->str, TRG_EXT, flags); path.str= path_buff; // QQ: should we analyze errno somehow ? @@ -2022,7 +2026,7 @@ bool add_table_for_trigger(THD *thd, bool Table_triggers_list::drop_all_triggers(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *name, - myf MyFlags) + uint flags, myf MyFlags) { TABLE table; char path[FN_REFLEN]; @@ -2033,11 +2037,11 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, const LEX_CSTRING *db, init_sql_alloc(key_memory_Table_trigger_dispatcher, &table.mem_root, 8192, 0, MYF(MY_WME)); - if (Table_triggers_list::check_n_load(thd, db, name, &table, 1)) + if (Table_triggers_list::check_n_load(thd, db, name, &table, true, flags)) { result= 1; /* We couldn't parse trigger file, best to just remove it */ - rm_trigger_file(path, db, name, MyFlags); + rm_trigger_file(path, db, name, flags, MyFlags); goto end; } if (table.triggers) @@ -2071,7 +2075,7 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, const LEX_CSTRING *db, } } } - if (rm_trigger_file(path, db, name, MyFlags)) + if (rm_trigger_file(path, db, name, flags, MyFlags)) result= 1; delete table.triggers; } @@ -2113,7 +2117,8 @@ change_table_name_in_triggers(THD *thd, const LEX_CSTRING *old_db_name, const LEX_CSTRING *new_db_name, const LEX_CSTRING *old_table_name, - const LEX_CSTRING *new_table_name) + const LEX_CSTRING *new_table_name, + uint flags) { struct change_table_name_param param; sql_mode_t save_sql_mode= thd->variables.sql_mode; @@ -2129,13 +2134,15 @@ change_table_name_in_triggers(THD *thd, if (unlikely(thd->is_fatal_error)) return TRUE; /* OOM */ - if (save_trigger_file(thd, new_db_name, new_table_name)) + if (save_trigger_file(thd, new_db_name, new_table_name, + (flags & FN_TO_IS_TMP))) return TRUE; - if (rm_trigger_file(path_buff, old_db_name, old_table_name, MYF(MY_WME))) + if (rm_trigger_file(path_buff, old_db_name, old_table_name, + (flags & FN_FROM_IS_TMP), MYF(MY_WME))) { (void) rm_trigger_file(path_buff, new_db_name, new_table_name, - MYF(MY_WME)); + (flags & FN_TO_IS_TMP), MYF(MY_WME)); return TRUE; } return FALSE; @@ -2285,7 +2292,8 @@ Table_triggers_list::prepare_for_rename(THD *thd, my_strcasecmp(table_alias_charset, old_alias->str, new_table->str)); - if (Table_triggers_list::check_n_load(thd, db, old_table, table, TRUE)) + if (Table_triggers_list::check_n_load(thd, db, old_table, table, TRUE, + param->rename_flags)) { result= 1; goto end; @@ -2372,15 +2380,17 @@ bool Table_triggers_list::change_table_name(THD *thd, This method interfaces the mysql server code protected by an exclusive metadata lock. */ - DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db->str, + DBUG_ASSERT((param->rename_flags & FN_FROM_IS_TMP) || + thd->mdl_context.is_lock_owner(MDL_key::TABLE, db->str, old_table->str, MDL_EXCLUSIVE)); if (table->triggers) { - if (unlikely(table->triggers->change_table_name_in_triggers(thd, db, new_db, - old_alias, - new_table))) + if (unlikely(table->triggers-> + change_table_name_in_triggers(thd, db, new_db, old_alias, + new_table, + param->rename_flags))) { result= 1; goto end; @@ -2398,9 +2408,9 @@ bool Table_triggers_list::change_table_name(THD *thd, (void) table->triggers->change_table_name_in_trignames( upgrading50to51 ? new_db : NULL, db, old_alias, err_trigger); - (void) table->triggers->change_table_name_in_triggers( - thd, db, new_db, - new_table, old_alias); + (void) table->triggers-> + change_table_name_in_triggers(thd, db, new_db, new_table, old_alias, + (param->rename_flags ^ FN_IS_TMP)); result= 1; goto end; } diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index 739669c86a5..e3782500421 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -3,7 +3,7 @@ /* Copyright (c) 2004, 2011, Oracle and/or its affiliates. - Copyright (c) 2017, MariaDB Corporation. + Copyright (c) 2017, 2022, 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 @@ -89,10 +89,12 @@ public: TABLE table; bool upgrading50to51; bool got_error; + int rename_flags; TRIGGER_RENAME_PARAM() { upgrading50to51= got_error= 0; + rename_flags= 0; table.reset(); } ~TRIGGER_RENAME_PARAM() @@ -255,12 +257,14 @@ public: bool old_row_is_record1); void empty_lists(); bool create_lists_needed_for_files(MEM_ROOT *root); - bool save_trigger_file(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *table_name); + bool save_trigger_file(THD *thd, const LEX_CSTRING *db, + const LEX_CSTRING *table_name, uint flags); static bool check_n_load(THD *thd, const LEX_CSTRING *db, const LEX_CSTRING *table_name, - TABLE *table, bool names_only); + TABLE *table, bool names_only, uint flags); static bool drop_all_triggers(THD *thd, const LEX_CSTRING *db, - const LEX_CSTRING *table_name, myf MyFlags); + const LEX_CSTRING *table_name, uint flags, + myf MyFlags); static bool prepare_for_rename(THD *thd, TRIGGER_RENAME_PARAM *param, const LEX_CSTRING *db, const LEX_CSTRING *old_alias, @@ -333,7 +337,8 @@ private: const LEX_CSTRING *old_db_name, const LEX_CSTRING *new_db_name, const LEX_CSTRING *old_table_name, - const LEX_CSTRING *new_table_name); + const LEX_CSTRING *new_table_name, + uint flags); bool check_for_broken_triggers() { diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index a0ef89ff0f5..283714bdd1b 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2010, 2015, Oracle and/or its affiliates. - Copyright (c) 2012, 2018, MariaDB + Copyright (c) 2012, 2022, MariaDB 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 @@ -116,18 +116,18 @@ static const char *fk_info_str(THD *thd, FOREIGN_KEY_INFO *fk_info) error was emitted. */ -static bool -fk_truncate_illegal_if_parent(THD *thd, TABLE *table) +bool +TABLE::referenced_by_foreign_table(THD *thd, FOREIGN_KEY_INFO **fk_info) const { - FOREIGN_KEY_INFO *fk_info; List<FOREIGN_KEY_INFO> fk_list; List_iterator_fast<FOREIGN_KEY_INFO> it; + *fk_info= NULL; /* Bail out early if the table is not referenced by a foreign key. In this case, the table could only be, if at all, a child table. */ - if (! table->file->referenced_by_foreign_key()) + if (! file->referenced_by_foreign_key()) return FALSE; /* @@ -136,7 +136,7 @@ fk_truncate_illegal_if_parent(THD *thd, TABLE *table) of foreign keys referencing this table in order to check the name of the child (dependent) tables. */ - table->file->get_parent_foreign_key_list(thd, &fk_list); + file->get_parent_foreign_key_list(thd, &fk_list); /* Out of memory when building list. */ if (unlikely(thd->is_error())) @@ -145,25 +145,22 @@ fk_truncate_illegal_if_parent(THD *thd, TABLE *table) it.init(fk_list); /* Loop over the set of foreign keys for which this table is a parent. */ - while ((fk_info= it++)) + while ((*fk_info= it++)) { - if (lex_string_cmp(system_charset_info, fk_info->referenced_db, - &table->s->db) || - lex_string_cmp(system_charset_info, fk_info->referenced_table, - &table->s->table_name) || - lex_string_cmp(system_charset_info, fk_info->foreign_db, - &table->s->db) || - lex_string_cmp(system_charset_info, fk_info->foreign_table, - &table->s->table_name)) + if (lex_string_cmp(system_charset_info, (*fk_info)->referenced_db, + &s->db) || + lex_string_cmp(system_charset_info, (*fk_info)->referenced_table, + &s->table_name) || + lex_string_cmp(system_charset_info, (*fk_info)->foreign_db, + &s->db) || + lex_string_cmp(system_charset_info, (*fk_info)->foreign_table, + &s->table_name)) break; } /* Table is parent in a non-self-referencing foreign key. */ - if (fk_info) - { - my_error(ER_TRUNCATE_ILLEGAL_FK, MYF(0), fk_info_str(thd, fk_info)); - return TRUE; - } + if (*fk_info) + return TRUE; /* tested by main.trigger-trans */ return FALSE; } @@ -193,6 +190,7 @@ Sql_cmd_truncate_table::handler_truncate(THD *thd, TABLE_LIST *table_ref, int error= 0; uint flags= 0; TABLE *table; + FOREIGN_KEY_INFO *fk_info; DBUG_ENTER("Sql_cmd_truncate_table::handler_truncate"); /* @@ -233,8 +231,13 @@ Sql_cmd_truncate_table::handler_truncate(THD *thd, TABLE_LIST *table_ref, /* Whether to truncate regardless of foreign keys. */ if (! (thd->variables.option_bits & OPTION_NO_FOREIGN_KEY_CHECKS)) - if (fk_truncate_illegal_if_parent(thd, table_ref->table)) + if (table_ref->table->referenced_by_foreign_table(thd, &fk_info)) + { + /* Table is parent in a non-self-referencing foreign key. */ + if (fk_info) + my_error(ER_TRUNCATE_ILLEGAL_FK, MYF(0), fk_info_str(thd, fk_info)); DBUG_RETURN(TRUNCATE_FAILED_SKIP_BINLOG); + } table= table_ref->table; diff --git a/sql/structs.h b/sql/structs.h index b36f8e6a1a0..1c3873196da 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -2,7 +2,7 @@ #define STRUCTS_INCLUDED /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, MariaDB Corporation. + Copyright (c) 2009, 2022, 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 @@ -1016,4 +1016,14 @@ public: }; +struct Table_name +{ + LEX_CSTRING db; + LEX_CSTRING table_name; + LEX_CSTRING alias; + bool is_set() const + { + return table_name.str; + } +}; #endif /* STRUCTS_INCLUDED */ diff --git a/sql/table.h b/sql/table.h index 02e8998adb9..b8087bd056d 100644 --- a/sql/table.h +++ b/sql/table.h @@ -35,6 +35,7 @@ #include "sql_i_s.h" #include "sql_type.h" /* vers_kind_t */ #include "privilege.h" /* privilege_t */ +#include "structs.h" /* Structs that defines the TABLE */ @@ -76,6 +77,7 @@ typedef ulonglong nested_join_map; #define tmp_file_prefix "#sql" /**< Prefix for tmp tables */ #define tmp_file_prefix_length 4 +#define backup_file_prefix tmp_file_prefix "-backup-" #define TMP_TABLE_KEY_EXTRA 8 /** @@ -336,6 +338,7 @@ typedef struct st_grant_info enum tmp_table_type { + TMP_TABLE_ATOMIC_REPLACE= -1, NO_TMP_TABLE= 0, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE, INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE }; @@ -706,14 +709,6 @@ public: }; -struct Table_name -{ - LEX_CSTRING db; - LEX_CSTRING table_name; - LEX_CSTRING alias; -}; - - /** This structure is shared between different table objects. There is one instance of table share per one table in the database. @@ -1834,6 +1829,7 @@ public: /* Used in DELETE, DUP REPLACE and insert history row */ void vers_update_end(); void find_constraint_correlated_indexes(); + bool referenced_by_foreign_table(THD *thd, FOREIGN_KEY_INFO **fk_info) const; /** Number of additional fields used in versioned tables */ #define VERSIONING_FIELDS 2 diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 8c2d720f62e..98490ded18f 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -3297,66 +3297,18 @@ foreign constraint parser to get the referenced table. heap memory passed in */ char* dict_get_referenced_table( - const char* name, /*!< in: foreign key table name */ - const char* database_name, /*!< in: table db name */ - ulint database_name_len, /*!< in: db name length */ - const char* table_name, /*!< in: table name */ - ulint table_name_len, /*!< in: table name length */ - dict_table_t** table, /*!< out: table object or NULL */ - mem_heap_t* heap, /*!< in/out: heap memory */ - CHARSET_INFO* from_cs) /*!< in: table name charset */ + LEX_CSTRING database_name, /*!< in: table db name */ + LEX_CSTRING table_name, /*!< in: table name */ + dict_table_t** table, /*!< out: table object or NULL */ + mem_heap_t* heap) /*!< in/out: heap memory */ { - char* ref; - char db_name[MAX_DATABASE_NAME_LEN]; - char tbl_name[MAX_TABLE_NAME_LEN]; - CHARSET_INFO* to_cs = &my_charset_filename; - uint errors; - ut_ad(database_name || name); - ut_ad(table_name); - - if (!strncmp(table_name, srv_mysql50_table_name_prefix, - sizeof(srv_mysql50_table_name_prefix) - 1)) { - /* This is a pre-5.1 table name - containing chars other than [A-Za-z0-9]. - Discard the prefix and use raw UTF-8 encoding. */ - table_name += sizeof(srv_mysql50_table_name_prefix) - 1; - table_name_len -= sizeof(srv_mysql50_table_name_prefix) - 1; - - to_cs = system_charset_info; - } - - table_name_len = strconvert(from_cs, table_name, table_name_len, to_cs, - tbl_name, MAX_TABLE_NAME_LEN, &errors); - table_name = tbl_name; - - if (database_name) { - to_cs = &my_charset_filename; - if (!strncmp(database_name, srv_mysql50_table_name_prefix, - sizeof(srv_mysql50_table_name_prefix) - 1)) { - database_name - += sizeof(srv_mysql50_table_name_prefix) - 1; - database_name_len - -= sizeof(srv_mysql50_table_name_prefix) - 1; - to_cs = system_charset_info; - } - - database_name_len = strconvert( - from_cs, database_name, database_name_len, to_cs, - db_name, MAX_DATABASE_NAME_LEN, &errors); - database_name = db_name; - } else { - /* Use the database name of the foreign key table */ - - database_name = name; - database_name_len = dict_get_db_name_len(name); - } - /* Copy database_name, '/', table_name, '\0' */ - const size_t len = database_name_len + table_name_len + 1; - ref = static_cast<char*>(mem_heap_alloc(heap, len + 1)); - memcpy(ref, database_name, database_name_len); - ref[database_name_len] = '/'; - memcpy(ref + database_name_len + 1, table_name, table_name_len + 1); + const size_t len = database_name.length + table_name.length + 1; + char* ref = static_cast<char*>(mem_heap_alloc(heap, len + 1)); + memcpy(ref, database_name.str, database_name.length); + ref[database_name.length] = '/'; + memcpy(ref + database_name.length + 1, table_name.str, + table_name.length + 1); /* Values; 0 = Store and compare as given; case sensitive 1 = Store and compare in lower; case insensitive @@ -3364,10 +3316,10 @@ dict_get_referenced_table( if (lower_case_table_names == 2) { innobase_casedn_str(ref); *table = dict_sys.load_table({ref, len}); - memcpy(ref, database_name, database_name_len); - ref[database_name_len] = '/'; - memcpy(ref + database_name_len + 1, table_name, table_name_len + 1); - + memcpy(ref, database_name.str, database_name.length); + ref[database_name.length] = '/'; + memcpy(ref + database_name.length + 1, + table_name.str, table_name.length + 1); } else { #ifndef _WIN32 if (lower_case_table_names == 1) { diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 3cb48765791..2aa92371c2d 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -1359,7 +1359,7 @@ static dberr_t fts_drop_table(trx_t *trx, const char *table_name, bool rename) char *tmp= dict_mem_create_temporary_tablename(heap, table->name.m_name, table->id); dberr_t err= row_rename_table_for_mysql(table->name.m_name, tmp, trx, - false); + RENAME_IGNORE_FK); mem_heap_free(heap); if (err != DB_SUCCESS) { @@ -1410,7 +1410,7 @@ fts_rename_one_aux_table( fts_table_new_name[table_new_name_len] = 0; return row_rename_table_for_mysql( - fts_table_old_name, fts_table_new_name, trx, false); + fts_table_old_name, fts_table_new_name, trx, RENAME_IGNORE_FK); } /****************************************************************//** diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ee63d4950d8..3d798ca2e00 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -12202,6 +12202,8 @@ create_table_info_t::create_foreign_keys() const char* ref_column_names[MAX_COLS_PER_FK]; char create_name[MAX_DATABASE_NAME_LEN + 1 + MAX_TABLE_NAME_LEN + 1]; + char db_name[MAX_DATABASE_NAME_LEN + 1]; + char t_name[MAX_TABLE_NAME_LEN + 1]; dict_index_t* index = NULL; fkerr_t index_error = FK_SUCCESS; dict_index_t* err_index = NULL; @@ -12209,18 +12211,50 @@ create_table_info_t::create_foreign_keys() const bool tmp_table = m_flags2 & DICT_TF2_TEMPORARY; const CHARSET_INFO* cs = thd_charset(m_thd); const char* operation = "Create "; - const char* name = m_table_name; + const char* basename; enum_sql_command sqlcom = enum_sql_command(thd_sql_command(m_thd)); + LEX_CSTRING name= {m_table_name, strlen(m_table_name)}; if (sqlcom == SQLCOM_ALTER_TABLE) { - dict_table_t* table_to_alter; - mem_heap_t* heap = mem_heap_create(10000); - ulint highest_id_so_far; - char* n = dict_get_referenced_table( - name, LEX_STRING_WITH_LEN(m_form->s->db), - LEX_STRING_WITH_LEN(m_form->s->table_name), - &table_to_alter, heap, cs); + dict_table_t* alter_table; + mem_heap_t* heap = mem_heap_create(10000); + DBUG_ASSERT(!m_create_info->is_atomic_replace()); + LEX_CSTRING table_name = m_form->s->table_name; + CHARSET_INFO* to_cs = &my_charset_filename; + + if (!strncmp(table_name.str, srv_mysql50_table_name_prefix, + sizeof srv_mysql50_table_name_prefix - 1)) { + table_name.str + += sizeof srv_mysql50_table_name_prefix - 1; + table_name.length + -= sizeof srv_mysql50_table_name_prefix - 1; + to_cs = system_charset_info; + } + + uint errors; + LEX_CSTRING t; + t.str = t_name; + t.length = strconvert(cs, LEX_STRING_WITH_LEN(table_name), + to_cs, t_name, MAX_TABLE_NAME_LEN, + &errors); + LEX_CSTRING d = m_form->s->db; + + if (!strncmp(d.str, srv_mysql50_table_name_prefix, + sizeof srv_mysql50_table_name_prefix - 1)) { + d.str += sizeof srv_mysql50_table_name_prefix - 1; + d.length -= sizeof srv_mysql50_table_name_prefix - 1; + to_cs = system_charset_info; + } else { + to_cs = &my_charset_filename; + } + + d.length = strconvert(cs, LEX_STRING_WITH_LEN(d), to_cs, + db_name, MAX_DATABASE_NAME_LEN, + &errors); + d.str = db_name; + + char* n = dict_get_referenced_table(d, t, &alter_table, heap); /* Starting from 4.0.18 and 4.1.2, we generate foreign key id's in the format databasename/tablename_ibfk_[number], where @@ -12230,38 +12264,33 @@ create_table_info_t::create_foreign_keys() /* If we are altering a temporary table, the table name after ALTER TABLE does not correspond to the internal table name, and - table_to_alter is NULL. TODO: should we fix this somehow? */ + alter_table=nullptr. But, we do not support FOREIGN KEY + constraints for temporary tables. */ - if (table_to_alter) { - n = table_to_alter->name.m_name; - highest_id_so_far = dict_table_get_highest_foreign_id( - table_to_alter); - } else { - highest_id_so_far = 0; + if (alter_table) { + n = alter_table->name.m_name; + number = 1 + dict_table_get_highest_foreign_id( + alter_table); } - char* bufend = innobase_convert_name( - create_name, sizeof create_name, n, strlen(n), m_thd); - create_name[bufend - create_name] = '\0'; - number = highest_id_so_far + 1; + *innobase_convert_name(create_name, sizeof create_name, + n, strlen(n), m_thd) = '\0'; mem_heap_free(heap); operation = "Alter "; - } else if (strstr(name, "#P#") || strstr(name, "#p#")) { + } else if (strstr(m_table_name, "#P#") + || strstr(m_table_name, "#p#")) { /* Partitioned table */ create_name[0] = '\0'; } else { - char* bufend = innobase_convert_name(create_name, - sizeof create_name, - name, - strlen(name), m_thd); - create_name[bufend - create_name] = '\0'; + *innobase_convert_name(create_name, sizeof create_name, + LEX_STRING_WITH_LEN(name), m_thd)= '\0'; } Alter_info* alter_info = m_create_info->alter_info; ut_ad(alter_info); List_iterator_fast<Key> key_it(alter_info->key_list); - dict_table_t* table = dict_sys.find_table({name,strlen(name)}); + dict_table_t* table = dict_sys.find_table({name.str, name.length}); if (!table) { ib_foreign_warn(m_trx, DB_CANNOT_ADD_CONSTRAINT, create_name, "%s table %s foreign key constraint" @@ -12271,6 +12300,8 @@ create_table_info_t::create_foreign_keys() return (DB_CANNOT_ADD_CONSTRAINT); } + basename = table->name.basename(); + while (Key* key = key_it++) { if (key->type != Key::FOREIGN_KEY) continue; @@ -12308,27 +12339,27 @@ create_table_info_t::create_foreign_keys() col->field_name.length); success = find_col(table, column_names + i); if (!success) { - key_text k(fk); ib_foreign_warn( m_trx, DB_CANNOT_ADD_CONSTRAINT, create_name, "%s table %s foreign key %s constraint" " failed. Column %s was not found.", - operation, create_name, k.str(), + operation, create_name, + key_text(fk).str(), column_names[i]); dict_foreign_free(foreign); return (DB_CANNOT_ADD_CONSTRAINT); } ++i; if (i >= MAX_COLS_PER_FK) { - key_text k(fk); ib_foreign_warn( m_trx, DB_CANNOT_ADD_CONSTRAINT, create_name, "%s table %s foreign key %s constraint" " failed. Too many columns: %u (%u " "allowed).", - operation, create_name, k.str(), i, + operation, create_name, + key_text(fk).str(), i, MAX_COLS_PER_FK); dict_foreign_free(foreign); return (DB_CANNOT_ADD_CONSTRAINT); @@ -12340,9 +12371,9 @@ create_table_info_t::create_foreign_keys() &index_error, &err_col, &err_index); if (!index) { - key_text k(fk); foreign_push_index_error(m_trx, operation, create_name, - k.str(), column_names, + key_text(fk).str(), + column_names, index_error, err_col, err_index, table); dict_foreign_free(foreign); @@ -12408,32 +12439,79 @@ create_table_info_t::create_foreign_keys() memcpy(foreign->foreign_col_names, column_names, i * sizeof(void*)); - foreign->referenced_table_name = dict_get_referenced_table( - name, LEX_STRING_WITH_LEN(fk->ref_db), - LEX_STRING_WITH_LEN(fk->ref_table), - &foreign->referenced_table, foreign->heap, cs); + LEX_CSTRING table_name = fk->ref_table; + CHARSET_INFO* to_cs = &my_charset_filename; + uint errors; + LEX_CSTRING t = table_name; + LEX_CSTRING d = fk->ref_db; + + if (!d.str) { + d.str = table->name.m_name; + d.length = size_t(basename - table->name.m_name - 1); + } + + if (m_create_info->is_atomic_replace() + && basename == &table->name.m_name[d.length + 1] + && !memcmp(d.str, table->name.m_name, d.length) + && !strcmp(basename, table_name.str)) { + /* Do not convert names when encountering + self-referential constraints during + CREATE OR REPLACE TABLE. */ + goto name_converted; + } + + if (!strncmp(table_name.str, srv_mysql50_table_name_prefix, + sizeof srv_mysql50_table_name_prefix - 1)) { + table_name.str + += sizeof srv_mysql50_table_name_prefix - 1; + table_name.length + -= sizeof srv_mysql50_table_name_prefix - 1; + to_cs = system_charset_info; + } + + t.str = t_name; + t.length = strconvert(cs, LEX_STRING_WITH_LEN(table_name), + to_cs, t_name, + MAX_TABLE_NAME_LEN, &errors); + + if (!strncmp(d.str, srv_mysql50_table_name_prefix, + sizeof srv_mysql50_table_name_prefix - 1)) { + d.str += sizeof srv_mysql50_table_name_prefix - 1; + d.length -= sizeof srv_mysql50_table_name_prefix - 1; + to_cs = system_charset_info; + } else if (d.str == table->name.m_name) { + goto name_converted; + } else { + to_cs = &my_charset_filename; + } - if (!foreign->referenced_table_name) { - return (DB_OUT_OF_MEMORY); + if (d.str != table->name.m_name) { + d.length = strconvert(cs, LEX_STRING_WITH_LEN(d), + to_cs, db_name, + MAX_DATABASE_NAME_LEN, + &errors); + d.str = db_name; } +name_converted: + foreign->referenced_table_name = dict_get_referenced_table( + d, t, &foreign->referenced_table, foreign->heap); if (!foreign->referenced_table && m_trx->check_foreigns) { char buf[MAX_TABLE_NAME_LEN + 1] = ""; - char* bufend; - bufend = innobase_convert_name( + *innobase_convert_name( buf, MAX_TABLE_NAME_LEN, foreign->referenced_table_name, - strlen(foreign->referenced_table_name), m_thd); - buf[bufend - buf] = '\0'; - key_text k(fk); + strlen(foreign->referenced_table_name), m_thd) + = '\0'; ib_foreign_warn(m_trx, DB_CANNOT_ADD_CONSTRAINT, create_name, "%s table %s with foreign key %s " "constraint failed. Referenced table " "%s not found in the data dictionary.", - operation, create_name, k.str(), buf); - return (DB_CANNOT_ADD_CONSTRAINT); + operation, create_name, + key_text(fk).str(), buf); + return DB_CANNOT_ADD_CONSTRAINT; } /* Don't allow foreign keys on partitioned tables yet. */ @@ -12456,7 +12534,6 @@ create_table_info_t::create_foreign_keys() success = find_col(foreign->referenced_table, ref_column_names + j); if (!success) { - key_text k(fk); ib_foreign_warn( m_trx, DB_CANNOT_ADD_CONSTRAINT, @@ -12465,9 +12542,9 @@ create_table_info_t::create_foreign_keys() "constraint failed. " "Column %s was not found.", operation, create_name, - k.str(), ref_column_names[j]); - - return (DB_CANNOT_ADD_CONSTRAINT); + key_text(fk).str(), + ref_column_names[j]); + return DB_CANNOT_ADD_CONSTRAINT; } } ++j; @@ -12487,16 +12564,15 @@ create_table_info_t::create_foreign_keys() &err_index); if (!index) { - key_text k(fk); foreign_push_index_error( - m_trx, operation, create_name, k.str(), + m_trx, operation, create_name, + key_text(fk).str(), column_names, index_error, err_col, err_index, foreign->referenced_table); - - return (DB_CANNOT_ADD_CONSTRAINT); + return DB_CANNOT_ADD_CONSTRAINT; } } else { - ut_a(m_trx->check_foreigns == FALSE); + ut_a(!m_trx->check_foreigns); index = NULL; } @@ -12533,7 +12609,6 @@ create_table_info_t::create_foreign_keys() NULL if the column is not allowed to be NULL! */ - key_text k(fk); ib_foreign_warn( m_trx, DB_CANNOT_ADD_CONSTRAINT, @@ -12544,9 +12619,9 @@ create_table_info_t::create_foreign_keys() "but column '%s' is defined as " "NOT NULL.", operation, create_name, - k.str(), col_name); + key_text(fk).str(), col_name); - return (DB_CANNOT_ADD_CONSTRAINT); + return DB_CANNOT_ADD_CONSTRAINT; } } } @@ -13687,10 +13762,10 @@ err_exit: @param[in,out] trx InnoDB data dictionary transaction @param[in] from old table name @param[in] to new table name -@param[in] use_fk whether to enforce FOREIGN KEY +@param[in] fk how to handle FOREIGN KEY @return DB_SUCCESS or error code */ static dberr_t innobase_rename_table(trx_t *trx, const char *from, - const char *to, bool use_fk) + const char *to, rename_fk fk) { dberr_t error; char norm_to[FN_REFLEN]; @@ -13708,7 +13783,7 @@ static dberr_t innobase_rename_table(trx_t *trx, const char *from, ut_ad(trx->will_lock); - error = row_rename_table_for_mysql(norm_from, norm_to, trx, use_fk); + error = row_rename_table_for_mysql(norm_from, norm_to, trx, fk); if (error != DB_SUCCESS) { if (error == DB_TABLE_NOT_FOUND @@ -13733,7 +13808,8 @@ static dberr_t innobase_rename_table(trx_t *trx, const char *from, #endif /* _WIN32 */ trx_start_if_not_started(trx, true); error = row_rename_table_for_mysql( - par_case_name, norm_to, trx, false); + par_case_name, norm_to, trx, + RENAME_IGNORE_FK); } } @@ -13914,7 +13990,7 @@ int ha_innobase::truncate() if (error == DB_SUCCESS) { error = innobase_rename_table(trx, ib_table->name.m_name, - temp_name, false); + temp_name, RENAME_REBUILD); if (error == DB_SUCCESS) { error = trx->drop_table(*ib_table); @@ -14107,7 +14183,11 @@ ha_innobase::rename_table( row_mysql_lock_data_dictionary(trx); if (error == DB_SUCCESS) { - error = innobase_rename_table(trx, from, to, true); + error = innobase_rename_table(trx, from, to, + thd_sql_command(thd) + == SQLCOM_ALTER_TABLE + ? RENAME_ALTER_COPY + : RENAME_FK); } DEBUG_SYNC(thd, "after_innobase_rename_table"); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 0babd37251e..1d23a52fa1c 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -30,6 +30,7 @@ Smart ALTER TABLE #include <sql_class.h> #include <sql_table.h> #include <mysql/plugin.h> +#include <strfunc.h> /* Include necessary InnoDB headers */ #include "btr0sea.h" @@ -3186,6 +3187,8 @@ innobase_get_foreign_key_info( ulint num_fk = 0; Alter_info* alter_info = ha_alter_info->alter_info; const CHARSET_INFO* cs = thd_charset(trx->mysql_thd); + char db_name[MAX_DATABASE_NAME_LEN + 1]; + char t_name[MAX_TABLE_NAME_LEN + 1]; DBUG_ENTER("innobase_get_foreign_key_info"); @@ -3250,14 +3253,51 @@ innobase_get_foreign_key_info( add_fk[num_fk] = dict_mem_foreign_create(); + LEX_CSTRING table_name = fk_key->ref_table; + CHARSET_INFO* to_cs = &my_charset_filename; + + if (!strncmp(table_name.str, srv_mysql50_table_name_prefix, + sizeof srv_mysql50_table_name_prefix - 1)) { + table_name.str + += sizeof srv_mysql50_table_name_prefix - 1; + table_name.length + -= sizeof srv_mysql50_table_name_prefix - 1; + to_cs = system_charset_info; + } + + uint errors; + LEX_CSTRING t; + t.str = t_name; + t.length = strconvert(cs, LEX_STRING_WITH_LEN(table_name), + to_cs, t_name, MAX_TABLE_NAME_LEN, + &errors); + LEX_CSTRING d = fk_key->ref_db; + if (!d.str) { + d.str = table->name.m_name; + d.length = table->name.dblen(); + } + + if (!strncmp(d.str, srv_mysql50_table_name_prefix, + sizeof srv_mysql50_table_name_prefix - 1)) { + d.str += sizeof srv_mysql50_table_name_prefix - 1; + d.length -= sizeof srv_mysql50_table_name_prefix - 1; + to_cs = system_charset_info; + } else if (d.str == table->name.m_name) { + goto name_converted; + } else { + to_cs = &my_charset_filename; + } + + d.length = strconvert(cs, LEX_STRING_WITH_LEN(d), to_cs, + db_name, MAX_DATABASE_NAME_LEN, + &errors); + d.str = db_name; + +name_converted: dict_sys.lock(SRW_LOCK_CALL); referenced_table_name = dict_get_referenced_table( - table->name.m_name, - LEX_STRING_WITH_LEN(fk_key->ref_db), - LEX_STRING_WITH_LEN(fk_key->ref_table), - &referenced_table, - add_fk[num_fk]->heap, cs); + d, t, &referenced_table, add_fk[num_fk]->heap); /* Test the case when referenced_table failed to open, if trx->check_foreigns is not set, we should @@ -10168,10 +10208,12 @@ commit_try_rebuild( char* old_name= mem_heap_strdup(ctx->heap, user_table->name.m_name); dberr_t error = row_rename_table_for_mysql(user_table->name.m_name, - ctx->tmp_name, trx, false); + ctx->tmp_name, trx, + RENAME_REBUILD); if (error == DB_SUCCESS) { error = row_rename_table_for_mysql( - rebuilt_table->name.m_name, old_name, trx, false); + rebuilt_table->name.m_name, old_name, trx, + RENAME_REBUILD); if (error == DB_SUCCESS) { /* The statistics for the surviving indexes will be re-inserted in alter_stats_rebuild(). */ diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index d867d2f297a..fef0e4f9857 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -61,15 +61,11 @@ foreign constraint parser to get the referenced table. heap memory passed in */ char* dict_get_referenced_table( -/*======================*/ - const char* name, /*!< in: foreign key table name */ - const char* database_name, /*!< in: table db name */ - ulint database_name_len,/*!< in: db name length */ - const char* table_name, /*!< in: table name */ - ulint table_name_len, /*!< in: table name length */ + LEX_CSTRING database_name, /*!< in: table db name */ + LEX_CSTRING table_name, /*!< in: table name */ dict_table_t** table, /*!< out: table object or NULL */ - mem_heap_t* heap, /*!< in: heap memory */ - CHARSET_INFO* from_cs); /*!< in: table name charset */ + mem_heap_t* heap) /*!< in/out: heap memory */ + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Frees a foreign key struct. */ void diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index c4a94a9b5ef..e74bdb09db9 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, 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 @@ -369,6 +369,17 @@ row_import_tablespace_for_mysql( row_prebuilt_t* prebuilt) /*!< in: prebuilt struct in MySQL */ MY_ATTRIBUTE((nonnull, warn_unused_result)); +enum rename_fk { + /** ignore FOREIGN KEY constraints */ + RENAME_IGNORE_FK= 0, + /** parse and enforce FOREIGN KEY constaints */ + RENAME_FK, + /** Rename a table as part of a native table-rebuilding DDL operation */ + RENAME_REBUILD, + /** Rename as part of ALTER TABLE...ALGORITHM=COPY */ + RENAME_ALTER_COPY +}; + /*********************************************************************//** Renames a table for MySQL. @return error code or DB_SUCCESS */ @@ -378,7 +389,7 @@ row_rename_table_for_mysql( const char* old_name, /*!< in: old table name */ const char* new_name, /*!< in: new table name */ trx_t* trx, /*!< in/out: transaction */ - bool use_fk) /*!< in: whether to parse and enforce + rename_fk fk) /*!< in: how to handle FOREIGN KEY constraints */ MY_ATTRIBUTE((nonnull, warn_unused_result)); diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 483e10b6283..b20d0cddf5b 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -2549,7 +2549,7 @@ row_rename_table_for_mysql( const char* old_name, /*!< in: old table name */ const char* new_name, /*!< in: new table name */ trx_t* trx, /*!< in/out: transaction */ - bool use_fk) /*!< in: whether to parse and enforce + rename_fk fk) /*!< in: how to handle FOREIGN KEY constraints */ { dict_table_t* table = NULL; @@ -2634,9 +2634,9 @@ row_rename_table_for_mysql( goto funct_exit; - } else if (use_fk && !old_is_tmp && new_is_tmp) { - /* MySQL is doing an ALTER TABLE command and it renames the - original table to a temporary table name. We want to preserve + } else if (fk == RENAME_ALTER_COPY && !old_is_tmp && new_is_tmp) { + /* Non-native ALTER TABLE is renaming the + original table to a temporary name. We want to preserve the original foreign key constraint definitions despite the name change. An exception is those constraints for which the ALTER TABLE contained DROP FOREIGN KEY <foreign key id>.*/ @@ -2680,7 +2680,7 @@ row_rename_table_for_mysql( goto rollback_and_exit; } - if (!new_is_tmp) { + if (fk == RENAME_IGNORE_FK || fk == RENAME_FK || !new_is_tmp) { /* Rename all constraints. */ char new_table_name[MAX_TABLE_NAME_LEN + 1]; char old_table_utf8[MAX_TABLE_NAME_LEN + 1]; @@ -2854,7 +2854,7 @@ row_rename_table_for_mysql( err = dict_load_foreigns( new_name, nullptr, trx->id, !old_is_tmp || trx->check_foreigns, - use_fk + fk == RENAME_FK || fk == RENAME_ALTER_COPY ? DICT_ERR_IGNORE_NONE : DICT_ERR_IGNORE_FK_NOKEY, fk_tables); diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc index c00f42d74c1..f432c158204 100644 --- a/storage/maria/ha_s3.cc +++ b/storage/maria/ha_s3.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2019, 2021 MariaDB Corporation Ab +/* Copyright (C) 2019, 2022, 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 @@ -1031,7 +1031,8 @@ static int ha_s3_init(void *p) s3_hton->show_status= 0; s3_hton->prepare_for_backup= 0; s3_hton->end_backup= 0; - s3_hton->flags= ((s3_slave_ignore_updates ? HTON_IGNORE_UPDATES : 0) | + s3_hton->flags= HTON_EXPENSIVE_RENAME | + ((s3_slave_ignore_updates ? HTON_IGNORE_UPDATES : 0) | (s3_replicate_alter_as_create_select ? HTON_TABLE_MAY_NOT_EXIST_ON_SLAVE : 0)); /* Copy global arguments to s3_access_key and s3_secret_key */ diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index f66b6ae6186..71b2561360a 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -2881,7 +2881,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info, if (param->testflag & T_SAFE_REPAIR) { - /* Don't repair if we loosed more than one row */ + /* Don't repair if we lost more than one row */ if (sort_info.new_info->s->state.state.records+1 < start_records) { share->state.state.records= start_records; |