diff --git a/mysql-test/main/drop_table_force.result b/mysql-test/main/drop_table_force.result index 622589eb3b940..404d8be8b2163 100644 --- a/mysql-test/main/drop_table_force.result +++ b/mysql-test/main/drop_table_force.result @@ -77,7 +77,6 @@ drop table t1; ERROR 42S02: Unknown table 'test.t1' show warnings; Level Code Message -Error 29 File './test/t1.MAD' not found (Errcode: 2 "No such file or directory") Error 1051 Unknown table 'test.t1' db.opt create table t2(a int) engine=aria; diff --git a/mysql-test/main/mysqlbinlog_row_compressed.result b/mysql-test/main/mysqlbinlog_row_compressed.result index c85daa4a9f554..210f39ffa2206 100644 --- a/mysql-test/main/mysqlbinlog_row_compressed.result +++ b/mysql-test/main/mysqlbinlog_row_compressed.result @@ -29,7 +29,7 @@ ROLLBACK/*!*/; /*!100001 SET @@session.server_id=1*//*!*/; /*!100001 SET @@session.gtid_seq_no=1*//*!*/; # at 371 -# server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# server id 1 end_log_pos 542 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; @@ -42,26 +42,26 @@ SET @@session.lc_time_names=0/*!*/; 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)) /*!*/; -# at 533 -# server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl +# at 542 +# server id 1 end_log_pos 584 CRC32 XXX GTID 0-1-2 ddl /*!100001 SET @@session.gtid_seq_no=2*//*!*/; -# at 575 -# server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at 584 +# server id 1 end_log_pos 745 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= 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)) /*!*/; -# at 727 -# server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3 +# at 745 +# server id 1 end_log_pos 787 CRC32 XXX GTID 0-1-3 /*!100001 SET @@session.gtid_seq_no=3*//*!*/; START TRANSACTION /*!*/; -# at 769 -# at 843 -# server id 1 end_log_pos 843 CRC32 XXX Annotate_rows: +# at 787 +# at 861 +# server id 1 end_log_pos 861 CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") -# server id 1 end_log_pos 899 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 899 -# server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos 917 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 917 +# server id 1 end_log_pos 985 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -74,23 +74,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 967 -# server id 1 end_log_pos 1040 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 985 +# server id 1 end_log_pos 1058 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1040 -# server id 1 end_log_pos 1082 CRC32 XXX GTID 0-1-4 +# at 1058 +# server id 1 end_log_pos 1100 CRC32 XXX GTID 0-1-4 /*!100001 SET @@session.gtid_seq_no=4*//*!*/; START TRANSACTION /*!*/; -# at 1082 -# at 1158 -# server id 1 end_log_pos 1158 CRC32 XXX Annotate_rows: +# at 1100 +# at 1176 +# 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) -# server id 1 end_log_pos 1214 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1214 -# server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos 1232 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1232 +# server id 1 end_log_pos 1299 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -103,23 +103,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ # Number of rows: 1 -# at 1281 -# server id 1 end_log_pos 1354 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 1299 +# server id 1 end_log_pos 1372 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1354 -# server id 1 end_log_pos 1396 CRC32 XXX GTID 0-1-5 +# at 1372 +# server id 1 end_log_pos 1414 CRC32 XXX GTID 0-1-5 /*!100001 SET @@session.gtid_seq_no=5*//*!*/; START TRANSACTION /*!*/; -# at 1396 -# at 1474 -# server id 1 end_log_pos 1474 CRC32 XXX Annotate_rows: +# at 1414 +# at 1492 +# 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") -# server id 1 end_log_pos 1530 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1530 -# server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos 1548 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1548 +# server id 1 end_log_pos 1614 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -132,23 +132,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 1596 -# server id 1 end_log_pos 1669 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 1614 +# server id 1 end_log_pos 1687 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1669 -# server id 1 end_log_pos 1711 CRC32 XXX GTID 0-1-6 +# at 1687 +# server id 1 end_log_pos 1729 CRC32 XXX GTID 0-1-6 /*!100001 SET @@session.gtid_seq_no=6*//*!*/; START TRANSACTION /*!*/; -# at 1711 -# at 1786 -# server id 1 end_log_pos 1786 CRC32 XXX Annotate_rows: +# at 1729 +# at 1804 +# 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") -# server id 1 end_log_pos 1842 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1842 -# server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos 1860 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1860 +# server id 1 end_log_pos 1927 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -161,23 +161,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 1909 -# server id 1 end_log_pos 1982 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 1927 +# server id 1 end_log_pos 2000 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1982 -# server id 1 end_log_pos 2024 CRC32 XXX GTID 0-1-7 +# at 2000 +# server id 1 end_log_pos 2042 CRC32 XXX GTID 0-1-7 /*!100001 SET @@session.gtid_seq_no=7*//*!*/; START TRANSACTION /*!*/; -# at 2024 -# at 2078 -# server id 1 end_log_pos 2078 CRC32 XXX Annotate_rows: +# at 2042 +# at 2096 +# server id 1 end_log_pos 2096 CRC32 XXX Annotate_rows: #Q> INSERT INTO t2 SELECT * FROM t1 -# server id 1 end_log_pos 2134 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 2134 -# server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos 2152 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 2152 +# server id 1 end_log_pos 2243 CRC32 XXX Write_compressed_rows: table id 33 flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -223,23 +223,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 4 -# at 2225 -# server id 1 end_log_pos 2298 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 2243 +# server id 1 end_log_pos 2316 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2298 -# server id 1 end_log_pos 2340 CRC32 XXX GTID 0-1-8 +# at 2316 +# server id 1 end_log_pos 2358 CRC32 XXX GTID 0-1-8 /*!100001 SET @@session.gtid_seq_no=8*//*!*/; START TRANSACTION /*!*/; -# at 2340 -# at 2406 -# server id 1 end_log_pos 2406 CRC32 XXX Annotate_rows: +# at 2358 +# at 2424 +# server id 1 end_log_pos 2424 CRC32 XXX Annotate_rows: #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL -# server id 1 end_log_pos 2462 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 2462 -# server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos 2480 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 2480 +# server id 1 end_log_pos 2579 CRC32 XXX Update_compressed_rows: table id 33 flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -304,23 +304,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 3 -# at 2561 -# server id 1 end_log_pos 2634 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 2579 +# server id 1 end_log_pos 2652 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2634 -# server id 1 end_log_pos 2676 CRC32 XXX GTID 0-1-9 +# at 2652 +# server id 1 end_log_pos 2694 CRC32 XXX GTID 0-1-9 /*!100001 SET @@session.gtid_seq_no=9*//*!*/; START TRANSACTION /*!*/; -# at 2676 -# at 2713 -# server id 1 end_log_pos 2713 CRC32 XXX Annotate_rows: +# at 2694 +# at 2731 +# server id 1 end_log_pos 2731 CRC32 XXX Annotate_rows: #Q> DELETE FROM t1 -# server id 1 end_log_pos 2769 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 2769 -# server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos 2787 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 2787 +# server id 1 end_log_pos 2879 CRC32 XXX Delete_compressed_rows: table id 32 flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -366,23 +366,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 4 -# at 2861 -# server id 1 end_log_pos 2934 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 2879 +# server id 1 end_log_pos 2952 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2934 -# server id 1 end_log_pos 2976 CRC32 XXX GTID 0-1-10 +# at 2952 +# server id 1 end_log_pos 2994 CRC32 XXX GTID 0-1-10 /*!100001 SET @@session.gtid_seq_no=10*//*!*/; START TRANSACTION /*!*/; -# at 2976 -# at 3013 -# server id 1 end_log_pos 3013 CRC32 XXX Annotate_rows: +# at 2994 +# at 3031 +# server id 1 end_log_pos 3031 CRC32 XXX Annotate_rows: #Q> DELETE FROM t2 -# server id 1 end_log_pos 3069 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 3069 -# server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos 3087 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 3087 +# server id 1 end_log_pos 3172 CRC32 XXX Delete_compressed_rows: table id 33 flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -428,13 +428,13 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 4 -# at 3154 -# server id 1 end_log_pos 3227 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 3172 +# server id 1 end_log_pos 3245 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 3227 -# server id 1 end_log_pos 3275 CRC32 XXX Rotate to master-bin.000002 pos: 4 +# at 3245 +# server id 1 end_log_pos 3293 CRC32 XXX Rotate to master-bin.000002 pos: 4 DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/main/mysqlbinlog_row_minimal.result b/mysql-test/main/mysqlbinlog_row_minimal.result index 464936a53140a..adefdde9d04c6 100644 --- a/mysql-test/main/mysqlbinlog_row_minimal.result +++ b/mysql-test/main/mysqlbinlog_row_minimal.result @@ -27,7 +27,7 @@ ROLLBACK/*!*/; /*!100001 SET @@session.server_id=1*//*!*/; /*!100001 SET @@session.gtid_seq_no=1*//*!*/; # at 371 -# server id 1 end_log_pos 555 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# server id 1 end_log_pos 564 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; @@ -40,26 +40,26 @@ SET @@session.lc_time_names=0/*!*/; 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)) /*!*/; -# at 555 -# server id 1 end_log_pos 597 CRC32 XXX GTID 0-1-2 ddl +# at 564 +# server id 1 end_log_pos 606 CRC32 XXX GTID 0-1-2 ddl /*!100001 SET @@session.gtid_seq_no=2*//*!*/; -# at 597 -# server id 1 end_log_pos 774 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 606 +# server id 1 end_log_pos 792 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= 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)) /*!*/; -# at 774 -# server id 1 end_log_pos 816 CRC32 XXX GTID 0-1-3 +# at 792 +# server id 1 end_log_pos 834 CRC32 XXX GTID 0-1-3 /*!100001 SET @@session.gtid_seq_no=3*//*!*/; START TRANSACTION /*!*/; -# at 816 -# at 890 -# server id 1 end_log_pos 890 CRC32 XXX Annotate_rows: +# at 834 +# at 908 +# server id 1 end_log_pos 908 CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") -# server id 1 end_log_pos 946 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 946 -# server id 1 end_log_pos 1015 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos 964 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 964 +# server id 1 end_log_pos 1033 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -72,23 +72,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 1015 -# server id 1 end_log_pos 1088 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 1033 +# server id 1 end_log_pos 1106 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1088 -# server id 1 end_log_pos 1130 CRC32 XXX GTID 0-1-4 +# at 1106 +# server id 1 end_log_pos 1148 CRC32 XXX GTID 0-1-4 /*!100001 SET @@session.gtid_seq_no=4*//*!*/; START TRANSACTION /*!*/; -# at 1130 -# at 1206 -# server id 1 end_log_pos 1206 CRC32 XXX Annotate_rows: +# at 1148 +# at 1224 +# 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) -# server id 1 end_log_pos 1262 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1262 -# server id 1 end_log_pos 1330 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos 1280 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1280 +# server id 1 end_log_pos 1348 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -101,23 +101,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ # Number of rows: 1 -# at 1330 -# server id 1 end_log_pos 1403 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 1348 +# server id 1 end_log_pos 1421 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1403 -# server id 1 end_log_pos 1445 CRC32 XXX GTID 0-1-5 +# at 1421 +# server id 1 end_log_pos 1463 CRC32 XXX GTID 0-1-5 /*!100001 SET @@session.gtid_seq_no=5*//*!*/; START TRANSACTION /*!*/; -# at 1445 -# at 1523 -# server id 1 end_log_pos 1523 CRC32 XXX Annotate_rows: +# at 1463 +# at 1541 +# 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") -# server id 1 end_log_pos 1579 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1579 -# server id 1 end_log_pos 1646 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos 1597 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1597 +# server id 1 end_log_pos 1664 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -130,23 +130,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 1646 -# server id 1 end_log_pos 1719 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 1664 +# server id 1 end_log_pos 1737 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1719 -# server id 1 end_log_pos 1761 CRC32 XXX GTID 0-1-6 +# at 1737 +# server id 1 end_log_pos 1779 CRC32 XXX GTID 0-1-6 /*!100001 SET @@session.gtid_seq_no=6*//*!*/; START TRANSACTION /*!*/; -# at 1761 -# at 1836 -# server id 1 end_log_pos 1836 CRC32 XXX Annotate_rows: +# at 1779 +# at 1854 +# 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") -# server id 1 end_log_pos 1892 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1892 -# server id 1 end_log_pos 1962 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos 1910 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 1910 +# server id 1 end_log_pos 1980 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -159,23 +159,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 1962 -# server id 1 end_log_pos 2035 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 1980 +# server id 1 end_log_pos 2053 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2035 -# server id 1 end_log_pos 2077 CRC32 XXX GTID 0-1-7 +# at 2053 +# server id 1 end_log_pos 2095 CRC32 XXX GTID 0-1-7 /*!100001 SET @@session.gtid_seq_no=7*//*!*/; START TRANSACTION /*!*/; -# at 2077 -# at 2131 -# server id 1 end_log_pos 2131 CRC32 XXX Annotate_rows: +# at 2095 +# at 2149 +# server id 1 end_log_pos 2149 CRC32 XXX Annotate_rows: #Q> INSERT INTO t2 SELECT * FROM t1 -# server id 1 end_log_pos 2187 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 2187 -# server id 1 end_log_pos 2354 CRC32 XXX Write_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos 2205 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 2205 +# server id 1 end_log_pos 2372 CRC32 XXX Write_rows: table id 33 flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -221,23 +221,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 4 -# at 2354 -# server id 1 end_log_pos 2427 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 2372 +# server id 1 end_log_pos 2445 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2427 -# server id 1 end_log_pos 2469 CRC32 XXX GTID 0-1-8 +# at 2445 +# server id 1 end_log_pos 2487 CRC32 XXX GTID 0-1-8 /*!100001 SET @@session.gtid_seq_no=8*//*!*/; START TRANSACTION /*!*/; -# at 2469 -# at 2535 -# server id 1 end_log_pos 2535 CRC32 XXX Annotate_rows: +# at 2487 +# at 2553 +# server id 1 end_log_pos 2553 CRC32 XXX Annotate_rows: #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL -# server id 1 end_log_pos 2591 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 2591 -# server id 1 end_log_pos 2657 CRC32 XXX Update_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos 2609 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 2609 +# server id 1 end_log_pos 2675 CRC32 XXX Update_rows: table id 33 flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -254,23 +254,23 @@ START TRANSACTION ### SET ### @5=5 /* INT meta=0 nullable=1 is_null=0 */ # Number of rows: 3 -# at 2657 -# server id 1 end_log_pos 2730 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 2675 +# server id 1 end_log_pos 2748 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2730 -# server id 1 end_log_pos 2772 CRC32 XXX GTID 0-1-9 +# at 2748 +# server id 1 end_log_pos 2790 CRC32 XXX GTID 0-1-9 /*!100001 SET @@session.gtid_seq_no=9*//*!*/; START TRANSACTION /*!*/; -# at 2772 -# at 2809 -# server id 1 end_log_pos 2809 CRC32 XXX Annotate_rows: +# at 2790 +# at 2827 +# server id 1 end_log_pos 2827 CRC32 XXX Annotate_rows: #Q> DELETE FROM t1 -# server id 1 end_log_pos 2865 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 2865 -# server id 1 end_log_pos 2919 CRC32 XXX Delete_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos 2883 CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at 2883 +# server id 1 end_log_pos 2937 CRC32 XXX Delete_rows: table id 32 flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -284,23 +284,23 @@ START TRANSACTION ### WHERE ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ # Number of rows: 4 -# at 2919 -# server id 1 end_log_pos 2992 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 2937 +# server id 1 end_log_pos 3010 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2992 -# server id 1 end_log_pos 3034 CRC32 XXX GTID 0-1-10 +# at 3010 +# server id 1 end_log_pos 3052 CRC32 XXX GTID 0-1-10 /*!100001 SET @@session.gtid_seq_no=10*//*!*/; START TRANSACTION /*!*/; -# at 3034 -# at 3071 -# server id 1 end_log_pos 3071 CRC32 XXX Annotate_rows: +# at 3052 +# at 3089 +# server id 1 end_log_pos 3089 CRC32 XXX Annotate_rows: #Q> DELETE FROM t2 -# server id 1 end_log_pos 3127 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 3127 -# server id 1 end_log_pos 3181 CRC32 XXX Delete_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos 3145 CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at 3145 +# server id 1 end_log_pos 3199 CRC32 XXX Delete_rows: table id 33 flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -314,13 +314,13 @@ START TRANSACTION ### WHERE ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ # Number of rows: 4 -# at 3181 -# server id 1 end_log_pos 3254 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 3199 +# server id 1 end_log_pos 3272 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 3254 -# server id 1 end_log_pos 3302 CRC32 XXX Rotate to master-bin.000002 pos: 4 +# at 3272 +# server id 1 end_log_pos 3320 CRC32 XXX Rotate to master-bin.000002 pos: 4 DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/main/mysqlbinlog_stmt_compressed.result b/mysql-test/main/mysqlbinlog_stmt_compressed.result index 0f05b6a635353..e922978b47dcc 100644 --- a/mysql-test/main/mysqlbinlog_stmt_compressed.result +++ b/mysql-test/main/mysqlbinlog_stmt_compressed.result @@ -29,7 +29,7 @@ ROLLBACK/*!*/; /*!100001 SET @@session.server_id=1*//*!*/; /*!100001 SET @@session.gtid_seq_no=1*//*!*/; # at 371 -# server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# server id 1 end_log_pos 542 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; @@ -42,136 +42,136 @@ SET @@session.lc_time_names=0/*!*/; 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)) /*!*/; -# at 533 -# server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl +# at 542 +# server id 1 end_log_pos 584 CRC32 XXX GTID 0-1-2 ddl /*!100001 SET @@session.gtid_seq_no=2*//*!*/; -# at 575 -# server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at 584 +# server id 1 end_log_pos 745 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= 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)) /*!*/; -# at 727 -# server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3 +# at 745 +# server id 1 end_log_pos 787 CRC32 XXX GTID 0-1-3 /*!100001 SET @@session.gtid_seq_no=3*//*!*/; START TRANSACTION /*!*/; -# at 769 -# server id 1 end_log_pos 897 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at 787 +# server id 1 end_log_pos 915 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") /*!*/; -# at 897 -# server id 1 end_log_pos 970 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 915 +# server id 1 end_log_pos 988 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 970 -# server id 1 end_log_pos 1012 CRC32 XXX GTID 0-1-4 +# at 988 +# server id 1 end_log_pos 1030 CRC32 XXX GTID 0-1-4 /*!100001 SET @@session.gtid_seq_no=4*//*!*/; START TRANSACTION /*!*/; -# at 1012 -# server id 1 end_log_pos 1140 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at 1030 +# server id 1 end_log_pos 1158 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) /*!*/; -# at 1140 -# server id 1 end_log_pos 1213 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 1158 +# server id 1 end_log_pos 1231 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1213 -# server id 1 end_log_pos 1255 CRC32 XXX GTID 0-1-5 +# at 1231 +# server id 1 end_log_pos 1273 CRC32 XXX GTID 0-1-5 /*!100001 SET @@session.gtid_seq_no=5*//*!*/; START TRANSACTION /*!*/; -# at 1255 -# server id 1 end_log_pos 1385 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at 1273 +# server id 1 end_log_pos 1403 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") /*!*/; -# at 1385 -# server id 1 end_log_pos 1458 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 1403 +# server id 1 end_log_pos 1476 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1458 -# server id 1 end_log_pos 1500 CRC32 XXX GTID 0-1-6 +# at 1476 +# server id 1 end_log_pos 1518 CRC32 XXX GTID 0-1-6 /*!100001 SET @@session.gtid_seq_no=6*//*!*/; START TRANSACTION /*!*/; -# at 1500 -# server id 1 end_log_pos 1627 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at 1518 +# server id 1 end_log_pos 1645 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") /*!*/; -# at 1627 -# server id 1 end_log_pos 1700 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 1645 +# server id 1 end_log_pos 1718 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1700 -# server id 1 end_log_pos 1742 CRC32 XXX GTID 0-1-7 +# at 1718 +# server id 1 end_log_pos 1760 CRC32 XXX GTID 0-1-7 /*!100001 SET @@session.gtid_seq_no=7*//*!*/; START TRANSACTION /*!*/; -# at 1742 -# server id 1 end_log_pos 1850 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at 1760 +# server id 1 end_log_pos 1868 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; INSERT INTO t2 SELECT * FROM t1 /*!*/; -# at 1850 -# server id 1 end_log_pos 1923 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 1868 +# server id 1 end_log_pos 1941 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1923 -# server id 1 end_log_pos 1965 CRC32 XXX GTID 0-1-8 +# at 1941 +# server id 1 end_log_pos 1983 CRC32 XXX GTID 0-1-8 /*!100001 SET @@session.gtid_seq_no=8*//*!*/; START TRANSACTION /*!*/; -# at 1965 -# server id 1 end_log_pos 2082 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at 1983 +# server id 1 end_log_pos 2100 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL /*!*/; -# at 2082 -# server id 1 end_log_pos 2155 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 2100 +# server id 1 end_log_pos 2173 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2155 -# server id 1 end_log_pos 2197 CRC32 XXX GTID 0-1-9 +# at 2173 +# server id 1 end_log_pos 2215 CRC32 XXX GTID 0-1-9 /*!100001 SET @@session.gtid_seq_no=9*//*!*/; START TRANSACTION /*!*/; -# at 2197 -# server id 1 end_log_pos 2288 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at 2215 +# server id 1 end_log_pos 2306 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; DELETE FROM t1 /*!*/; -# at 2288 -# server id 1 end_log_pos 2361 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 2306 +# server id 1 end_log_pos 2379 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2361 -# server id 1 end_log_pos 2403 CRC32 XXX GTID 0-1-10 +# at 2379 +# server id 1 end_log_pos 2421 CRC32 XXX GTID 0-1-10 /*!100001 SET @@session.gtid_seq_no=10*//*!*/; START TRANSACTION /*!*/; -# at 2403 -# server id 1 end_log_pos 2494 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= +# at 2421 +# server id 1 end_log_pos 2512 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; DELETE FROM t2 /*!*/; -# at 2494 -# server id 1 end_log_pos 2567 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= +# at 2512 +# server id 1 end_log_pos 2585 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 xid= SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2567 -# server id 1 end_log_pos 2615 CRC32 XXX Rotate to master-bin.000002 pos: 4 +# at 2585 +# server id 1 end_log_pos 2633 CRC32 XXX Rotate to master-bin.000002 pos: 4 DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/main/mysqldump-max.test b/mysql-test/main/mysqldump-max.test index 49e54d542b8a0..e85490b7352e0 100644 --- a/mysql-test/main/mysqldump-max.test +++ b/mysql-test/main/mysqldump-max.test @@ -1194,7 +1194,7 @@ source include/binlog_start_pos.inc; let _BINLOG_START_POS= $binlog_start_pos; --perl 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"; while () { s/$pos//; diff --git a/mysql-test/suite/atomic/create_table.result b/mysql-test/suite/atomic/create_table.result new file mode 100644 index 0000000000000..acc78c76d254c --- /dev/null +++ b/mysql-test/suite/atomic/create_table.result @@ -0,0 +1,537 @@ +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' diff --git a/mysql-test/suite/atomic/create_table.test b/mysql-test/suite/atomic/create_table.test new file mode 100644 index 0000000000000..fc4413dadbc8c --- /dev/null +++ b/mysql-test/suite/atomic/create_table.test @@ -0,0 +1,130 @@ +--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 diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test index f5b7e2c01d60d..d064a0aad23f9 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test @@ -58,20 +58,20 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --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/ --exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --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/ --exec $MYSQL_BINLOG --short-form --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start and stop positions ---" as ""; --enable_query_log -let $start_pos= `select @binlog_start_pos + 696`; -let $stop_pos= `select @binlog_start_pos + 857`; +let $start_pos= `select @binlog_start_pos + 705`; +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/ --exec $MYSQL_BINLOG --short-form --start-position=$start_pos --stop-position=$stop_pos $MYSQLD_DATADIR/master-bin.000001 --disable_query_log @@ -103,7 +103,7 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --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/ --exec $MYSQL_BINLOG --short-form --start-position=$start_pos $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log @@ -138,19 +138,19 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --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/ --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 select "--- stop-position --" as ""; --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/ --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 select "--- start and stop positions ---" as ""; --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`; --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 @@ -180,7 +180,7 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --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/ --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 diff --git a/mysql-test/suite/galera_sr/r/MDEV-18585.result b/mysql-test/suite/galera_sr/r/MDEV-18585.result index d30def1ea6345..44c3637506b5f 100644 --- a/mysql-test/suite/galera_sr/r/MDEV-18585.result +++ b/mysql-test/suite/galera_sr/r/MDEV-18585.result @@ -12,25 +12,25 @@ SET SESSION wsrep_trx_fragment_size=1; INSERT INTO t1 VALUES (5), (6); SET SESSION wsrep_trx_fragment_unit=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 -mysqld-bin.000002 518 Gtid 1 560 BEGIN GTID 0-1-2 -mysqld-bin.000002 560 Annotate_rows 1 613 INSERT INTO t1 VALUES (1), (2) -mysqld-bin.000002 613 Table_map 1 658 table_id: # (test.t1) -mysqld-bin.000002 658 Write_rows_v1 1 696 table_id: # flags: STMT_END_F -mysqld-bin.000002 696 Table_map 1 741 table_id: # (test.t1) -mysqld-bin.000002 741 Write_rows_v1 1 779 table_id: # flags: STMT_END_F -mysqld-bin.000002 779 Xid 1 810 COMMIT /* xid=# */ -mysqld-bin.000002 810 Gtid 1 852 BEGIN GTID 0-1-3 -mysqld-bin.000002 852 Annotate_rows 1 905 INSERT INTO t1 VALUES (3), (4) -mysqld-bin.000002 905 Table_map 1 950 table_id: # (test.t1) -mysqld-bin.000002 950 Write_rows_v1 1 988 table_id: # flags: STMT_END_F -mysqld-bin.000002 988 Table_map 1 1033 table_id: # (test.t1) -mysqld-bin.000002 1033 Write_rows_v1 1 1071 table_id: # flags: STMT_END_F -mysqld-bin.000002 1071 Xid 1 1102 COMMIT /* xid=# */ -mysqld-bin.000002 1102 Gtid 1 1144 BEGIN GTID 0-1-4 -mysqld-bin.000002 1144 Annotate_rows 1 1197 INSERT INTO t1 VALUES (5), (6) -mysqld-bin.000002 1197 Table_map 1 1242 table_id: # (test.t1) -mysqld-bin.000002 1242 Write_rows_v1 1 1285 table_id: # flags: STMT_END_F -mysqld-bin.000002 1285 Xid 1 1316 COMMIT /* xid=# */ +mysqld-bin.000002 # Gtid 1 # BEGIN GTID 0-1-2 +mysqld-bin.000002 # Annotate_rows 1 # INSERT INTO t1 VALUES (1), (2) +mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1) +mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F +mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1) +mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F +mysqld-bin.000002 # Xid 1 # COMMIT /* xid=# */ +mysqld-bin.000002 # Gtid 1 # BEGIN GTID 0-1-3 +mysqld-bin.000002 # Annotate_rows 1 # INSERT INTO t1 VALUES (3), (4) +mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1) +mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F +mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1) +mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F +mysqld-bin.000002 # Xid 1 # COMMIT /* xid=# */ +mysqld-bin.000002 # Gtid 1 # BEGIN GTID 0-1-4 +mysqld-bin.000002 # Annotate_rows 1 # INSERT INTO t1 VALUES (5), (6) +mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1) +mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F +mysqld-bin.000002 # Xid 1 # COMMIT /* xid=# */ DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/MDEV-18585.test b/mysql-test/suite/galera_sr/t/MDEV-18585.test index 18bbbe8f7e070..7535b524a6d8d 100644 --- a/mysql-test/suite/galera_sr/t/MDEV-18585.test +++ b/mysql-test/suite/galera_sr/t/MDEV-18585.test @@ -12,6 +12,8 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY); SET SESSION wsrep_trx_fragment_unit='ROWS'; SET SESSION wsrep_trx_fragment_size=1; +--let $start_pos= query_get_value(SHOW MASTER STATUS, Position, 1) + INSERT INTO t1 VALUES (1), (2); # @@ -37,6 +39,7 @@ SET SESSION wsrep_trx_fragment_unit=default; SET SESSION wsrep_trx_fragment_size=default; --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; diff --git a/mysql-test/suite/innodb/t/binlog_consistent.test b/mysql-test/suite/innodb/t/binlog_consistent.test index 6a1935f80c4df..3b03d2917084e 100644 --- a/mysql-test/suite/innodb/t/binlog_consistent.test +++ b/mysql-test/suite/innodb/t/binlog_consistent.test @@ -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. # So concurrent insert won't happen on the table INSERT INTO t1 VALUES(9, ""); -let pos=`select $binlog_start_pos + 422`; +let pos=`select $binlog_start_pos + 431`; --replace_result $pos SHOW MASTER STATUS; --replace_result $pos @@ -56,10 +56,10 @@ COMMIT; connection default; SELECT * FROM t1 ORDER BY a,b; -let pos=`select $binlog_start_pos + 956`; +let pos=`select $binlog_start_pos + 974`; --replace_result $pos SHOW STATUS LIKE 'binlog_snapshot_%'; -let pos=`select $binlog_start_pos + 1332`; +let pos=`select $binlog_start_pos + 1350`; --replace_result $pos SHOW MASTER STATUS; SELECT * FROM t2 ORDER BY a; @@ -77,7 +77,7 @@ FLUSH LOGS; connection default; SELECT * FROM t1 ORDER BY a,b; -let pos=`select $binlog_start_pos + 956`; +let pos=`select $binlog_start_pos + 974`; --replace_result $pos SHOW STATUS LIKE 'binlog_snapshot_%'; let pos=`select $binlog_start_pos + 131`; diff --git a/mysql-test/suite/innodb/t/group_commit_binlog_pos.test b/mysql-test/suite/innodb/t/group_commit_binlog_pos.test index 801895e825d6c..c2e38d5412d69 100644 --- a/mysql-test/suite/innodb/t/group_commit_binlog_pos.test +++ b/mysql-test/suite/innodb/t/group_commit_binlog_pos.test @@ -97,7 +97,7 @@ SELECT * FROM t1 ORDER BY a; # for the end of the second transaction (as can be checked with # mysqlbinlog). let $MYSQLD_DATADIR= `SELECT @@datadir`; -let pos=`select $binlog_start_pos + 730`; +let pos=`select $binlog_start_pos + 739`; --replace_result $pos --exec sed -ne 's/.*\(InnoDB: Last binlog file .* position.*\)/\1/p' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1 diff --git a/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test index 116bc54441e6d..250f0beeab60c 100644 --- a/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test +++ b/mysql-test/suite/innodb/t/group_commit_binlog_pos_no_optimize_thread.test @@ -98,7 +98,7 @@ SELECT * FROM t1 ORDER BY a; # for the end of the second transaction (as can be checked with # mysqlbinlog). let $MYSQLD_DATADIR= `SELECT @@datadir`; -let pos=`select $binlog_start_pos + 730`; +let pos=`select $binlog_start_pos + 739`; --replace_result $pos --exec sed -ne 's/.*\(InnoDB: Last binlog file .* position.*\)/\1/p' $MYSQLD_DATADIR/../../log/mysqld.1.err | tail -1 SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/suite/multi_source/reset_slave.test b/mysql-test/suite/multi_source/reset_slave.test index d267ecb0cbfad..34b42ae6d6d14 100644 --- a/mysql-test/suite/multi_source/reset_slave.test +++ b/mysql-test/suite/multi_source/reset_slave.test @@ -39,9 +39,10 @@ stop slave 'master1'; --let $datadir = `SELECT @@datadir` -let read_master_log_pos=`select $binlog_start_pos + 599`; -let relay_log_pos=`select 2*$binlog_start_pos + 643`; -let relay_log_space=`select 3*$binlog_start_pos + 705`; +let read_master_log_pos=`select $binlog_start_pos + 608`; +let relay_log_pos=`select 2*$binlog_start_pos + 652`; +let relay_log_space=`select 3*$binlog_start_pos + 714`; + --replace_result $SERVER_MYPORT_1 MYPORT_1 $read_master_log_pos $relay_log_pos $relay_log_space show slave 'master1' status; --list_files $datadir mysqld* diff --git a/mysql-test/suite/sys_vars/r/innodb_fatal_semaphore_wait_threshold.result b/mysql-test/suite/sys_vars/r/innodb_fatal_semaphore_wait_threshold.result index 50fbc1bd83b66..674934af13e30 100644 --- a/mysql-test/suite/sys_vars/r/innodb_fatal_semaphore_wait_threshold.result +++ b/mysql-test/suite/sys_vars/r/innodb_fatal_semaphore_wait_threshold.result @@ -9,6 +9,4 @@ SELECT * FROM t1; connection default; # Waiting for mariadbd to crash # Crash was detected -DROP TABLE t1, t2; -Warnings: -Warning 1932 Table 'test.t2' doesn't exist in engine +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test index dc28498675d1a..124b0c8563a4c 100644 --- a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test +++ b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test @@ -65,4 +65,5 @@ connection default; # Call script that will poll the server waiting for it to be back online again 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; diff --git a/sql/ddl_log.cc b/sql/ddl_log.cc index f6f4a3f43f25e..db2c386f80004 100644 --- a/sql/ddl_log.cc +++ b/sql/ddl_log.cc @@ -89,7 +89,7 @@ const char *ddl_log_action_name[DDL_LOG_LAST_ACTION]= "partitioning replace", "partitioning exchange", "rename table", "rename view", "initialize drop table", "drop table", - "drop view", "drop trigger", "drop db", + "drop view", "drop trigger", "drop db", "create table", }; /* Number of phases per entry */ @@ -98,7 +98,7 @@ const uchar ddl_log_entry_phases[DDL_LOG_LAST_ACTION]= 0, 1, 1, 2, (uchar) EXCH_PHASE_END, (uchar) DDL_RENAME_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, } 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: DBUG_ASSERT(0); break; @@ -2417,3 +2470,34 @@ bool ddl_log_drop_db(THD *thd, DDL_LOG_STATE *ddl_state, ddl_log_entry.tmp_name= *const_cast(path); 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(db); + ddl_log_entry.name= *const_cast(table); + ddl_log_entry.tmp_name= *const_cast(path); + ddl_log_entry.flags= only_frm; + + DBUG_RETURN(ddl_log_write(ddl_state, &ddl_log_entry)); +} diff --git a/sql/ddl_log.h b/sql/ddl_log.h index 5aa039f46a5a1..368b887b6c5b8 100644 --- a/sql/ddl_log.h +++ b/sql/ddl_log.h @@ -82,6 +82,7 @@ enum ddl_log_action_code DDL_LOG_DROP_VIEW_ACTION= 9, DDL_LOG_DROP_TRIGGER_ACTION= 10, DDL_LOG_DROP_DB_ACTION=11, + DDL_LOG_CREATE_TABLE_ACTION=12, DDL_LOG_LAST_ACTION /* End marker */ }; @@ -118,6 +119,12 @@ enum enum_ddl_log_drop_db_phase { 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 the phase to the maximum phase (..PHASE_END) for an entry. @@ -185,6 +192,7 @@ typedef struct st_ddl_log_state DDL_LOG_MEMORY_ENTRY *list; /* One execute entry per list */ DDL_LOG_MEMORY_ENTRY *execute_entry; + bool is_active() { return list != 0; } } DDL_LOG_STATE; @@ -252,5 +260,11 @@ bool ddl_log_drop_view(THD *thd, DDL_LOG_STATE *ddl_state, const LEX_CSTRING *db); bool ddl_log_drop_db(THD *thd, DDL_LOG_STATE *ddl_state, 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; #endif /* DDL_LOG_INCLUDED */ diff --git a/sql/handler.cc b/sql/handler.cc index 0f2533e6f1143..82c0f11905a7b 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4563,6 +4563,7 @@ bool non_existing_table_error(int error) { return (error == ENOENT || (error == EE_DELETE && my_errno == ENOENT) || + error == EE_FILENOTFOUND || error == HA_ERR_NO_SUCH_TABLE || error == HA_ERR_UNSUPPORTED || error == ER_NO_SUCH_TABLE || diff --git a/sql/sql_alter.h b/sql/sql_alter.h index 1c98ac1651d45..b922cbf063712 100644 --- a/sql/sql_alter.h +++ b/sql/sql_alter.h @@ -294,6 +294,12 @@ class Alter_table_ctx const char *get_tmp_path() const { 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 it deletes a row from the table being changed. diff --git a/sql/sql_class.h b/sql/sql_class.h index 77861611794f4..2df0651886fe3 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -39,7 +39,7 @@ #include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA, THR_LOCK_INFO */ #include "thr_timer.h" #include "thr_malloc.h" -#include "log_slow.h" /* LOG_SLOW_DISABLE_... */ +#include "log_slow.h" /* LOG_SLOW_DISABLE_... */ #include #include "sql_digest_stream.h" // sql_digest_state #include @@ -50,6 +50,7 @@ #include "session_tracker.h" #include "backup.h" #include "xa.h" +#include "ddl_log.h" /* DDL_LOG_STATE */ extern "C" void set_thd_stage_info(void *thd, @@ -6027,6 +6028,7 @@ class select_create: public select_insert { MYSQL_LOCK **m_plock; bool exit_done; TMP_TABLE_SHARE *saved_tmp_table_share; + DDL_LOG_STATE ddl_log_state_create, ddl_log_state_rm; public: select_create(THD *thd_arg, TABLE_LIST *table_arg, @@ -6042,7 +6044,10 @@ class select_create: public select_insert { alter_info(alter_info_arg), m_plock(NULL), exit_done(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 &list, SELECT_LEX_UNIT *u); void store_values(List &values); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 52d76950dd0da..8dde0ec8989ba 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -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 *items, - MYSQL_LOCK **lock, TABLEOP_HOOKS *hooks) + MYSQL_LOCK **lock, + TABLEOP_HOOKS *hooks) { TABLE tmp_table; // Used during 'Create_field()' TABLE_SHARE share; @@ -4473,7 +4474,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, 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_info, alter_info, NULL, select_field_count, create_table)) @@ -4532,6 +4534,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, { if (likely(!thd->is_error())) // CREATE ... IF NOT EXISTS my_ok(thd); // succeed, but did nothing + ddl_log_complete(&ddl_log_state_rm); + ddl_log_complete(&ddl_log_state_create); DBUG_RETURN(NULL); } @@ -4570,7 +4574,9 @@ TABLE *select_create::create_table_from_items(THD *thd, List *items, *lock= 0; } 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 */ } table->s->table_creation_was_logged= save_table_creation_was_logged; @@ -4912,11 +4918,30 @@ bool select_create::send_eof() if (thd->slave_thread) thd->variables.binlog_annotate_row_events= 0; + debug_crash_here("ddl_log_create_before_binlog"); + + /* + In case of crash, we have to add DROP TABLE to the binary log as + the CREATE TABLE will already be logged if we are not using row based + replication. + */ + if (!thd->is_current_stmt_binlog_format_row()) + { + if (ddl_log_state_create.is_active()) // Not temporary table + ddl_log_update_phase(&ddl_log_state_create, DDL_CREATE_TABLE_PHASE_LOG); + /* + We can ignore if we replaced an old table as ddl_log_state_create will + now handle the logging of the drop if needed. + */ + ddl_log_complete(&ddl_log_state_rm); + } + if (prepare_eof()) { abort_result_set(); DBUG_RETURN(true); } + debug_crash_here("ddl_log_create_after_prepare_eof"); if (table->s->tmp_table) { @@ -4983,9 +5008,15 @@ bool select_create::send_eof() thd->get_stmt_da()->set_overwrite_status(true); } #endif /* WITH_WSREP */ + thd->binlog_xid= thd->query_id; + /* Remember xid's for the case of row based logging */ + ddl_log_update_xid(&ddl_log_state_create, thd->binlog_xid); + ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid); trans_commit_stmt(thd); if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) trans_commit_implicit(thd); + thd->binlog_xid= 0; + #ifdef WITH_WSREP if (WSREP(thd)) { @@ -5004,6 +5035,15 @@ bool select_create::send_eof() } #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 @@ -5120,9 +5160,19 @@ void select_create::abort_result_set() binlog_reset_cache(thd); /* Original table was deleted. We have to log it */ if (table_creation_was_logged) + { + thd->binlog_xid= thd->query_id; + ddl_log_update_xid(&ddl_log_state_create, thd->binlog_xid); + ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid); + debug_crash_here("ddl_log_create_before_binlog"); log_drop_table(thd, &create_table->db, &create_table->table_name, 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; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 12d387bc8179d..f00aaaee00ae5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1078,6 +1078,7 @@ static uint32 get_comment(THD *thd, uint32 comment_pos, const uchar *query_end= (uchar*) query + thd->query_length(); const uchar *const state_map= thd->charset()->state_map; + *comment_start= ""; // Ensure it points to something for (; query < query_end; query++) { if (state_map[static_cast(*query)] == MY_LEX_SKIP) @@ -4131,10 +4132,13 @@ handler *mysql_create_frm_image(THD *thd, const LEX_CSTRING &db, */ 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 &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, int create_table_mode, bool *is_trans, KEY **key_info, uint *key_count, LEX_CUSTRING *frm) @@ -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 internal_tmp_table= create_table_mode == C_ALTER_TABLE || frm_only; 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", - 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, create_info)) @@ -4261,10 +4272,12 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, (void) trans_rollback_stmt(thd); /* Remove normal table without logging. Keep tables locked */ if (mysql_rm_table_no_locks(thd, &table_list, &thd->db, - (DDL_LOG_STATE*) 0, + ddl_log_state_rm, 0, 0, 0, 0, 1, 1)) goto err; + debug_crash_here("ddl_log_create_after_drop"); + /* We have to log this query, even if it failed later to ensure the drop is done. @@ -4327,7 +4340,7 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, 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 */ share.field= &no_fields; @@ -4338,6 +4351,14 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, if (parse_engine_table_options(thd, hton, &share)) 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); /* @@ -4359,45 +4380,56 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, } 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, alter_info, create_table_mode, key_info, key_count, frm); /* - TODO: remove this check of thd->is_error() (now it intercept - errors in some val_*() methoids and bring some single place to - such error interception). + TODO: remove this check of thd->is_error() (now it intercept + errors in some val_*() methods and bring some single place to + such error interception). */ if (!file || thd->is_error()) + { + if (!file) + deletefrm(path.str); goto err; + } if (thd->variables.keep_files_on_create) 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; 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)) { - file->ha_create_partitioning_metadata(path, NULL, CHF_DELETE_FLAG); - deletefrm(path); + file->ha_create_partitioning_metadata(path.str, NULL, CHF_DELETE_FLAG); + deletefrm(path.str); goto err; } + debug_crash_here("ddl_log_create_after_create_table"); } } create_info->table= 0; 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, false); 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; } @@ -4410,6 +4442,12 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db, error= 0; 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); delete file; DBUG_PRINT("exit", ("return: %d", error)); @@ -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) */ -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, Table_specification_st *create_info, Alter_info *alter_info, bool *is_trans, @@ -4444,26 +4485,31 @@ int mysql_create_table_no_lock(THD *thd, const LEX_CSTRING *db, KEY *not_used_1; uint not_used_2; int res; + uint path_length; char path[FN_REFLEN + 1]; + LEX_CSTRING cpath; LEX_CUSTRING frm= {0,0}; if (create_info->tmp_table()) - build_tmptable_filename(thd, path, sizeof(path)); + path_length= build_tmptable_filename(thd, path, sizeof(path)); else { - int length; 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. - 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, path); 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, alter_info, create_table_mode, is_trans, ¬_used_1, ¬_used_2, &frm); @@ -4516,17 +4562,22 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, Table_specification_st *create_info, Alter_info *alter_info) { - bool is_trans= FALSE; - bool result; - int create_table_mode; TABLE_LIST *pos_in_locked_tables= 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_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() */ - 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; /* 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, /* We can abort create table for any table type */ 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, alter_info, &is_trans, create_table_mode, @@ -4641,10 +4693,19 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table, */ 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(), thd->query_length(), is_trans))) 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); } @@ -4921,7 +4982,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, Table_specification_st local_create_info; TABLE_LIST *pos_in_locked_tables= 0; 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; bool is_trans= FALSE; bool do_logging= FALSE; @@ -4930,6 +4992,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, int create_res; 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 if (WSREP(thd) && !thd->wsrep_applier && wsrep_create_like_table(thd, table, src_table, create_info)) @@ -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; 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, &is_trans, C_ORDINARY_CREATE, table)) > 0); @@ -5240,22 +5307,33 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, err: 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) { /* Table was not deleted. Original table was deleted. 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 { if (write_bin_log(thd, res ? FALSE : TRUE, thd->query(), 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); } @@ -9662,9 +9740,10 @@ do_continue:; tmp_disable_binlog(thd); create_info->options|=HA_CREATE_TMP_ALTER; 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.get_tmp_path(), + alter_ctx.get_tmp_cstring_path(), thd->lex->create_info, create_info, alter_info, C_ALTER_TABLE_FRM_ONLY, NULL, &key_info, &key_count, &frm); diff --git a/sql/sql_table.h b/sql/sql_table.h index a625461f621f6..0c694eb730c7e 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -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_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, Table_specification_st *create_info, Alter_info *alter_info, bool *is_trans, diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 84c81d9f7b39b..d3600e9fc456c 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -45,6 +45,7 @@ C_MODE_END #include "key.h" #include "log.h" #include "sql_parse.h" +#include "debug_sync.h" /* Note that in future versions, only *transactional* Maria tables can @@ -996,6 +997,13 @@ my_bool ma_killed_in_mariadb(MARIA_HA *info) 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" */ /** @@ -3794,6 +3802,7 @@ static int ha_maria_init(void *p) HTON_TRANSACTIONAL_AND_NON_TRANSACTIONAL); bzero(maria_log_pagecache, sizeof(*maria_log_pagecache)); maria_tmpdir= &mysql_tmpdir_list; /* For REDO */ + ma_debug_crash_here= maria_debug_crash_here; if (!aria_readonly) res= maria_upgrade(); diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index 8eabc869a8275..a7ade46f8a4cb 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -1215,6 +1215,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, MY_UNPACK_FILENAME | MY_APPEND_EXT); create_flag= (flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD; } + ma_debug_crash_here("storage_engine_middle_of_create"); if ((dfile= mysql_file_create_with_symlink(key_file_dfile, dlinkname_ptr, dfilename, 0, create_mode, diff --git a/storage/maria/ma_static.c b/storage/maria/ma_static.c index 309069e2feb32..2c9f1dcc213e6 100644 --- a/storage/maria/ma_static.c +++ b/storage/maria/ma_static.c @@ -66,6 +66,9 @@ const char *maria_data_root; HASH maria_stored_state; 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 diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index d8adcdece1097..60b6cc35fbba5 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -1247,6 +1247,7 @@ extern ulong maria_checkpoint_min_log_activity; extern HASH maria_stored_state; extern int (*maria_create_trn_hook)(MARIA_HA *); extern my_bool (*ma_killed)(MARIA_HA *); +extern void (*ma_debug_crash_here)(const char *keyword); #ifdef HAVE_PSI_INTERFACE extern PSI_mutex_key key_SHARE_BITMAP_lock, key_SORT_INFO_mutex,