mirror of
https://github.com/MariaDB/server.git
synced 2025-02-09 23:24:11 +01:00
![Monty](/assets/img/avatar_default.png)
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.
36 lines
1.7 KiB
Text
36 lines
1.7 KiB
Text
connection node_2;
|
|
connection node_1;
|
|
CREATE TABLE t1 (f1 INT PRIMARY KEY);
|
|
SET SESSION wsrep_trx_fragment_unit='ROWS';
|
|
SET SESSION wsrep_trx_fragment_size=1;
|
|
INSERT INTO t1 VALUES (1), (2);
|
|
SET SESSION wsrep_trx_fragment_unit='BYTES';
|
|
SET SESSION wsrep_trx_fragment_size=1;
|
|
INSERT INTO t1 VALUES (3), (4);
|
|
SET SESSION wsrep_trx_fragment_unit='STATEMENTS';
|
|
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 527;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
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;
|