Commit 6aa9a552 authored by Monty's avatar Monty Committed by Sergei Golubchik

MDEV-24576 Atomic CREATE TABLE

There are a few different cases to consider

Logging of CREATE TABLE and CREATE TABLE ... LIKE
- If REPLACE is used and there was an existing table, DDL log the drop of
  the table.
- If discovery of table is to be done
    - DDL LOG create table
  else
    - DDL log create table (with engine type)
    - create the table
- If table was created
  - Log entry to binary log with xid
  - Mark DDL log completed

Crash recovery:
- If query was in binary log do nothing and exit
- If discoverted table
   - Delete the .frm file
-else
   - Drop created table and frm file
- If table was dropped, write a DROP TABLE statement in binary log

CREATE TABLE ... SELECT required a little more work as when one is using
statement logging the query is written to the binary log before commit is
done.
This was fixed by adding a DROP TABLE to the binary log during crash
recovery if the ddl log entry was not closed. In this case the binary log
will contain:
CREATE TABLE xxx ... SELECT ....
DROP TABLE xxx;

Other things:
- Added debug_crash_here() functionality to Aria to be able to test
  crash in create table between the creation of the .MAI and the .MAD files.
parent 7a588c30
...@@ -77,7 +77,6 @@ drop table t1; ...@@ -77,7 +77,6 @@ drop table t1;
ERROR 42S02: Unknown table 'test.t1' ERROR 42S02: Unknown table 'test.t1'
show warnings; show warnings;
Level Code Message Level Code Message
Error 29 File './test/t1.MAD' not found (Errcode: 2 "No such file or directory")
Error 1051 Unknown table 'test.t1' Error 1051 Unknown table 'test.t1'
db.opt db.opt
create table t2(a int) engine=aria; create table t2(a int) engine=aria;
......
...@@ -29,7 +29,7 @@ ROLLBACK/*!*/; ...@@ -29,7 +29,7 @@ ROLLBACK/*!*/;
/*!100001 SET @@session.server_id=1*//*!*/; /*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/; /*!100001 SET @@session.gtid_seq_no=1*//*!*/;
# at 371 # at 371
#<date> server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 542 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
use `test`/*!*/; use `test`/*!*/;
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
SET @@session.pseudo_thread_id=5/*!*/; SET @@session.pseudo_thread_id=5/*!*/;
...@@ -42,26 +42,26 @@ SET @@session.lc_time_names=0/*!*/; ...@@ -42,26 +42,26 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/; SET @@session.collation_database=DEFAULT/*!*/;
CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1))
/*!*/; /*!*/;
# at 533 # at 542
#<date> server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl #<date> server id 1 end_log_pos 584 CRC32 XXX GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/; /*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at 575 # at 584
#<date> server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 745 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)) CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
/*!*/; /*!*/;
# at 727 # at 745
#<date> server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3 #<date> server id 1 end_log_pos 787 CRC32 XXX GTID 0-1-3
/*!100001 SET @@session.gtid_seq_no=3*//*!*/; /*!100001 SET @@session.gtid_seq_no=3*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 769 # at 787
# at 843 # at 861
#<date> server id 1 end_log_pos 843 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 861 CRC32 XXX Annotate_rows:
#Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "")
#<date> server id 1 end_log_pos 899 CRC32 XXX Table_map: `test`.`t1` mapped to number num #<date> server id 1 end_log_pos 917 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 899 # at 917
#<date> server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F #<date> server id 1 end_log_pos 985 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1` ### INSERT INTO `test`.`t1`
### SET ### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @1=10 /* INT meta=0 nullable=0 is_null=0 */
...@@ -74,23 +74,23 @@ START TRANSACTION ...@@ -74,23 +74,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ ### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# Number of rows: 1 # Number of rows: 1
# at 967 # at 985
#<date> server id 1 end_log_pos 1040 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1058 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 1040 # at 1058
#<date> server id 1 end_log_pos 1082 CRC32 XXX GTID 0-1-4 #<date> server id 1 end_log_pos 1100 CRC32 XXX GTID 0-1-4
/*!100001 SET @@session.gtid_seq_no=4*//*!*/; /*!100001 SET @@session.gtid_seq_no=4*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 1082 # at 1100
# at 1158 # at 1176
#<date> server id 1 end_log_pos 1158 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 1176 CRC32 XXX Annotate_rows:
#Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) #Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL)
#<date> server id 1 end_log_pos 1214 CRC32 XXX Table_map: `test`.`t1` mapped to number num #<date> server id 1 end_log_pos 1232 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1214 # at 1232
#<date> server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F #<date> server id 1 end_log_pos 1299 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1` ### INSERT INTO `test`.`t1`
### SET ### SET
### @1=11 /* INT meta=0 nullable=0 is_null=0 */ ### @1=11 /* INT meta=0 nullable=0 is_null=0 */
...@@ -103,23 +103,23 @@ START TRANSACTION ...@@ -103,23 +103,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ ### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
# Number of rows: 1 # Number of rows: 1
# at 1281 # at 1299
#<date> server id 1 end_log_pos 1354 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1372 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 1354 # at 1372
#<date> server id 1 end_log_pos 1396 CRC32 XXX GTID 0-1-5 #<date> server id 1 end_log_pos 1414 CRC32 XXX GTID 0-1-5
/*!100001 SET @@session.gtid_seq_no=5*//*!*/; /*!100001 SET @@session.gtid_seq_no=5*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 1396 # at 1414
# at 1474 # at 1492
#<date> server id 1 end_log_pos 1474 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 1492 CRC32 XXX Annotate_rows:
#Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") #Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A")
#<date> server id 1 end_log_pos 1530 CRC32 XXX Table_map: `test`.`t1` mapped to number num #<date> server id 1 end_log_pos 1548 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1530 # at 1548
#<date> server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F #<date> server id 1 end_log_pos 1614 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1` ### INSERT INTO `test`.`t1`
### SET ### SET
### @1=12 /* INT meta=0 nullable=0 is_null=0 */ ### @1=12 /* INT meta=0 nullable=0 is_null=0 */
...@@ -132,23 +132,23 @@ START TRANSACTION ...@@ -132,23 +132,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# Number of rows: 1 # Number of rows: 1
# at 1596 # at 1614
#<date> server id 1 end_log_pos 1669 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1687 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 1669 # at 1687
#<date> server id 1 end_log_pos 1711 CRC32 XXX GTID 0-1-6 #<date> server id 1 end_log_pos 1729 CRC32 XXX GTID 0-1-6
/*!100001 SET @@session.gtid_seq_no=6*//*!*/; /*!100001 SET @@session.gtid_seq_no=6*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 1711 # at 1729
# at 1786 # at 1804
#<date> server id 1 end_log_pos 1786 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 1804 CRC32 XXX Annotate_rows:
#Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") #Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A")
#<date> server id 1 end_log_pos 1842 CRC32 XXX Table_map: `test`.`t1` mapped to number num #<date> server id 1 end_log_pos 1860 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1842 # at 1860
#<date> server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F #<date> server id 1 end_log_pos 1927 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1` ### INSERT INTO `test`.`t1`
### SET ### SET
### @1=13 /* INT meta=0 nullable=0 is_null=0 */ ### @1=13 /* INT meta=0 nullable=0 is_null=0 */
...@@ -161,23 +161,23 @@ START TRANSACTION ...@@ -161,23 +161,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# Number of rows: 1 # Number of rows: 1
# at 1909 # at 1927
#<date> server id 1 end_log_pos 1982 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2000 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 1982 # at 2000
#<date> server id 1 end_log_pos 2024 CRC32 XXX GTID 0-1-7 #<date> server id 1 end_log_pos 2042 CRC32 XXX GTID 0-1-7
/*!100001 SET @@session.gtid_seq_no=7*//*!*/; /*!100001 SET @@session.gtid_seq_no=7*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 2024 # at 2042
# at 2078 # at 2096
#<date> server id 1 end_log_pos 2078 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 2096 CRC32 XXX Annotate_rows:
#Q> INSERT INTO t2 SELECT * FROM t1 #Q> INSERT INTO t2 SELECT * FROM t1
#<date> server id 1 end_log_pos 2134 CRC32 XXX Table_map: `test`.`t2` mapped to number num #<date> server id 1 end_log_pos 2152 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 2134 # at 2152
#<date> server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 33 flags: STMT_END_F #<date> server id 1 end_log_pos 2243 CRC32 XXX Write_compressed_rows: table id 33 flags: STMT_END_F
### INSERT INTO `test`.`t2` ### INSERT INTO `test`.`t2`
### SET ### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @1=10 /* INT meta=0 nullable=0 is_null=0 */
...@@ -223,23 +223,23 @@ START TRANSACTION ...@@ -223,23 +223,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# Number of rows: 4 # Number of rows: 4
# at 2225 # at 2243
#<date> server id 1 end_log_pos 2298 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2316 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 2298 # at 2316
#<date> server id 1 end_log_pos 2340 CRC32 XXX GTID 0-1-8 #<date> server id 1 end_log_pos 2358 CRC32 XXX GTID 0-1-8
/*!100001 SET @@session.gtid_seq_no=8*//*!*/; /*!100001 SET @@session.gtid_seq_no=8*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 2340 # at 2358
# at 2406 # at 2424
#<date> server id 1 end_log_pos 2406 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 2424 CRC32 XXX Annotate_rows:
#Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL
#<date> server id 1 end_log_pos 2462 CRC32 XXX Table_map: `test`.`t2` mapped to number num #<date> server id 1 end_log_pos 2480 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 2462 # at 2480
#<date> server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 33 flags: STMT_END_F #<date> server id 1 end_log_pos 2579 CRC32 XXX Update_compressed_rows: table id 33 flags: STMT_END_F
### UPDATE `test`.`t2` ### UPDATE `test`.`t2`
### WHERE ### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @1=10 /* INT meta=0 nullable=0 is_null=0 */
...@@ -304,23 +304,23 @@ START TRANSACTION ...@@ -304,23 +304,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# Number of rows: 3 # Number of rows: 3
# at 2561 # at 2579
#<date> server id 1 end_log_pos 2634 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2652 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 2634 # at 2652
#<date> server id 1 end_log_pos 2676 CRC32 XXX GTID 0-1-9 #<date> server id 1 end_log_pos 2694 CRC32 XXX GTID 0-1-9
/*!100001 SET @@session.gtid_seq_no=9*//*!*/; /*!100001 SET @@session.gtid_seq_no=9*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 2676 # at 2694
# at 2713 # at 2731
#<date> server id 1 end_log_pos 2713 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 2731 CRC32 XXX Annotate_rows:
#Q> DELETE FROM t1 #Q> DELETE FROM t1
#<date> server id 1 end_log_pos 2769 CRC32 XXX Table_map: `test`.`t1` mapped to number num #<date> server id 1 end_log_pos 2787 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 2769 # at 2787
#<date> server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 32 flags: STMT_END_F #<date> server id 1 end_log_pos 2879 CRC32 XXX Delete_compressed_rows: table id 32 flags: STMT_END_F
### DELETE FROM `test`.`t1` ### DELETE FROM `test`.`t1`
### WHERE ### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @1=10 /* INT meta=0 nullable=0 is_null=0 */
...@@ -366,23 +366,23 @@ START TRANSACTION ...@@ -366,23 +366,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# Number of rows: 4 # Number of rows: 4
# at 2861 # at 2879
#<date> server id 1 end_log_pos 2934 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2952 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 2934 # at 2952
#<date> server id 1 end_log_pos 2976 CRC32 XXX GTID 0-1-10 #<date> server id 1 end_log_pos 2994 CRC32 XXX GTID 0-1-10
/*!100001 SET @@session.gtid_seq_no=10*//*!*/; /*!100001 SET @@session.gtid_seq_no=10*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 2976 # at 2994
# at 3013 # at 3031
#<date> server id 1 end_log_pos 3013 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 3031 CRC32 XXX Annotate_rows:
#Q> DELETE FROM t2 #Q> DELETE FROM t2
#<date> server id 1 end_log_pos 3069 CRC32 XXX Table_map: `test`.`t2` mapped to number num #<date> server id 1 end_log_pos 3087 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 3069 # at 3087
#<date> server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 33 flags: STMT_END_F #<date> server id 1 end_log_pos 3172 CRC32 XXX Delete_compressed_rows: table id 33 flags: STMT_END_F
### DELETE FROM `test`.`t2` ### DELETE FROM `test`.`t2`
### WHERE ### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @1=10 /* INT meta=0 nullable=0 is_null=0 */
...@@ -428,13 +428,13 @@ START TRANSACTION ...@@ -428,13 +428,13 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# Number of rows: 4 # Number of rows: 4
# at 3154 # at 3172
#<date> server id 1 end_log_pos 3227 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 3245 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 3227 # at 3245
#<date> server id 1 end_log_pos 3275 CRC32 XXX Rotate to master-bin.000002 pos: 4 #<date> server id 1 end_log_pos 3293 CRC32 XXX Rotate to master-bin.000002 pos: 4
DELIMITER ; DELIMITER ;
# End of log file # End of log file
ROLLBACK /* added by mysqlbinlog */; ROLLBACK /* added by mysqlbinlog */;
......
...@@ -27,7 +27,7 @@ ROLLBACK/*!*/; ...@@ -27,7 +27,7 @@ ROLLBACK/*!*/;
/*!100001 SET @@session.server_id=1*//*!*/; /*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/; /*!100001 SET @@session.gtid_seq_no=1*//*!*/;
# at 371 # at 371
#<date> server id 1 end_log_pos 555 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 564 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
use `test`/*!*/; use `test`/*!*/;
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
SET @@session.pseudo_thread_id=5/*!*/; SET @@session.pseudo_thread_id=5/*!*/;
...@@ -40,26 +40,26 @@ SET @@session.lc_time_names=0/*!*/; ...@@ -40,26 +40,26 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/; SET @@session.collation_database=DEFAULT/*!*/;
CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1))
/*!*/; /*!*/;
# at 555 # at 564
#<date> server id 1 end_log_pos 597 CRC32 XXX GTID 0-1-2 ddl #<date> server id 1 end_log_pos 606 CRC32 XXX GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/; /*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at 597 # at 606
#<date> server id 1 end_log_pos 774 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 792 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)) CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
/*!*/; /*!*/;
# at 774 # at 792
#<date> server id 1 end_log_pos 816 CRC32 XXX GTID 0-1-3 #<date> server id 1 end_log_pos 834 CRC32 XXX GTID 0-1-3
/*!100001 SET @@session.gtid_seq_no=3*//*!*/; /*!100001 SET @@session.gtid_seq_no=3*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 816 # at 834
# at 890 # at 908
#<date> server id 1 end_log_pos 890 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 908 CRC32 XXX Annotate_rows:
#Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "")
#<date> server id 1 end_log_pos 946 CRC32 XXX Table_map: `test`.`t1` mapped to number num #<date> server id 1 end_log_pos 964 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 946 # at 964
#<date> server id 1 end_log_pos 1015 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F #<date> server id 1 end_log_pos 1033 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1` ### INSERT INTO `test`.`t1`
### SET ### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @1=10 /* INT meta=0 nullable=0 is_null=0 */
...@@ -72,23 +72,23 @@ START TRANSACTION ...@@ -72,23 +72,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ ### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# Number of rows: 1 # Number of rows: 1
# at 1015 # at 1033
#<date> server id 1 end_log_pos 1088 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1106 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 1088 # at 1106
#<date> server id 1 end_log_pos 1130 CRC32 XXX GTID 0-1-4 #<date> server id 1 end_log_pos 1148 CRC32 XXX GTID 0-1-4
/*!100001 SET @@session.gtid_seq_no=4*//*!*/; /*!100001 SET @@session.gtid_seq_no=4*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 1130 # at 1148
# at 1206 # at 1224
#<date> server id 1 end_log_pos 1206 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 1224 CRC32 XXX Annotate_rows:
#Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) #Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL)
#<date> server id 1 end_log_pos 1262 CRC32 XXX Table_map: `test`.`t1` mapped to number num #<date> server id 1 end_log_pos 1280 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1262 # at 1280
#<date> server id 1 end_log_pos 1330 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F #<date> server id 1 end_log_pos 1348 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1` ### INSERT INTO `test`.`t1`
### SET ### SET
### @1=11 /* INT meta=0 nullable=0 is_null=0 */ ### @1=11 /* INT meta=0 nullable=0 is_null=0 */
...@@ -101,23 +101,23 @@ START TRANSACTION ...@@ -101,23 +101,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ ### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */
# Number of rows: 1 # Number of rows: 1
# at 1330 # at 1348
#<date> server id 1 end_log_pos 1403 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1421 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 1403 # at 1421
#<date> server id 1 end_log_pos 1445 CRC32 XXX GTID 0-1-5 #<date> server id 1 end_log_pos 1463 CRC32 XXX GTID 0-1-5
/*!100001 SET @@session.gtid_seq_no=5*//*!*/; /*!100001 SET @@session.gtid_seq_no=5*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 1445 # at 1463
# at 1523 # at 1541
#<date> server id 1 end_log_pos 1523 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 1541 CRC32 XXX Annotate_rows:
#Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") #Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A")
#<date> server id 1 end_log_pos 1579 CRC32 XXX Table_map: `test`.`t1` mapped to number num #<date> server id 1 end_log_pos 1597 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1579 # at 1597
#<date> server id 1 end_log_pos 1646 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F #<date> server id 1 end_log_pos 1664 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1` ### INSERT INTO `test`.`t1`
### SET ### SET
### @1=12 /* INT meta=0 nullable=0 is_null=0 */ ### @1=12 /* INT meta=0 nullable=0 is_null=0 */
...@@ -130,23 +130,23 @@ START TRANSACTION ...@@ -130,23 +130,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# Number of rows: 1 # Number of rows: 1
# at 1646 # at 1664
#<date> server id 1 end_log_pos 1719 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1737 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 1719 # at 1737
#<date> server id 1 end_log_pos 1761 CRC32 XXX GTID 0-1-6 #<date> server id 1 end_log_pos 1779 CRC32 XXX GTID 0-1-6
/*!100001 SET @@session.gtid_seq_no=6*//*!*/; /*!100001 SET @@session.gtid_seq_no=6*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 1761 # at 1779
# at 1836 # at 1854
#<date> server id 1 end_log_pos 1836 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 1854 CRC32 XXX Annotate_rows:
#Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") #Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A")
#<date> server id 1 end_log_pos 1892 CRC32 XXX Table_map: `test`.`t1` mapped to number num #<date> server id 1 end_log_pos 1910 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 1892 # at 1910
#<date> server id 1 end_log_pos 1962 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F #<date> server id 1 end_log_pos 1980 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F
### INSERT INTO `test`.`t1` ### INSERT INTO `test`.`t1`
### SET ### SET
### @1=13 /* INT meta=0 nullable=0 is_null=0 */ ### @1=13 /* INT meta=0 nullable=0 is_null=0 */
...@@ -159,23 +159,23 @@ START TRANSACTION ...@@ -159,23 +159,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# Number of rows: 1 # Number of rows: 1
# at 1962 # at 1980
#<date> server id 1 end_log_pos 2035 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2053 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 2035 # at 2053
#<date> server id 1 end_log_pos 2077 CRC32 XXX GTID 0-1-7 #<date> server id 1 end_log_pos 2095 CRC32 XXX GTID 0-1-7
/*!100001 SET @@session.gtid_seq_no=7*//*!*/; /*!100001 SET @@session.gtid_seq_no=7*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 2077 # at 2095
# at 2131 # at 2149
#<date> server id 1 end_log_pos 2131 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 2149 CRC32 XXX Annotate_rows:
#Q> INSERT INTO t2 SELECT * FROM t1 #Q> INSERT INTO t2 SELECT * FROM t1
#<date> server id 1 end_log_pos 2187 CRC32 XXX Table_map: `test`.`t2` mapped to number num #<date> server id 1 end_log_pos 2205 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 2187 # at 2205
#<date> server id 1 end_log_pos 2354 CRC32 XXX Write_rows: table id 33 flags: STMT_END_F #<date> server id 1 end_log_pos 2372 CRC32 XXX Write_rows: table id 33 flags: STMT_END_F
### INSERT INTO `test`.`t2` ### INSERT INTO `test`.`t2`
### SET ### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @1=10 /* INT meta=0 nullable=0 is_null=0 */
...@@ -221,23 +221,23 @@ START TRANSACTION ...@@ -221,23 +221,23 @@ START TRANSACTION
### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @8=7 /* INT meta=0 nullable=1 is_null=0 */
### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# Number of rows: 4 # Number of rows: 4
# at 2354 # at 2372
#<date> server id 1 end_log_pos 2427 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2445 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 2427 # at 2445
#<date> server id 1 end_log_pos 2469 CRC32 XXX GTID 0-1-8 #<date> server id 1 end_log_pos 2487 CRC32 XXX GTID 0-1-8
/*!100001 SET @@session.gtid_seq_no=8*//*!*/; /*!100001 SET @@session.gtid_seq_no=8*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 2469 # at 2487
# at 2535 # at 2553
#<date> server id 1 end_log_pos 2535 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 2553 CRC32 XXX Annotate_rows:
#Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL
#<date> server id 1 end_log_pos 2591 CRC32 XXX Table_map: `test`.`t2` mapped to number num #<date> server id 1 end_log_pos 2609 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 2591 # at 2609
#<date> server id 1 end_log_pos 2657 CRC32 XXX Update_rows: table id 33 flags: STMT_END_F #<date> server id 1 end_log_pos 2675 CRC32 XXX Update_rows: table id 33 flags: STMT_END_F
### UPDATE `test`.`t2` ### UPDATE `test`.`t2`
### WHERE ### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @1=10 /* INT meta=0 nullable=0 is_null=0 */
...@@ -254,23 +254,23 @@ START TRANSACTION ...@@ -254,23 +254,23 @@ START TRANSACTION
### SET ### SET
### @5=5 /* INT meta=0 nullable=1 is_null=0 */ ### @5=5 /* INT meta=0 nullable=1 is_null=0 */
# Number of rows: 3 # Number of rows: 3
# at 2657 # at 2675
#<date> server id 1 end_log_pos 2730 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2748 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 2730 # at 2748
#<date> server id 1 end_log_pos 2772 CRC32 XXX GTID 0-1-9 #<date> server id 1 end_log_pos 2790 CRC32 XXX GTID 0-1-9
/*!100001 SET @@session.gtid_seq_no=9*//*!*/; /*!100001 SET @@session.gtid_seq_no=9*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 2772 # at 2790
# at 2809 # at 2827
#<date> server id 1 end_log_pos 2809 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 2827 CRC32 XXX Annotate_rows:
#Q> DELETE FROM t1 #Q> DELETE FROM t1
#<date> server id 1 end_log_pos 2865 CRC32 XXX Table_map: `test`.`t1` mapped to number num #<date> server id 1 end_log_pos 2883 CRC32 XXX Table_map: `test`.`t1` mapped to number num
# at 2865 # at 2883
#<date> server id 1 end_log_pos 2919 CRC32 XXX Delete_rows: table id 32 flags: STMT_END_F #<date> server id 1 end_log_pos 2937 CRC32 XXX Delete_rows: table id 32 flags: STMT_END_F
### DELETE FROM `test`.`t1` ### DELETE FROM `test`.`t1`
### WHERE ### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @1=10 /* INT meta=0 nullable=0 is_null=0 */
...@@ -284,23 +284,23 @@ START TRANSACTION ...@@ -284,23 +284,23 @@ START TRANSACTION
### WHERE ### WHERE
### @1=13 /* INT meta=0 nullable=0 is_null=0 */ ### @1=13 /* INT meta=0 nullable=0 is_null=0 */
# Number of rows: 4 # Number of rows: 4
# at 2919 # at 2937
#<date> server id 1 end_log_pos 2992 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 3010 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 2992 # at 3010
#<date> server id 1 end_log_pos 3034 CRC32 XXX GTID 0-1-10 #<date> server id 1 end_log_pos 3052 CRC32 XXX GTID 0-1-10
/*!100001 SET @@session.gtid_seq_no=10*//*!*/; /*!100001 SET @@session.gtid_seq_no=10*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 3034 # at 3052
# at 3071 # at 3089
#<date> server id 1 end_log_pos 3071 CRC32 XXX Annotate_rows: #<date> server id 1 end_log_pos 3089 CRC32 XXX Annotate_rows:
#Q> DELETE FROM t2 #Q> DELETE FROM t2
#<date> server id 1 end_log_pos 3127 CRC32 XXX Table_map: `test`.`t2` mapped to number num #<date> server id 1 end_log_pos 3145 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 3127 # at 3145
#<date> server id 1 end_log_pos 3181 CRC32 XXX Delete_rows: table id 33 flags: STMT_END_F #<date> server id 1 end_log_pos 3199 CRC32 XXX Delete_rows: table id 33 flags: STMT_END_F
### DELETE FROM `test`.`t2` ### DELETE FROM `test`.`t2`
### WHERE ### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */ ### @1=10 /* INT meta=0 nullable=0 is_null=0 */
...@@ -314,13 +314,13 @@ START TRANSACTION ...@@ -314,13 +314,13 @@ START TRANSACTION
### WHERE ### WHERE
### @1=13 /* INT meta=0 nullable=0 is_null=0 */ ### @1=13 /* INT meta=0 nullable=0 is_null=0 */
# Number of rows: 4 # Number of rows: 4
# at 3181 # at 3199
#<date> server id 1 end_log_pos 3254 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 3272 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 3254 # at 3272
#<date> server id 1 end_log_pos 3302 CRC32 XXX Rotate to master-bin.000002 pos: 4 #<date> server id 1 end_log_pos 3320 CRC32 XXX Rotate to master-bin.000002 pos: 4
DELIMITER ; DELIMITER ;
# End of log file # End of log file
ROLLBACK /* added by mysqlbinlog */; ROLLBACK /* added by mysqlbinlog */;
......
...@@ -29,7 +29,7 @@ ROLLBACK/*!*/; ...@@ -29,7 +29,7 @@ ROLLBACK/*!*/;
/*!100001 SET @@session.server_id=1*//*!*/; /*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=1*//*!*/; /*!100001 SET @@session.gtid_seq_no=1*//*!*/;
# at 371 # at 371
#<date> server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 542 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
use `test`/*!*/; use `test`/*!*/;
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
SET @@session.pseudo_thread_id=5/*!*/; SET @@session.pseudo_thread_id=5/*!*/;
...@@ -42,136 +42,136 @@ SET @@session.lc_time_names=0/*!*/; ...@@ -42,136 +42,136 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/; SET @@session.collation_database=DEFAULT/*!*/;
CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1))
/*!*/; /*!*/;
# at 533 # at 542
#<date> server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl #<date> server id 1 end_log_pos 584 CRC32 XXX GTID 0-1-2 ddl
/*!100001 SET @@session.gtid_seq_no=2*//*!*/; /*!100001 SET @@session.gtid_seq_no=2*//*!*/;
# at 575 # at 584
#<date> server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 745 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)) CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1))
/*!*/; /*!*/;
# at 727 # at 745
#<date> server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3 #<date> server id 1 end_log_pos 787 CRC32 XXX GTID 0-1-3
/*!100001 SET @@session.gtid_seq_no=3*//*!*/; /*!100001 SET @@session.gtid_seq_no=3*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 769 # at 787
#<date> server id 1 end_log_pos 897 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 915 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "")
/*!*/; /*!*/;
# at 897 # at 915
#<date> server id 1 end_log_pos 970 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 988 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 970 # at 988
#<date> server id 1 end_log_pos 1012 CRC32 XXX GTID 0-1-4 #<date> server id 1 end_log_pos 1030 CRC32 XXX GTID 0-1-4
/*!100001 SET @@session.gtid_seq_no=4*//*!*/; /*!100001 SET @@session.gtid_seq_no=4*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 1012 # at 1030
#<date> server id 1 end_log_pos 1140 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1158 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL)
/*!*/; /*!*/;
# at 1140 # at 1158
#<date> server id 1 end_log_pos 1213 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1231 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 1213 # at 1231
#<date> server id 1 end_log_pos 1255 CRC32 XXX GTID 0-1-5 #<date> server id 1 end_log_pos 1273 CRC32 XXX GTID 0-1-5
/*!100001 SET @@session.gtid_seq_no=5*//*!*/; /*!100001 SET @@session.gtid_seq_no=5*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 1255 # at 1273
#<date> server id 1 end_log_pos 1385 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1403 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A")
/*!*/; /*!*/;
# at 1385 # at 1403
#<date> server id 1 end_log_pos 1458 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1476 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 1458 # at 1476
#<date> server id 1 end_log_pos 1500 CRC32 XXX GTID 0-1-6 #<date> server id 1 end_log_pos 1518 CRC32 XXX GTID 0-1-6
/*!100001 SET @@session.gtid_seq_no=6*//*!*/; /*!100001 SET @@session.gtid_seq_no=6*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 1500 # at 1518
#<date> server id 1 end_log_pos 1627 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1645 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A")
/*!*/; /*!*/;
# at 1627 # at 1645
#<date> server id 1 end_log_pos 1700 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1718 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 1700 # at 1718
#<date> server id 1 end_log_pos 1742 CRC32 XXX GTID 0-1-7 #<date> server id 1 end_log_pos 1760 CRC32 XXX GTID 0-1-7
/*!100001 SET @@session.gtid_seq_no=7*//*!*/; /*!100001 SET @@session.gtid_seq_no=7*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 1742 # at 1760
#<date> server id 1 end_log_pos 1850 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1868 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
INSERT INTO t2 SELECT * FROM t1 INSERT INTO t2 SELECT * FROM t1
/*!*/; /*!*/;
# at 1850 # at 1868
#<date> server id 1 end_log_pos 1923 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 1941 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 1923 # at 1941
#<date> server id 1 end_log_pos 1965 CRC32 XXX GTID 0-1-8 #<date> server id 1 end_log_pos 1983 CRC32 XXX GTID 0-1-8
/*!100001 SET @@session.gtid_seq_no=8*//*!*/; /*!100001 SET @@session.gtid_seq_no=8*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 1965 # at 1983
#<date> server id 1 end_log_pos 2082 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2100 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL
/*!*/; /*!*/;
# at 2082 # at 2100
#<date> server id 1 end_log_pos 2155 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2173 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 2155 # at 2173
#<date> server id 1 end_log_pos 2197 CRC32 XXX GTID 0-1-9 #<date> server id 1 end_log_pos 2215 CRC32 XXX GTID 0-1-9
/*!100001 SET @@session.gtid_seq_no=9*//*!*/; /*!100001 SET @@session.gtid_seq_no=9*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 2197 # at 2215
#<date> server id 1 end_log_pos 2288 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2306 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
DELETE FROM t1 DELETE FROM t1
/*!*/; /*!*/;
# at 2288 # at 2306
#<date> server id 1 end_log_pos 2361 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2379 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 2361 # at 2379
#<date> server id 1 end_log_pos 2403 CRC32 XXX GTID 0-1-10 #<date> server id 1 end_log_pos 2421 CRC32 XXX GTID 0-1-10
/*!100001 SET @@session.gtid_seq_no=10*//*!*/; /*!100001 SET @@session.gtid_seq_no=10*//*!*/;
START TRANSACTION START TRANSACTION
/*!*/; /*!*/;
# at 2403 # at 2421
#<date> server id 1 end_log_pos 2494 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2512 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
DELETE FROM t2 DELETE FROM t2
/*!*/; /*!*/;
# at 2494 # at 2512
#<date> server id 1 end_log_pos 2567 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid> #<date> server id 1 end_log_pos 2585 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid=<xid>
SET TIMESTAMP=X/*!*/; SET TIMESTAMP=X/*!*/;
COMMIT COMMIT
/*!*/; /*!*/;
# at 2567 # at 2585
#<date> server id 1 end_log_pos 2615 CRC32 XXX Rotate to master-bin.000002 pos: 4 #<date> server id 1 end_log_pos 2633 CRC32 XXX Rotate to master-bin.000002 pos: 4
DELIMITER ; DELIMITER ;
# End of log file # End of log file
ROLLBACK /* added by mysqlbinlog */; ROLLBACK /* added by mysqlbinlog */;
......
...@@ -1194,7 +1194,7 @@ source include/binlog_start_pos.inc; ...@@ -1194,7 +1194,7 @@ source include/binlog_start_pos.inc;
let _BINLOG_START_POS= $binlog_start_pos; let _BINLOG_START_POS= $binlog_start_pos;
--perl --perl
my $f= "$ENV{MYSQLTEST_VARDIR}/tmp/mwl136.sql"; my $f= "$ENV{MYSQLTEST_VARDIR}/tmp/mwl136.sql";
my $pos=$ENV{_BINLOG_START_POS} + 739; my $pos=$ENV{_BINLOG_START_POS} + 757;
open F, '<', $f or die "Failed to open $f: $!\n"; open F, '<', $f or die "Failed to open $f: $!\n";
while (<F>) { while (<F>) {
s/$pos/<pos>/; s/$pos/<pos>/;
......
create table const_table (a int, b int) engine=myisam;
insert into const_table values (1,1),(2,2);
flush tables;
engine: myisam
query: CREATE TABLE t1 (a int)
crash point: ddl_log_create_before_create_frm
t2.MYD
t2.MYI
t2.frm
crash point: storage_engine_middle_of_create
"No crash!"
t1.MYD
t1.MYI
t1.frm
t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
crash point: ddl_log_create_before_create_table
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_create_table
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_drop
"No crash!"
t1.MYD
t1.MYI
t1.frm
t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
crash point: ddl_log_create_before_binlog
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_prepare_eof
"No crash!"
t1.MYD
t1.MYI
t1.frm
t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
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 (a int)
crash point: ddl_log_create_log_complete
"No crash!"
t1.MYD
t1.MYI
t1.frm
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
t2.MYI
t2.frm
crash point: storage_engine_middle_of_create
"No crash!"
t1.MYD
t1.MYI
t1.frm
t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 LIKE const_table
crash point: ddl_log_create_before_create_table
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_create_table
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_drop
"No crash!"
t1.MYD
t1.MYI
t1.frm
t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 LIKE const_table
crash point: ddl_log_create_before_binlog
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_prepare_eof
"No crash!"
t1.MYD
t1.MYI
t1.frm
t2.MYD
t2.MYI
t2.frm
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 LIKE const_table
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 LIKE const_table
crash point: ddl_log_create_log_complete
"No crash!"
t1.MYD
t1.MYI
t1.frm
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
t2.MYI
t2.frm
crash point: storage_engine_middle_of_create
"No crash!"
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_before_create_table
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_create_table
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_drop
"No crash!"
t1.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_before_binlog
t2.MYD
t2.MYI
t2.frm
crash point: ddl_log_create_after_prepare_eof
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
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
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
t2.frm
t2.ibd
crash point: storage_engine_middle_of_create
"No crash!"
t1.frm
t1.ibd
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
crash point: ddl_log_create_before_create_table
t2.frm
t2.ibd
crash point: ddl_log_create_after_create_table
t2.frm
t2.ibd
crash point: ddl_log_create_after_drop
"No crash!"
t1.frm
t1.ibd
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
crash point: ddl_log_create_before_binlog
t2.frm
t2.ibd
crash point: ddl_log_create_after_prepare_eof
"No crash!"
t1.frm
t1.ibd
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
crash point: ddl_log_create_after_binlog
t1.frm
t1.ibd
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
t2.ibd
crash point: storage_engine_middle_of_create
"No crash!"
t1.MYD
t1.MYI
t1.frm
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 LIKE const_table
crash point: ddl_log_create_before_create_table
t2.frm
t2.ibd
crash point: ddl_log_create_after_create_table
t2.frm
t2.ibd
crash point: ddl_log_create_after_drop
"No crash!"
t1.MYD
t1.MYI
t1.frm
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 LIKE const_table
crash point: ddl_log_create_before_binlog
t2.frm
t2.ibd
crash point: ddl_log_create_after_prepare_eof
"No crash!"
t1.MYD
t1.MYI
t1.frm
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 LIKE const_table
crash point: ddl_log_create_after_binlog
t1.MYD
t1.MYI
t1.frm
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
t2.ibd
crash point: storage_engine_middle_of_create
"No crash!"
t1.frm
t1.ibd
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 SELECT * from t2
crash point: ddl_log_create_before_create_table
t2.frm
t2.ibd
crash point: ddl_log_create_after_create_table
t2.frm
t2.ibd
crash point: ddl_log_create_after_drop
"No crash!"
t1.frm
t1.ibd
t2.frm
t2.ibd
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 SELECT * from t2
crash point: ddl_log_create_before_binlog
t2.frm
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
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'
--source include/have_debug.inc
--source include/have_sequence.inc
--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/not_valgrind.inc
#
# Testing of atomic create table with crashes in a lot of different places
#
# We test both statement based logging and row logging as CREATE ... SELECT
# works a bit differently depending on the logging format
# First engine will use row logging and second engine will use statement
# based logging
#
--disable_query_log
call mtr.add_suppression("InnoDB: .* does not exist in the InnoDB internal");
--enable_query_log
let $MYSQLD_DATADIR= `SELECT @@datadir`;
if ($engine_count == "")
{
let $engine_count=2;
let $engines='myisam','innodb';
}
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 $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 const_table (a int, b int) engine=myisam;
insert into const_table values (1,1),(2,2);
flush tables;
let $old_debug=`select @@debug_dbug`;
let $e=0;
let $keep_include_silent=1;
let $grep_script=CREATE|DROP;
--disable_query_log
while ($e < $engine_count)
{
inc $e;
let $engine=`select ELT($e, $engines)`;
let $default_engine=$engine;
let $extra_option=;
if ($engine == "aria")
{
let $extra_option=transactional=1;
}
if ($engine == "aria_notrans")
{
let $default_engine="aria";
let $extra_option=transactional=0;
}
--echo engine: $engine
let $r=0;
while ($r < $statement_count)
{
inc $r;
let $statement=`select ELT($r, $statements)`;
--echo query: $statement
let $c=0;
while ($c < $crash_count)
{
inc $c;
let $crash=`select ELT($c, $crash_points)`;
--eval set @@default_storage_engine=$default_engine
create or replace table t2 select * from seq_1_to_2;
flush tables;
if ($e == 1)
{
--source include/set_binlog_format_row.sql
}
if ($e == 2)
{
--source include/set_binlog_format_statement.sql
}
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!";
}
# Check which tables still exists
--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
}
# Drop the tables. The warnings will show what was dropped
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
}
}
}
drop table if exists t1,t2,const_table;
--enable_query_log
...@@ -58,20 +58,20 @@ select "--- offset --" as ""; ...@@ -58,20 +58,20 @@ select "--- offset --" as "";
--disable_query_log --disable_query_log
select "--- start-position --" as ""; select "--- start-position --" as "";
--enable_query_log --enable_query_log
let $start_pos= `select @binlog_start_pos + 696`; let $start_pos= `select @binlog_start_pos + 705`;
--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 --exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001
--disable_query_log --disable_query_log
select "--- stop-position --" as ""; select "--- stop-position --" as "";
--enable_query_log --enable_query_log
let $stop_pos= `select @binlog_start_pos + 696`; let $stop_pos= `select @binlog_start_pos + 705`;
--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 --exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
--disable_query_log --disable_query_log
select "--- start and stop positions ---" as ""; select "--- start and stop positions ---" as "";
--enable_query_log --enable_query_log
let $start_pos= `select @binlog_start_pos + 696`; let $start_pos= `select @binlog_start_pos + 705`;
let $stop_pos= `select @binlog_start_pos + 857`; let $stop_pos= `select @binlog_start_pos + 866`;
--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 --exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001
--disable_query_log --disable_query_log
...@@ -103,7 +103,7 @@ select "--- offset --" as ""; ...@@ -103,7 +103,7 @@ select "--- offset --" as "";
--disable_query_log --disable_query_log
select "--- start-position --" as ""; select "--- start-position --" as "";
--enable_query_log --enable_query_log
let $start_pos= `select @binlog_start_pos + 696`; let $start_pos= `select @binlog_start_pos + 705`;
--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log --disable_query_log
...@@ -138,19 +138,19 @@ select "--- offset --" as ""; ...@@ -138,19 +138,19 @@ select "--- offset --" as "";
--disable_query_log --disable_query_log
select "--- start-position --" as ""; select "--- start-position --" as "";
--enable_query_log --enable_query_log
let $start_pos= `select @binlog_start_pos + 696`; let $start_pos= `select @binlog_start_pos + 705`;
--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log --disable_query_log
select "--- stop-position --" as ""; select "--- stop-position --" as "";
--enable_query_log --enable_query_log
let $stop_pos= `select @binlog_start_pos + 696`; let $stop_pos= `select @binlog_start_pos + 705`;
--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/
--exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log --disable_query_log
select "--- start and stop positions ---" as ""; select "--- start and stop positions ---" as "";
--enable_query_log --enable_query_log
let $start_pos= `select @binlog_start_pos + 696`; let $start_pos= `select @binlog_start_pos + 705`;
let $stop_pos= `select @binlog_start_pos + 812`; let $stop_pos= `select @binlog_start_pos + 812`;
--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position $stop_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
...@@ -180,7 +180,7 @@ select "--- offset --" as ""; ...@@ -180,7 +180,7 @@ select "--- offset --" as "";
--disable_query_log --disable_query_log
select "--- start-position --" as ""; select "--- start-position --" as "";
--enable_query_log --enable_query_log
let $start_pos= `select @binlog_start_pos + 696`; let $start_pos= `select @binlog_start_pos + 705`;
--replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/ --replace_regex /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/
--exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --exec $MYSQL_BINLOG --short-form --start-position=$start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
--disable_query_log --disable_query_log
......
...@@ -12,25 +12,25 @@ SET SESSION wsrep_trx_fragment_size=1; ...@@ -12,25 +12,25 @@ SET SESSION wsrep_trx_fragment_size=1;
INSERT INTO t1 VALUES (5), (6); INSERT INTO t1 VALUES (5), (6);
SET SESSION wsrep_trx_fragment_unit=default; SET SESSION wsrep_trx_fragment_unit=default;
SET SESSION wsrep_trx_fragment_size=default; SET SESSION wsrep_trx_fragment_size=default;
SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 518; SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 527;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000002 518 Gtid 1 560 BEGIN GTID 0-1-2 mysqld-bin.000002 # Gtid 1 # BEGIN GTID 0-1-2
mysqld-bin.000002 560 Annotate_rows 1 613 INSERT INTO t1 VALUES (1), (2) mysqld-bin.000002 # Annotate_rows 1 # INSERT INTO t1 VALUES (1), (2)
mysqld-bin.000002 613 Table_map 1 658 table_id: # (test.t1) mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1)
mysqld-bin.000002 658 Write_rows_v1 1 696 table_id: # flags: STMT_END_F mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
mysqld-bin.000002 696 Table_map 1 741 table_id: # (test.t1) mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1)
mysqld-bin.000002 741 Write_rows_v1 1 779 table_id: # flags: STMT_END_F mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
mysqld-bin.000002 779 Xid 1 810 COMMIT /* xid=# */ mysqld-bin.000002 # Xid 1 # COMMIT /* xid=# */
mysqld-bin.000002 810 Gtid 1 852 BEGIN GTID 0-1-3 mysqld-bin.000002 # Gtid 1 # BEGIN GTID 0-1-3
mysqld-bin.000002 852 Annotate_rows 1 905 INSERT INTO t1 VALUES (3), (4) mysqld-bin.000002 # Annotate_rows 1 # INSERT INTO t1 VALUES (3), (4)
mysqld-bin.000002 905 Table_map 1 950 table_id: # (test.t1) mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1)
mysqld-bin.000002 950 Write_rows_v1 1 988 table_id: # flags: STMT_END_F mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
mysqld-bin.000002 988 Table_map 1 1033 table_id: # (test.t1) mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1)
mysqld-bin.000002 1033 Write_rows_v1 1 1071 table_id: # flags: STMT_END_F mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
mysqld-bin.000002 1071 Xid 1 1102 COMMIT /* xid=# */ mysqld-bin.000002 # Xid 1 # COMMIT /* xid=# */
mysqld-bin.000002 1102 Gtid 1 1144 BEGIN GTID 0-1-4 mysqld-bin.000002 # Gtid 1 # BEGIN GTID 0-1-4
mysqld-bin.000002 1144 Annotate_rows 1 1197 INSERT INTO t1 VALUES (5), (6) mysqld-bin.000002 # Annotate_rows 1 # INSERT INTO t1 VALUES (5), (6)
mysqld-bin.000002 1197 Table_map 1 1242 table_id: # (test.t1) mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1)
mysqld-bin.000002 1242 Write_rows_v1 1 1285 table_id: # flags: STMT_END_F mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
mysqld-bin.000002 1285 Xid 1 1316 COMMIT /* xid=# */ mysqld-bin.000002 # Xid 1 # COMMIT /* xid=# */
DROP TABLE t1; DROP TABLE t1;
...@@ -12,6 +12,8 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY); ...@@ -12,6 +12,8 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY);
SET SESSION wsrep_trx_fragment_unit='ROWS'; SET SESSION wsrep_trx_fragment_unit='ROWS';
SET SESSION wsrep_trx_fragment_size=1; SET SESSION wsrep_trx_fragment_size=1;
--let $start_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
# #
...@@ -37,6 +39,7 @@ SET SESSION wsrep_trx_fragment_unit=default; ...@@ -37,6 +39,7 @@ SET SESSION wsrep_trx_fragment_unit=default;
SET SESSION wsrep_trx_fragment_size=default; SET SESSION wsrep_trx_fragment_size=default;
--replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/ --replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/
SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 518; --replace_column 2 # 5 #
--eval SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM $start_pos
DROP TABLE t1; DROP TABLE t1;
...@@ -19,7 +19,7 @@ CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb; ...@@ -19,7 +19,7 @@ CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb;
# MDEV-515 takes X-lock on the table for the first insert. # MDEV-515 takes X-lock on the table for the first insert.
# So concurrent insert won't happen on the table # So concurrent insert won't happen on the table
INSERT INTO t1 VALUES(9, ""); INSERT INTO t1 VALUES(9, "");
let pos=`select $binlog_start_pos + 422`; let pos=`select $binlog_start_pos + 431`;
--replace_result $pos <pos> --replace_result $pos <pos>
SHOW MASTER STATUS; SHOW MASTER STATUS;
--replace_result $pos <pos> --replace_result $pos <pos>
...@@ -56,10 +56,10 @@ COMMIT; ...@@ -56,10 +56,10 @@ COMMIT;
connection default; connection default;
SELECT * FROM t1 ORDER BY a,b; SELECT * FROM t1 ORDER BY a,b;
let pos=`select $binlog_start_pos + 956`; let pos=`select $binlog_start_pos + 974`;
--replace_result $pos <pos> --replace_result $pos <pos>
SHOW STATUS LIKE 'binlog_snapshot_%'; SHOW STATUS LIKE 'binlog_snapshot_%';
let pos=`select $binlog_start_pos + 1332`; let pos=`select $binlog_start_pos + 1350`;
--replace_result $pos <pos> --replace_result $pos <pos>
SHOW MASTER STATUS; SHOW MASTER STATUS;
SELECT * FROM t2 ORDER BY a; SELECT * FROM t2 ORDER BY a;
...@@ -77,7 +77,7 @@ FLUSH LOGS; ...@@ -77,7 +77,7 @@ FLUSH LOGS;
connection default; connection default;
SELECT * FROM t1 ORDER BY a,b; SELECT * FROM t1 ORDER BY a,b;
let pos=`select $binlog_start_pos + 956`; let pos=`select $binlog_start_pos + 974`;
--replace_result $pos <pos> --replace_result $pos <pos>
SHOW STATUS LIKE 'binlog_snapshot_%'; SHOW STATUS LIKE 'binlog_snapshot_%';
let pos=`select $binlog_start_pos + 131`; let pos=`select $binlog_start_pos + 131`;
......
...@@ -97,7 +97,7 @@ SELECT * FROM t1 ORDER BY a; ...@@ -97,7 +97,7 @@ SELECT * FROM t1 ORDER BY a;
# for the end of the second transaction (as can be checked with # for the end of the second transaction (as can be checked with
# mysqlbinlog). # mysqlbinlog).
let $MYSQLD_DATADIR= `SELECT @@datadir`; let $MYSQLD_DATADIR= `SELECT @@datadir`;
let pos=`select $binlog_start_pos + 730`; let pos=`select $binlog_start_pos + 739`;
--replace_result $pos <pos> --replace_result $pos <pos>
--exec sed -ne 's/.*\(InnoDB: Last binlog file .* position.*\)/\1/p' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1 --exec sed -ne 's/.*\(InnoDB: Last binlog file .* position.*\)/\1/p' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1
......
...@@ -98,7 +98,7 @@ SELECT * FROM t1 ORDER BY a; ...@@ -98,7 +98,7 @@ SELECT * FROM t1 ORDER BY a;
# for the end of the second transaction (as can be checked with # for the end of the second transaction (as can be checked with
# mysqlbinlog). # mysqlbinlog).
let $MYSQLD_DATADIR= `SELECT @@datadir`; let $MYSQLD_DATADIR= `SELECT @@datadir`;
let pos=`select $binlog_start_pos + 730`; let pos=`select $binlog_start_pos + 739`;
--replace_result $pos <pos> --replace_result $pos <pos>
--exec sed -ne 's/.*\(InnoDB: Last binlog file .* position.*\)/\1/p' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1 --exec sed -ne 's/.*\(InnoDB: Last binlog file .* position.*\)/\1/p' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
......
...@@ -39,9 +39,10 @@ stop slave 'master1'; ...@@ -39,9 +39,10 @@ stop slave 'master1';
--let $datadir = `SELECT @@datadir` --let $datadir = `SELECT @@datadir`
let read_master_log_pos=`select $binlog_start_pos + 599`; let read_master_log_pos=`select $binlog_start_pos + 608`;
let relay_log_pos=`select 2*$binlog_start_pos + 643`; let relay_log_pos=`select 2*$binlog_start_pos + 652`;
let relay_log_space=`select 3*$binlog_start_pos + 705`; let relay_log_space=`select 3*$binlog_start_pos + 714`;
--replace_result $SERVER_MYPORT_1 MYPORT_1 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space <relay_log_space> --replace_result $SERVER_MYPORT_1 MYPORT_1 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space <relay_log_space>
show slave 'master1' status; show slave 'master1' status;
--list_files $datadir mysqld* --list_files $datadir mysqld*
......
...@@ -9,6 +9,4 @@ SELECT * FROM t1; ...@@ -9,6 +9,4 @@ SELECT * FROM t1;
connection default; connection default;
# Waiting for mariadbd to crash # Waiting for mariadbd to crash
# Crash was detected # Crash was detected
DROP TABLE t1, t2; DROP TABLE t1;
Warnings:
Warning 1932 Table 'test.t2' doesn't exist in engine
...@@ -65,4 +65,5 @@ connection default; ...@@ -65,4 +65,5 @@ connection default;
# Call script that will poll the server waiting for it to be back online again # Call script that will poll the server waiting for it to be back online again
source include/wait_until_connected_again.inc; source include/wait_until_connected_again.inc;
DROP TABLE t1, t2; # We only have to do drop t1, as t2 as been automatically deleted by ddl recovery
DROP TABLE t1;
...@@ -89,7 +89,7 @@ const char *ddl_log_action_name[DDL_LOG_LAST_ACTION]= ...@@ -89,7 +89,7 @@ const char *ddl_log_action_name[DDL_LOG_LAST_ACTION]=
"partitioning replace", "partitioning exchange", "partitioning replace", "partitioning exchange",
"rename table", "rename view", "rename table", "rename view",
"initialize drop table", "drop table", "initialize drop table", "drop table",
"drop view", "drop trigger", "drop db", "drop view", "drop trigger", "drop db", "create table",
}; };
/* Number of phases per entry */ /* Number of phases per entry */
...@@ -98,7 +98,7 @@ const uchar ddl_log_entry_phases[DDL_LOG_LAST_ACTION]= ...@@ -98,7 +98,7 @@ const uchar ddl_log_entry_phases[DDL_LOG_LAST_ACTION]=
0, 1, 1, 2, 0, 1, 1, 2,
(uchar) EXCH_PHASE_END, (uchar) DDL_RENAME_PHASE_END, 1, 1, (uchar) EXCH_PHASE_END, (uchar) DDL_RENAME_PHASE_END, 1, 1,
(uchar) DDL_DROP_PHASE_END, 1, 1, (uchar) DDL_DROP_PHASE_END, 1, 1,
(uchar) DDL_DROP_DB_PHASE_END (uchar) DDL_DROP_DB_PHASE_END, (uchar) DDL_CREATE_TABLE_PHASE_END
}; };
...@@ -1499,6 +1499,59 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root, ...@@ -1499,6 +1499,59 @@ static int ddl_log_execute_action(THD *thd, MEM_ROOT *mem_root,
} }
break; break;
} }
case DDL_LOG_CREATE_TABLE_ACTION:
{
LEX_CSTRING db, table, path;
db= ddl_log_entry->db;
table= ddl_log_entry->name;
path= ddl_log_entry->tmp_name;
/* Don't delete the table if we didn't create it */
if (ddl_log_entry->flags == 0)
{
if (hton)
{
if ((error= hton->drop_table(hton, path.str)))
{
if (!non_existing_table_error(error))
break;
error= -1;
}
}
else
error= ha_delete_table_force(thd, path.str, &db, &table);
}
strxnmov(to_path, sizeof(to_path)-1, path.str, reg_ext, NullS);
mysql_file_delete(key_file_frm, to_path, MYF(MY_WME|MY_IGNORE_ENOENT));
if (ddl_log_entry->phase == DDL_CREATE_TABLE_PHASE_LOG)
{
/*
The server logged CREATE TABLE ... SELECT into binary log
before crashing. As the commit failed and we have delete the
table above, we have now to log the DROP of the created table.
*/
String *query= &recovery_state.drop_table;
query->length(0);
query->append(STRING_WITH_LEN("DROP TABLE IF EXISTS "));
append_identifier(thd, query, &db);
query->append('.');
append_identifier(thd, query, &table);
query->append(&end_comment);
if (mysql_bin_log.is_open())
{
mysql_mutex_unlock(&LOCK_gdl);
(void) thd->binlog_query(THD::STMT_QUERY_TYPE,
query->ptr(), query->length(),
TRUE, FALSE, FALSE, 0);
mysql_mutex_lock(&LOCK_gdl);
}
}
(void) update_phase(entry_pos, DDL_LOG_FINAL_PHASE);
break;
}
break;
default: default:
DBUG_ASSERT(0); DBUG_ASSERT(0);
break; break;
...@@ -2417,3 +2470,34 @@ bool ddl_log_drop_db(THD *thd, DDL_LOG_STATE *ddl_state, ...@@ -2417,3 +2470,34 @@ bool ddl_log_drop_db(THD *thd, DDL_LOG_STATE *ddl_state,
ddl_log_entry.tmp_name= *const_cast<LEX_CSTRING*>(path); ddl_log_entry.tmp_name= *const_cast<LEX_CSTRING*>(path);
DBUG_RETURN(ddl_log_write(ddl_state, &ddl_log_entry)); DBUG_RETURN(ddl_log_write(ddl_state, &ddl_log_entry));
} }
/**
Log CREATE TABLE
@param only_frm On recovery, only drop the .frm. This is needed for
example when deleting a table that was discovered.
*/
bool ddl_log_create_table(THD *thd, DDL_LOG_STATE *ddl_state,
handlerton *hton,
const LEX_CSTRING *path,
const LEX_CSTRING *db,
const LEX_CSTRING *table,
bool only_frm)
{
DDL_LOG_ENTRY ddl_log_entry;
DBUG_ENTER("ddl_log_create_table");
bzero(&ddl_log_entry, sizeof(ddl_log_entry));
ddl_log_entry.action_type= DDL_LOG_CREATE_TABLE_ACTION;
if (hton)
lex_string_set(&ddl_log_entry.handler_name,
ha_resolve_storage_engine_name(hton));
ddl_log_entry.db= *const_cast<LEX_CSTRING*>(db);
ddl_log_entry.name= *const_cast<LEX_CSTRING*>(table);
ddl_log_entry.tmp_name= *const_cast<LEX_CSTRING*>(path);
ddl_log_entry.flags= only_frm;
DBUG_RETURN(ddl_log_write(ddl_state, &ddl_log_entry));
}
...@@ -82,6 +82,7 @@ enum ddl_log_action_code ...@@ -82,6 +82,7 @@ enum ddl_log_action_code
DDL_LOG_DROP_VIEW_ACTION= 9, DDL_LOG_DROP_VIEW_ACTION= 9,
DDL_LOG_DROP_TRIGGER_ACTION= 10, DDL_LOG_DROP_TRIGGER_ACTION= 10,
DDL_LOG_DROP_DB_ACTION=11, DDL_LOG_DROP_DB_ACTION=11,
DDL_LOG_CREATE_TABLE_ACTION=12,
DDL_LOG_LAST_ACTION /* End marker */ DDL_LOG_LAST_ACTION /* End marker */
}; };
...@@ -118,6 +119,12 @@ enum enum_ddl_log_drop_db_phase { ...@@ -118,6 +119,12 @@ enum enum_ddl_log_drop_db_phase {
DDL_DROP_DB_PHASE_END DDL_DROP_DB_PHASE_END
}; };
enum enum_ddl_log_create_table_phase {
DDL_CREATE_TABLE_PHASE_INIT=0,
DDL_CREATE_TABLE_PHASE_LOG,
DDL_CREATE_TABLE_PHASE_END
};
/* /*
Setting ddl_log_entry.phase to this has the same effect as setting Setting ddl_log_entry.phase to this has the same effect as setting
the phase to the maximum phase (..PHASE_END) for an entry. the phase to the maximum phase (..PHASE_END) for an entry.
...@@ -185,6 +192,7 @@ typedef struct st_ddl_log_state ...@@ -185,6 +192,7 @@ typedef struct st_ddl_log_state
DDL_LOG_MEMORY_ENTRY *list; DDL_LOG_MEMORY_ENTRY *list;
/* One execute entry per list */ /* One execute entry per list */
DDL_LOG_MEMORY_ENTRY *execute_entry; DDL_LOG_MEMORY_ENTRY *execute_entry;
bool is_active() { return list != 0; }
} DDL_LOG_STATE; } DDL_LOG_STATE;
...@@ -252,5 +260,11 @@ bool ddl_log_drop_view(THD *thd, DDL_LOG_STATE *ddl_state, ...@@ -252,5 +260,11 @@ bool ddl_log_drop_view(THD *thd, DDL_LOG_STATE *ddl_state,
const LEX_CSTRING *db); const LEX_CSTRING *db);
bool ddl_log_drop_db(THD *thd, DDL_LOG_STATE *ddl_state, bool ddl_log_drop_db(THD *thd, DDL_LOG_STATE *ddl_state,
const LEX_CSTRING *db, const LEX_CSTRING *path); const LEX_CSTRING *db, const LEX_CSTRING *path);
bool ddl_log_create_table(THD *thd, DDL_LOG_STATE *ddl_state,
handlerton *hton,
const LEX_CSTRING *path,
const LEX_CSTRING *db,
const LEX_CSTRING *table,
bool only_frm);
extern mysql_mutex_t LOCK_gdl; extern mysql_mutex_t LOCK_gdl;
#endif /* DDL_LOG_INCLUDED */ #endif /* DDL_LOG_INCLUDED */
...@@ -4563,6 +4563,7 @@ bool non_existing_table_error(int error) ...@@ -4563,6 +4563,7 @@ bool non_existing_table_error(int error)
{ {
return (error == ENOENT || return (error == ENOENT ||
(error == EE_DELETE && my_errno == ENOENT) || (error == EE_DELETE && my_errno == ENOENT) ||
error == EE_FILENOTFOUND ||
error == HA_ERR_NO_SUCH_TABLE || error == HA_ERR_NO_SUCH_TABLE ||
error == HA_ERR_UNSUPPORTED || error == HA_ERR_UNSUPPORTED ||
error == ER_NO_SUCH_TABLE || error == ER_NO_SUCH_TABLE ||
......
...@@ -294,6 +294,12 @@ class Alter_table_ctx ...@@ -294,6 +294,12 @@ class Alter_table_ctx
const char *get_tmp_path() const const char *get_tmp_path() const
{ return tmp_path; } { return tmp_path; }
const LEX_CSTRING get_tmp_cstring_path() const
{
LEX_CSTRING tmp= { tmp_path, strlen(tmp_path) };
return tmp;
};
/** /**
Mark ALTER TABLE as needing to produce foreign key error if Mark ALTER TABLE as needing to produce foreign key error if
it deletes a row from the table being changed. it deletes a row from the table being changed.
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA, THR_LOCK_INFO */ #include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA, THR_LOCK_INFO */
#include "thr_timer.h" #include "thr_timer.h"
#include "thr_malloc.h" #include "thr_malloc.h"
#include "log_slow.h" /* LOG_SLOW_DISABLE_... */ #include "log_slow.h" /* LOG_SLOW_DISABLE_... */
#include <my_tree.h> #include <my_tree.h>
#include "sql_digest_stream.h" // sql_digest_state #include "sql_digest_stream.h" // sql_digest_state
#include <mysql/psi/mysql_stage.h> #include <mysql/psi/mysql_stage.h>
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "session_tracker.h" #include "session_tracker.h"
#include "backup.h" #include "backup.h"
#include "xa.h" #include "xa.h"
#include "ddl_log.h" /* DDL_LOG_STATE */
extern "C" extern "C"
void set_thd_stage_info(void *thd, void set_thd_stage_info(void *thd,
...@@ -6027,6 +6028,7 @@ class select_create: public select_insert { ...@@ -6027,6 +6028,7 @@ class select_create: public select_insert {
MYSQL_LOCK **m_plock; MYSQL_LOCK **m_plock;
bool exit_done; bool exit_done;
TMP_TABLE_SHARE *saved_tmp_table_share; TMP_TABLE_SHARE *saved_tmp_table_share;
DDL_LOG_STATE ddl_log_state_create, ddl_log_state_rm;
public: public:
select_create(THD *thd_arg, TABLE_LIST *table_arg, select_create(THD *thd_arg, TABLE_LIST *table_arg,
...@@ -6042,7 +6044,10 @@ class select_create: public select_insert { ...@@ -6042,7 +6044,10 @@ class select_create: public select_insert {
alter_info(alter_info_arg), alter_info(alter_info_arg),
m_plock(NULL), exit_done(0), m_plock(NULL), exit_done(0),
saved_tmp_table_share(0) saved_tmp_table_share(0)
{} {
bzero(&ddl_log_state_create, sizeof(ddl_log_state_create));
bzero(&ddl_log_state_rm, sizeof(ddl_log_state_rm));
}
int prepare(List<Item> &list, SELECT_LEX_UNIT *u); int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
void store_values(List<Item> &values); void store_values(List<Item> &values);
......
...@@ -4375,7 +4375,8 @@ Field *Item::create_field_for_create_select(MEM_ROOT *root, TABLE *table) ...@@ -4375,7 +4375,8 @@ Field *Item::create_field_for_create_select(MEM_ROOT *root, TABLE *table)
*/ */
TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
MYSQL_LOCK **lock, TABLEOP_HOOKS *hooks) MYSQL_LOCK **lock,
TABLEOP_HOOKS *hooks)
{ {
TABLE tmp_table; // Used during 'Create_field()' TABLE tmp_table; // Used during 'Create_field()'
TABLE_SHARE share; TABLE_SHARE share;
...@@ -4473,7 +4474,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, ...@@ -4473,7 +4474,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
open_table(). open_table().
*/ */
if (!mysql_create_table_no_lock(thd, &create_table->db, if (!mysql_create_table_no_lock(thd, &ddl_log_state_create, &ddl_log_state_rm,
&create_table->db,
&create_table->table_name, &create_table->table_name,
create_info, alter_info, NULL, create_info, alter_info, NULL,
select_field_count, create_table)) select_field_count, create_table))
...@@ -4532,6 +4534,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, ...@@ -4532,6 +4534,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
{ {
if (likely(!thd->is_error())) // CREATE ... IF NOT EXISTS if (likely(!thd->is_error())) // CREATE ... IF NOT EXISTS
my_ok(thd); // succeed, but did nothing my_ok(thd); // succeed, but did nothing
ddl_log_complete(&ddl_log_state_rm);
ddl_log_complete(&ddl_log_state_create);
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
} }
...@@ -4570,7 +4574,9 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items, ...@@ -4570,7 +4574,9 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
*lock= 0; *lock= 0;
} }
drop_open_table(thd, table, &create_table->db, &create_table->table_name); drop_open_table(thd, table, &create_table->db, &create_table->table_name);
DBUG_RETURN(0); ddl_log_complete(&ddl_log_state_rm);
ddl_log_complete(&ddl_log_state_create);
DBUG_RETURN(NULL);
/* purecov: end */ /* purecov: end */
} }
table->s->table_creation_was_logged= save_table_creation_was_logged; table->s->table_creation_was_logged= save_table_creation_was_logged;
...@@ -4912,11 +4918,30 @@ bool select_create::send_eof() ...@@ -4912,11 +4918,30 @@ bool select_create::send_eof()
if (thd->slave_thread) if (thd->slave_thread)
thd->variables.binlog_annotate_row_events= 0; 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()) if (prepare_eof())
{ {
abort_result_set(); abort_result_set();
DBUG_RETURN(true); DBUG_RETURN(true);
} }
debug_crash_here("ddl_log_create_after_prepare_eof");
if (table->s->tmp_table) if (table->s->tmp_table)
{ {
...@@ -4983,9 +5008,15 @@ bool select_create::send_eof() ...@@ -4983,9 +5008,15 @@ bool select_create::send_eof()
thd->get_stmt_da()->set_overwrite_status(true); thd->get_stmt_da()->set_overwrite_status(true);
} }
#endif /* WITH_WSREP */ #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);
trans_commit_stmt(thd); trans_commit_stmt(thd);
if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) if (!(thd->variables.option_bits & OPTION_GTID_BEGIN))
trans_commit_implicit(thd); trans_commit_implicit(thd);
thd->binlog_xid= 0;
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (WSREP(thd)) if (WSREP(thd))
{ {
...@@ -5004,6 +5035,15 @@ bool select_create::send_eof() ...@@ -5004,6 +5035,15 @@ bool select_create::send_eof()
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
} }
/*
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");
/* /*
exit_done must only be set after last potential call to exit_done must only be set after last potential call to
...@@ -5120,9 +5160,19 @@ void select_create::abort_result_set() ...@@ -5120,9 +5160,19 @@ void select_create::abort_result_set()
binlog_reset_cache(thd); binlog_reset_cache(thd);
/* Original table was deleted. We have to log it */ /* Original table was deleted. We have to log it */
if (table_creation_was_logged) 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, &create_table->db, &create_table->table_name, log_drop_table(thd, &create_table->db, &create_table->table_name,
tmp_table); tmp_table);
debug_crash_here("ddl_log_create_after_binlog");
thd->binlog_xid= 0;
}
} }
} }
ddl_log_complete(&ddl_log_state_rm);
ddl_log_complete(&ddl_log_state_create);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -1078,6 +1078,7 @@ static uint32 get_comment(THD *thd, uint32 comment_pos, ...@@ -1078,6 +1078,7 @@ static uint32 get_comment(THD *thd, uint32 comment_pos,
const uchar *query_end= (uchar*) query + thd->query_length(); const uchar *query_end= (uchar*) query + thd->query_length();
const uchar *const state_map= thd->charset()->state_map; const uchar *const state_map= thd->charset()->state_map;
*comment_start= ""; // Ensure it points to something
for (; query < query_end; query++) for (; query < query_end; query++)
{ {
if (state_map[static_cast<uchar>(*query)] == MY_LEX_SKIP) if (state_map[static_cast<uchar>(*query)] == MY_LEX_SKIP)
...@@ -4131,10 +4132,13 @@ handler *mysql_create_frm_image(THD *thd, const LEX_CSTRING &db, ...@@ -4131,10 +4132,13 @@ handler *mysql_create_frm_image(THD *thd, const LEX_CSTRING &db,
*/ */
static static
int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, 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 &orig_table_name,
const LEX_CSTRING &db, const LEX_CSTRING &table_name, const LEX_CSTRING &db, const LEX_CSTRING &table_name,
const char *path, const DDL_options_st options, const LEX_CSTRING &path, const DDL_options_st options,
HA_CREATE_INFO *create_info, Alter_info *alter_info, HA_CREATE_INFO *create_info, Alter_info *alter_info,
int create_table_mode, bool *is_trans, KEY **key_info, int create_table_mode, bool *is_trans, KEY **key_info,
uint *key_count, LEX_CUSTRING *frm) uint *key_count, LEX_CUSTRING *frm)
...@@ -4145,9 +4149,16 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, ...@@ -4145,9 +4149,16 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db,
bool frm_only= create_table_mode == C_ALTER_TABLE_FRM_ONLY; bool frm_only= create_table_mode == C_ALTER_TABLE_FRM_ONLY;
bool internal_tmp_table= create_table_mode == C_ALTER_TABLE || frm_only; bool internal_tmp_table= create_table_mode == C_ALTER_TABLE || frm_only;
handlerton *exists_hton; handlerton *exists_hton;
DBUG_ENTER("mysql_create_table_no_lock"); DBUG_ENTER("create_table_impl");
DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d path: %s", DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d path: %s",
db.str, table_name.str, internal_tmp_table, path)); db.str, table_name.str, internal_tmp_table, path.str));
/* 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, if (fix_constraints_names(thd, &alter_info->check_constraint_list,
create_info)) create_info))
...@@ -4261,10 +4272,12 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, ...@@ -4261,10 +4272,12 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db,
(void) trans_rollback_stmt(thd); (void) trans_rollback_stmt(thd);
/* Remove normal table without logging. Keep tables locked */ /* Remove normal table without logging. Keep tables locked */
if (mysql_rm_table_no_locks(thd, &table_list, &thd->db, if (mysql_rm_table_no_locks(thd, &table_list, &thd->db,
(DDL_LOG_STATE*) 0, ddl_log_state_rm,
0, 0, 0, 0, 1, 1)) 0, 0, 0, 0, 1, 1))
goto err; goto err;
debug_crash_here("ddl_log_create_after_drop");
/* /*
We have to log this query, even if it failed later to ensure the We have to log this query, even if it failed later to ensure the
drop is done. drop is done.
...@@ -4327,7 +4340,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, ...@@ -4327,7 +4340,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db,
goto err; goto err;
} }
init_tmp_table_share(thd, &share, db.str, 0, table_name.str, path); init_tmp_table_share(thd, &share, db.str, 0, table_name.str, path.str);
/* prepare everything for discovery */ /* prepare everything for discovery */
share.field= &no_fields; share.field= &no_fields;
...@@ -4338,6 +4351,14 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, ...@@ -4338,6 +4351,14 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db,
if (parse_engine_table_options(thd, hton, &share)) if (parse_engine_table_options(thd, hton, &share))
goto err; goto err;
/*
Log that we are going to do discovery. If things fails, any generated
.frm files are deleted
*/
if (ddl_log_state_create)
ddl_log_create_table(thd, ddl_log_state_create, (handlerton*) 0, &path,
&db, &table_name, 1);
ha_err= hton->discover_table_structure(hton, thd, &share, create_info); ha_err= hton->discover_table_structure(hton, thd, &share, create_info);
/* /*
...@@ -4359,45 +4380,56 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, ...@@ -4359,45 +4380,56 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db,
} }
else else
{ {
if (ddl_log_state_create)
ddl_log_create_table(thd, ddl_log_state_create, create_info->db_type,
&path, &db, &table_name, frm_only);
debug_crash_here("ddl_log_create_before_create_frm");
file= mysql_create_frm_image(thd, orig_db, orig_table_name, create_info, file= mysql_create_frm_image(thd, orig_db, orig_table_name, create_info,
alter_info, create_table_mode, key_info, alter_info, create_table_mode, key_info,
key_count, frm); key_count, frm);
/* /*
TODO: remove this check of thd->is_error() (now it intercept TODO: remove this check of thd->is_error() (now it intercept
errors in some val_*() methoids and bring some single place to errors in some val_*() methods and bring some single place to
such error interception). such error interception).
*/ */
if (!file || thd->is_error()) if (!file || thd->is_error())
{
if (!file)
deletefrm(path.str);
goto err; goto err;
}
if (thd->variables.keep_files_on_create) if (thd->variables.keep_files_on_create)
create_info->options|= HA_CREATE_KEEP_FILES; create_info->options|= HA_CREATE_KEEP_FILES;
if (file->ha_create_partitioning_metadata(path, NULL, CHF_CREATE_FLAG)) if (file->ha_create_partitioning_metadata(path.str, NULL, CHF_CREATE_FLAG))
goto err; goto err;
if (!frm_only) if (!frm_only)
{ {
if (ha_create_table(thd, path, db.str, table_name.str, create_info, 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)) frm, 0))
{ {
file->ha_create_partitioning_metadata(path, NULL, CHF_DELETE_FLAG); file->ha_create_partitioning_metadata(path.str, NULL, CHF_DELETE_FLAG);
deletefrm(path); deletefrm(path.str);
goto err; goto err;
} }
debug_crash_here("ddl_log_create_after_create_table");
} }
} }
create_info->table= 0; create_info->table= 0;
if (!frm_only && create_info->tmp_table()) if (!frm_only && create_info->tmp_table())
{ {
TABLE *table= thd->create_and_open_tmp_table(frm, path, db.str, TABLE *table= thd->create_and_open_tmp_table(frm, path.str, db.str,
table_name.str, table_name.str,
false); false);
if (!table) if (!table)
{ {
(void) thd->rm_temporary_table(create_info->db_type, path); (void) thd->rm_temporary_table(create_info->db_type, path.str);
goto err; goto err;
} }
...@@ -4410,6 +4442,12 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, ...@@ -4410,6 +4442,12 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db,
error= 0; error= 0;
err: err:
if (unlikely(error) && ddl_log_state_create)
{
/* Table was never created, so we can ignore the ddl log entry */
ddl_log_complete(ddl_log_state_create);
}
THD_STAGE_INFO(thd, stage_after_create); THD_STAGE_INFO(thd, stage_after_create);
delete file; delete file;
DBUG_PRINT("exit", ("return: %d", error)); DBUG_PRINT("exit", ("return: %d", error));
...@@ -4435,7 +4473,10 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, ...@@ -4435,7 +4473,10 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db,
-1 Table was used with IF NOT EXISTS and table existed (warning, not error) -1 Table was used with IF NOT EXISTS and table existed (warning, not error)
*/ */
int mysql_create_table_no_lock(THD *thd, const LEX_CSTRING *db, int mysql_create_table_no_lock(THD *thd,
DDL_LOG_STATE *ddl_log_state_create,
DDL_LOG_STATE *ddl_log_state_rm,
const LEX_CSTRING *db,
const LEX_CSTRING *table_name, const LEX_CSTRING *table_name,
Table_specification_st *create_info, Table_specification_st *create_info,
Alter_info *alter_info, bool *is_trans, Alter_info *alter_info, bool *is_trans,
...@@ -4444,26 +4485,31 @@ int mysql_create_table_no_lock(THD *thd, const LEX_CSTRING *db, ...@@ -4444,26 +4485,31 @@ int mysql_create_table_no_lock(THD *thd, const LEX_CSTRING *db,
KEY *not_used_1; KEY *not_used_1;
uint not_used_2; uint not_used_2;
int res; int res;
uint path_length;
char path[FN_REFLEN + 1]; char path[FN_REFLEN + 1];
LEX_CSTRING cpath;
LEX_CUSTRING frm= {0,0}; LEX_CUSTRING frm= {0,0};
if (create_info->tmp_table()) if (create_info->tmp_table())
build_tmptable_filename(thd, path, sizeof(path)); path_length= build_tmptable_filename(thd, path, sizeof(path));
else else
{ {
int length;
const LEX_CSTRING *alias= table_case_name(create_info, table_name); const LEX_CSTRING *alias= table_case_name(create_info, table_name);
length= build_table_filename(path, sizeof(path) - 1, db->str, alias->str, "", 0); path_length= build_table_filename(path, sizeof(path) - 1, db->str,
alias->str,
"", 0);
// Check if we hit FN_REFLEN bytes along with file extension. // Check if we hit FN_REFLEN bytes along with file extension.
if (length+reg_ext_length > FN_REFLEN) if (path_length+reg_ext_length > FN_REFLEN)
{ {
my_error(ER_IDENT_CAUSES_TOO_LONG_PATH, MYF(0), (int) sizeof(path)-1, my_error(ER_IDENT_CAUSES_TOO_LONG_PATH, MYF(0), (int) sizeof(path)-1,
path); path);
return true; return true;
} }
} }
lex_string_set3(&cpath, path, path_length);
res= create_table_impl(thd, *db, *table_name, *db, *table_name, path, res= create_table_impl(thd, ddl_log_state_create, ddl_log_state_rm,
*db, *table_name, *db, *table_name, cpath,
*create_info, create_info, *create_info, create_info,
alter_info, create_table_mode, alter_info, create_table_mode,
is_trans, &not_used_1, &not_used_2, &frm); is_trans, &not_used_1, &not_used_2, &frm);
...@@ -4516,17 +4562,22 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, ...@@ -4516,17 +4562,22 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
Table_specification_st *create_info, Table_specification_st *create_info,
Alter_info *alter_info) Alter_info *alter_info)
{ {
bool is_trans= FALSE;
bool result;
int create_table_mode;
TABLE_LIST *pos_in_locked_tables= 0; TABLE_LIST *pos_in_locked_tables= 0;
MDL_ticket *mdl_ticket= 0; MDL_ticket *mdl_ticket= 0;
DDL_LOG_STATE ddl_log_state_create, ddl_log_state_rm;
int create_table_mode;
uint save_thd_create_info_options;
bool is_trans= FALSE;
bool result;
DBUG_ENTER("mysql_create_table"); DBUG_ENTER("mysql_create_table");
DBUG_ASSERT(create_table == thd->lex->query_tables); DBUG_ASSERT(create_table == thd->lex->query_tables);
bzero(&ddl_log_state_create, sizeof(ddl_log_state_create));
bzero(&ddl_log_state_rm, sizeof(ddl_log_state_rm));
/* Copy temporarily the statement flags to thd for lock_table_names() */ /* Copy temporarily the statement flags to thd for lock_table_names() */
uint save_thd_create_info_options= thd->lex->create_info.options; save_thd_create_info_options= thd->lex->create_info.options;
thd->lex->create_info.options|= create_info->options; thd->lex->create_info.options|= create_info->options;
/* Open or obtain an exclusive metadata lock on table being created */ /* Open or obtain an exclusive metadata lock on table being created */
...@@ -4569,7 +4620,8 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, ...@@ -4569,7 +4620,8 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
/* We can abort create table for any table type */ /* We can abort create table for any table type */
thd->abort_on_warning= thd->is_strict_mode(); thd->abort_on_warning= thd->is_strict_mode();
if (mysql_create_table_no_lock(thd, &create_table->db, if (mysql_create_table_no_lock(thd, &ddl_log_state_create, &ddl_log_state_rm,
&create_table->db,
&create_table->table_name, create_info, &create_table->table_name, create_info,
alter_info, alter_info,
&is_trans, create_table_mode, &is_trans, create_table_mode,
...@@ -4641,10 +4693,19 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, ...@@ -4641,10 +4693,19 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
*/ */
create_info->table->s->table_creation_was_logged= 1; 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())
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(), if (unlikely(write_bin_log(thd, result ? FALSE : TRUE, thd->query(),
thd->query_length(), is_trans))) thd->query_length(), is_trans)))
result= 1; result= 1;
debug_crash_here("ddl_log_create_after_binlog");
thd->binlog_xid= 0;
} }
ddl_log_complete(&ddl_log_state_rm);
ddl_log_complete(&ddl_log_state_create);
DBUG_RETURN(result); DBUG_RETURN(result);
} }
...@@ -4921,7 +4982,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, ...@@ -4921,7 +4982,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
Table_specification_st local_create_info; Table_specification_st local_create_info;
TABLE_LIST *pos_in_locked_tables= 0; TABLE_LIST *pos_in_locked_tables= 0;
Alter_info local_alter_info; Alter_info local_alter_info;
Alter_table_ctx local_alter_ctx; // Not used Alter_table_ctx local_alter_ctx; // Not used
DDL_LOG_STATE ddl_log_state_create, ddl_log_state_rm;
int res= 1; int res= 1;
bool is_trans= FALSE; bool is_trans= FALSE;
bool do_logging= FALSE; bool do_logging= FALSE;
...@@ -4930,6 +4992,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, ...@@ -4930,6 +4992,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
int create_res; int create_res;
DBUG_ENTER("mysql_create_like_table"); 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));
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (WSREP(thd) && !thd->wsrep_applier && if (WSREP(thd) && !thd->wsrep_applier &&
wsrep_create_like_table(thd, table, src_table, create_info)) wsrep_create_like_table(thd, table, src_table, create_info))
...@@ -5023,7 +5088,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, ...@@ -5023,7 +5088,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* 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;
res= ((create_res= res= ((create_res=
mysql_create_table_no_lock(thd, &table->db, &table->table_name, mysql_create_table_no_lock(thd,
&ddl_log_state_create, &ddl_log_state_rm,
&table->db, &table->table_name,
&local_create_info, &local_alter_info, &local_create_info, &local_alter_info,
&is_trans, C_ORDINARY_CREATE, &is_trans, C_ORDINARY_CREATE,
table)) > 0); table)) > 0);
...@@ -5240,22 +5307,33 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, ...@@ -5240,22 +5307,33 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
err: err:
if (do_logging) 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())
ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid);
debug_crash_here("ddl_log_create_before_binlog");
if (res && create_info->table_was_deleted) if (res && create_info->table_was_deleted)
{ {
/* /*
Table was not deleted. Original table was deleted. Table was not deleted. Original table was deleted.
We have to log it. We have to log it.
*/ */
log_drop_table(thd, &table->db, &table->table_name, create_info->tmp_table()); DBUG_ASSERT(ddl_log_state_rm.is_active());
log_drop_table(thd, &table->db, &table->table_name,
create_info->tmp_table());
} }
else if (res != 2) // Table was not dropped else if (res != 2) // Table was not dropped
{ {
if (write_bin_log(thd, res ? FALSE : TRUE, thd->query(), if (write_bin_log(thd, res ? FALSE : TRUE, thd->query(),
thd->query_length(), is_trans)) thd->query_length(), is_trans))
res= 1; res= 1;
} }
debug_crash_here("ddl_log_create_after_binlog");
thd->binlog_xid= 0;
} }
ddl_log_complete(&ddl_log_state_rm);
ddl_log_complete(&ddl_log_state_create);
DBUG_RETURN(res != 0); DBUG_RETURN(res != 0);
} }
...@@ -9662,9 +9740,10 @@ do_continue:; ...@@ -9662,9 +9740,10 @@ do_continue:;
tmp_disable_binlog(thd); tmp_disable_binlog(thd);
create_info->options|=HA_CREATE_TMP_ALTER; create_info->options|=HA_CREATE_TMP_ALTER;
create_info->alias= alter_ctx.table_name; create_info->alias= alter_ctx.table_name;
error= create_table_impl(thd, alter_ctx.db, alter_ctx.table_name, error= create_table_impl(thd, (DDL_LOG_STATE*) 0, (DDL_LOG_STATE*) 0,
alter_ctx.db, alter_ctx.table_name,
alter_ctx.new_db, alter_ctx.tmp_name, alter_ctx.new_db, alter_ctx.tmp_name,
alter_ctx.get_tmp_path(), alter_ctx.get_tmp_cstring_path(),
thd->lex->create_info, create_info, alter_info, thd->lex->create_info, create_info, alter_info,
C_ALTER_TABLE_FRM_ONLY, NULL, C_ALTER_TABLE_FRM_ONLY, NULL,
&key_info, &key_count, &frm); &key_info, &key_count, &frm);
......
...@@ -125,7 +125,10 @@ bool add_keyword_to_query(THD *thd, String *result, const LEX_CSTRING *keyword, ...@@ -125,7 +125,10 @@ bool add_keyword_to_query(THD *thd, String *result, const LEX_CSTRING *keyword,
#define C_ALTER_TABLE_FRM_ONLY -2 #define C_ALTER_TABLE_FRM_ONLY -2
#define C_ASSISTED_DISCOVERY -3 #define C_ASSISTED_DISCOVERY -3
int mysql_create_table_no_lock(THD *thd, const LEX_CSTRING *db, int mysql_create_table_no_lock(THD *thd,
DDL_LOG_STATE *ddl_log_state,
DDL_LOG_STATE *ddl_log_state_rm,
const LEX_CSTRING *db,
const LEX_CSTRING *table_name, const LEX_CSTRING *table_name,
Table_specification_st *create_info, Table_specification_st *create_info,
Alter_info *alter_info, bool *is_trans, Alter_info *alter_info, bool *is_trans,
......
...@@ -45,6 +45,7 @@ C_MODE_END ...@@ -45,6 +45,7 @@ C_MODE_END
#include "key.h" #include "key.h"
#include "log.h" #include "log.h"
#include "sql_parse.h" #include "sql_parse.h"
#include "debug_sync.h"
/* /*
Note that in future versions, only *transactional* Maria tables can Note that in future versions, only *transactional* Maria tables can
...@@ -996,6 +997,13 @@ my_bool ma_killed_in_mariadb(MARIA_HA *info) ...@@ -996,6 +997,13 @@ my_bool ma_killed_in_mariadb(MARIA_HA *info)
return (((TABLE*) (info->external_ref))->in_use->killed != 0); return (((TABLE*) (info->external_ref))->in_use->killed != 0);
} }
void maria_debug_crash_here(const char *keyword)
{
#ifndef DBUG_OFF
debug_crash_here(keyword);
#endif /* DBUG_OFF */
}
} /* extern "C" */ } /* extern "C" */
/** /**
...@@ -3794,6 +3802,7 @@ static int ha_maria_init(void *p) ...@@ -3794,6 +3802,7 @@ static int ha_maria_init(void *p)
HTON_TRANSACTIONAL_AND_NON_TRANSACTIONAL); HTON_TRANSACTIONAL_AND_NON_TRANSACTIONAL);
bzero(maria_log_pagecache, sizeof(*maria_log_pagecache)); bzero(maria_log_pagecache, sizeof(*maria_log_pagecache));
maria_tmpdir= &mysql_tmpdir_list; /* For REDO */ maria_tmpdir= &mysql_tmpdir_list; /* For REDO */
ma_debug_crash_here= maria_debug_crash_here;
if (!aria_readonly) if (!aria_readonly)
res= maria_upgrade(); res= maria_upgrade();
......
...@@ -1215,6 +1215,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, ...@@ -1215,6 +1215,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
MY_UNPACK_FILENAME | MY_APPEND_EXT); MY_UNPACK_FILENAME | MY_APPEND_EXT);
create_flag= (flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD; create_flag= (flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
} }
ma_debug_crash_here("storage_engine_middle_of_create");
if ((dfile= if ((dfile=
mysql_file_create_with_symlink(key_file_dfile, dlinkname_ptr, mysql_file_create_with_symlink(key_file_dfile, dlinkname_ptr,
dfilename, 0, create_mode, dfilename, 0, create_mode,
......
...@@ -66,6 +66,9 @@ const char *maria_data_root; ...@@ -66,6 +66,9 @@ const char *maria_data_root;
HASH maria_stored_state; HASH maria_stored_state;
int (*maria_create_trn_hook)(MARIA_HA *); int (*maria_create_trn_hook)(MARIA_HA *);
void dummy_crash(const char *keyword __attribute__((unused))) {}
void (*ma_debug_crash_here)(const char *keyword)= dummy_crash;
/** /**
@brief when transactionality does not matter we can use this transaction @brief when transactionality does not matter we can use this transaction
......
...@@ -1247,6 +1247,7 @@ extern ulong maria_checkpoint_min_log_activity; ...@@ -1247,6 +1247,7 @@ extern ulong maria_checkpoint_min_log_activity;
extern HASH maria_stored_state; extern HASH maria_stored_state;
extern int (*maria_create_trn_hook)(MARIA_HA *); extern int (*maria_create_trn_hook)(MARIA_HA *);
extern my_bool (*ma_killed)(MARIA_HA *); extern my_bool (*ma_killed)(MARIA_HA *);
extern void (*ma_debug_crash_here)(const char *keyword);
#ifdef HAVE_PSI_INTERFACE #ifdef HAVE_PSI_INTERFACE
extern PSI_mutex_key key_SHARE_BITMAP_lock, key_SORT_INFO_mutex, extern PSI_mutex_key key_SHARE_BITMAP_lock, key_SORT_INFO_mutex,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment