mirror of
https://github.com/MariaDB/server.git
synced 2025-05-07 04:01:59 +03:00
Make the commit checkpoint inside InnoDB be asynchroneous. Implement a background thread in binlog to do the writing and flushing of binlog checkpoint events to disk.
95 lines
4.7 KiB
Plaintext
95 lines
4.7 KiB
Plaintext
SET @old_max_binlog_size= @@global.max_binlog_size;
|
|
SET GLOBAL max_binlog_size= 4096;
|
|
SET @old_innodb_flush_log_at_trx_commit= @@global.innodb_flush_log_at_trx_commit;
|
|
SET GLOBAL innodb_flush_log_at_trx_commit= 1;
|
|
RESET MASTER;
|
|
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
|
|
CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Myisam;
|
|
*** Test that RESET MASTER waits for pending commit checkpoints to complete.
|
|
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go";
|
|
INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
|
|
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
|
|
INSERT INTO t2 VALUES (1, REPEAT("x", 4100));
|
|
INSERT INTO t2 VALUES (2, REPEAT("x", 4100));
|
|
show binary logs;
|
|
Log_name File_size
|
|
master-bin.000001 #
|
|
master-bin.000002 #
|
|
master-bin.000003 #
|
|
master-bin.000004 #
|
|
show binlog events in 'master-bin.00000<binlog_start>' from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.00000<binlog_start> # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
|
master-bin.00000<binlog_start> # Binlog_checkpoint # # master-bin.000001
|
|
SET DEBUG_SYNC= "execute_command_after_close_tables SIGNAL reset_master_done";
|
|
RESET MASTER;
|
|
This will timeout, as RESET MASTER is blocked
|
|
SET DEBUG_SYNC= "now WAIT_FOR reset_master_done TIMEOUT 1";
|
|
Warnings:
|
|
Warning 1639 debug sync point wait timed out
|
|
SET DEBUG_SYNC= "now SIGNAL con1_go";
|
|
show binary logs;
|
|
Log_name File_size
|
|
master-bin.000001 #
|
|
show binlog events in 'master-bin.000001' from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
|
master-bin.000001 # Binlog_checkpoint # # master-bin.000001
|
|
*** Test that binlog N is active, and commit checkpoint for (N-1) is
|
|
*** done while there is still a pending commit checkpoint for (N-2).
|
|
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR con1_continue";
|
|
INSERT INTO t1 VALUES (20, REPEAT("x", 4100));
|
|
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
|
|
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR con2_continue";
|
|
INSERT INTO t1 VALUES (21, REPEAT("x", 4100));
|
|
SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
|
|
show binary logs;
|
|
Log_name File_size
|
|
master-bin.000001 #
|
|
master-bin.000002 #
|
|
master-bin.000003 #
|
|
show binlog events in 'master-bin.000001' from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
|
master-bin.000001 # Binlog_checkpoint # # master-bin.000001
|
|
master-bin.000001 # Query # # BEGIN
|
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
|
master-bin.000001 # Rotate # # master-bin.000002;pos=<binlog_start>
|
|
show binlog events in 'master-bin.000002' from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
|
master-bin.000002 # Binlog_checkpoint # # master-bin.000001
|
|
master-bin.000002 # Query # # BEGIN
|
|
master-bin.000002 # Table_map # # table_id: # (test.t1)
|
|
master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
|
|
master-bin.000002 # Xid # # COMMIT /* XID */
|
|
master-bin.000002 # Rotate # # master-bin.000003;pos=<binlog_start>
|
|
show binlog events in 'master-bin.000003' from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
|
master-bin.000003 # Binlog_checkpoint # # master-bin.000001
|
|
SET DEBUG_SYNC= "RESET";
|
|
SET @old_dbug= @@global.DEBUG_DBUG;
|
|
SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed";
|
|
SET DEBUG_SYNC= "now SIGNAL con2_continue";
|
|
con1 is still pending, no new binlog checkpoint should have been logged.
|
|
SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed";
|
|
SET GLOBAL debug_dbug= @old_dbug;
|
|
SET DEBUG_SYNC= "RESET";
|
|
show binlog events in 'master-bin.000003' from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
|
master-bin.000003 # Binlog_checkpoint # # master-bin.000001
|
|
SET DEBUG_SYNC= "now SIGNAL con1_continue";
|
|
No commit checkpoints are pending, a new binlog checkpoint should have been logged.
|
|
show binlog events in 'master-bin.000003' from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
|
master-bin.000003 # Binlog_checkpoint # # master-bin.000001
|
|
master-bin.000003 # Binlog_checkpoint # # master-bin.000003
|
|
DROP TABLE t1, t2;
|
|
SET GLOBAL max_binlog_size= @old_max_binlog_size;
|
|
SET GLOBAL innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
|