| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
# Prepare |
| 4 |
SET @saved_binlog_large_commit_threshold= @@GLOBAL.binlog_large_commit_threshold; |
| 5 |
SET @saved_binlog_checksum= @@GLOBAL.binlog_checksum; |
| 6 |
SET GLOBAL binlog_checksum = "NONE"; |
| 7 |
CREATE TABLE t1 (c1 LONGTEXT) ENGINE = InnoDB; |
| 8 |
CREATE TABLE t2 (c1 LONGTEXT) ENGINE = MyISAM; |
| 9 |
INSERT INTO t1 values(repeat("1", 5242880)); |
| 10 |
INSERT INTO t1 values(repeat("1", 5242880)); |
| 11 |
INSERT INTO t2 values(repeat("1", 5242880)); |
| 12 |
INSERT INTO t2 values(repeat("1", 5242880)); |
| 13 |
FLUSH BINARY LOGS; |
| 14 |
# Not renamed to binlog, since the binlog cache is not larger than the |
| 15 |
# threshold. And it should works well after ROLLBACK TO SAVEPOINT |
| 16 |
BEGIN; |
| 17 |
SAVEPOINT s1; |
| 18 |
UPDATE t1 SET c1 = repeat('1', 5242880); |
| 19 |
ROLLBACK TO SAVEPOINT s1; |
| 20 |
UPDATE t1 SET c1 = repeat('2', 5242880); |
| 21 |
SAVEPOINT s2; |
| 22 |
UPDATE t1 SET c1 = repeat('3', 5242880); |
| 23 |
UPDATE t1 SET c1 = repeat('4', 5242880); |
| 24 |
ROLLBACK TO SAVEPOINT s2; |
| 25 |
COMMIT; |
| 26 |
include/assert.inc [Binlog is not rotated] |
| 27 |
# |
| 28 |
# Test binlog cache rename to binlog file with checksum off |
| 29 |
# |
| 30 |
include/sync_slave_sql_with_master.inc |
| 31 |
include/stop_slave.inc |
| 32 |
SET @saved_binlog_large_commit_threshold = @@GLOBAL.binlog_large_commit_threshold; |
| 33 |
SET @saved_slave_parallel_workers = @@GLOBAL.slave_parallel_workers; |
| 34 |
SET @saved_slave_parallel_mode = @@GLOBAL.slave_parallel_mode; |
| 35 |
SET @saved_slave_parallel_max_queued = @@GLOBAL.slave_parallel_max_queued; |
| 36 |
SET GLOBAL binlog_large_commit_threshold = 10 * 1024 * 1024; |
| 37 |
SET GLOBAL slave_parallel_max_queued = 100 * 1024 * 1024; |
| 38 |
SET GLOBAL slave_parallel_workers = 4; |
| 39 |
SET GLOBAL slave_parallel_mode = "aggressive"; |
| 40 |
include/start_slave.inc |
| 41 |
BEGIN; |
| 42 |
DELETE FROM t1; |
| 43 |
connection master; |
| 44 |
SET GLOBAL binlog_large_commit_threshold = 10 * 1024 * 1024; |
| 45 |
# Transaction cache can be renamed and works well with ROLLBACK TO SAVEPOINT |
| 46 |
BEGIN; |
| 47 |
SAVEPOINT s1; |
| 48 |
UPDATE t1 SET c1 = repeat('2', 5242880); |
| 49 |
ROLLBACK TO s1; |
| 50 |
UPDATE t1 SET c1 = repeat('3', 5242880); |
| 51 |
SAVEPOINT s2; |
| 52 |
UPDATE t1 SET c1 = repeat('4', 5242880); |
| 53 |
UPDATE t1 SET c1 = repeat('5', 5242880); |
| 54 |
UPDATE t1 SET c1 = repeat('6', 5242880); |
| 55 |
ROLLBACK TO SAVEPOINT s2; |
| 56 |
COMMIT; |
| 57 |
INSERT INTO t1 VALUES("after_update_t1"); |
| 58 |
include/assert.inc [Rename is executed.] |
| 59 |
# statement cache can be renamed |
| 60 |
connection master; |
| 61 |
BEGIN; |
| 62 |
UPDATE t2 SET c1 = repeat('4', 5242880); |
| 63 |
INSERT INTO t1 VALUES("after_update_t2"); |
| 64 |
COMMIT; |
| 65 |
include/assert.inc [Rename is executed.] |
| 66 |
connection slave; |
| 67 |
ROLLBACK; |
| 68 |
connection master; |
| 69 |
include/sync_slave_sql_with_master.inc |
| 70 |
include/assert.inc [Rename is executed.] |
| 71 |
include/assert.inc [Rename is executed.] |
| 72 |
include/show_binlog_events.inc |
| 73 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 74 |
slave-bin.000002 # Gtid # # BEGIN GTID #-#-# |
| 75 |
slave-bin.000002 # Annotate_rows # # UPDATE t1 SET c1 = repeat('3', 5242880) |
| 76 |
slave-bin.000002 # Table_map # # table_id: # (test.t1) |
| 77 |
slave-bin.000002 # Update_rows_v1 # # table_id: # |
| 78 |
slave-bin.000002 # Update_rows_v1 # # table_id: # flags: STMT_END_F |
| 79 |
slave-bin.000002 # Query # # SAVEPOINT `s2` |
| 80 |
slave-bin.000002 # Xid # # COMMIT /* XID */ |
| 81 |
slave-bin.000002 # Gtid # # BEGIN GTID #-#-# |
| 82 |
slave-bin.000002 # Annotate_rows # # INSERT INTO t1 VALUES("after_update_t1") |
| 83 |
slave-bin.000002 # Table_map # # table_id: # (test.t1) |
| 84 |
slave-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F |
| 85 |
slave-bin.000002 # Xid # # COMMIT /* XID */ |
| 86 |
slave-bin.000002 # Rotate # # slave-bin.000003;pos=POS |
| 87 |
include/show_binlog_events.inc |
| 88 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 89 |
slave-bin.000003 # Gtid # # BEGIN GTID #-#-# |
| 90 |
slave-bin.000003 # Annotate_rows # # UPDATE t2 SET c1 = repeat('4', 5242880) |
| 91 |
slave-bin.000003 # Table_map # # table_id: # (test.t2) |
| 92 |
slave-bin.000003 # Update_rows_v1 # # table_id: # |
| 93 |
slave-bin.000003 # Update_rows_v1 # # table_id: # flags: STMT_END_F |
| 94 |
slave-bin.000003 # Query # # COMMIT |
| 95 |
slave-bin.000003 # Gtid # # BEGIN GTID #-#-# |
| 96 |
slave-bin.000003 # Annotate_rows # # INSERT INTO t1 VALUES("after_update_t2") |
| 97 |
slave-bin.000003 # Table_map # # table_id: # (test.t1) |
| 98 |
slave-bin.000003 # Write_rows_v1 # # table_id: # flags: STMT_END_F |
| 99 |
slave-bin.000003 # Xid # # COMMIT /* XID */ |
| 100 |
include/stop_slave.inc |
| 101 |
SET GLOBAL binlog_large_commit_threshold = @saved_binlog_large_commit_threshold; |
| 102 |
SET GLOBAL slave_parallel_workers = @saved_slave_parallel_workers; |
| 103 |
SET GLOBAL slave_parallel_max_queued = @saved_slave_parallel_max_queued; |
| 104 |
SET GLOBAL slave_parallel_mode = @saved_slave_parallel_mode; |
| 105 |
include/start_slave.inc |
| 106 |
# CREATE SELECT works well |
| 107 |
connection master; |
| 108 |
CREATE TABLE t3 SELECT * FROM t1; |
| 109 |
include/assert.inc [Rename is executed.] |
| 110 |
CREATE TABLE t4 SELECT * FROM t2; |
| 111 |
include/assert.inc [Rename is executed.] |
| 112 |
# XA statement works well |
| 113 |
XA START "test-a-long-xid========================================"; |
| 114 |
UPDATE t1 SET c1 = repeat('1', 5242880); |
| 115 |
XA END "test-a-long-xid========================================"; |
| 116 |
XA PREPARE "test-a-long-xid========================================"; |
| 117 |
XA COMMIT "test-a-long-xid========================================"; |
| 118 |
include/assert.inc [Rename is executed.] |
| 119 |
XA START "test-xid"; |
| 120 |
UPDATE t1 SET c1 = repeat('2', 5242880); |
| 121 |
XA END "test-xid"; |
| 122 |
XA COMMIT "test-xid" ONE PHASE; |
| 123 |
include/assert.inc [Rename is executed.] |
| 124 |
# |
| 125 |
# It works well in the situation that binlog header is larger than |
| 126 |
# IO_SIZE and binlog file's buffer. |
| 127 |
# |
| 128 |
FLUSH BINARY LOGS; |
| 129 |
SET SESSION server_id = 1; |
| 130 |
UPDATE t1 SET c1 = repeat('3', 5242880); |
| 131 |
include/assert.inc [Rename is executed.] |
| 132 |
# |
| 133 |
# RESET MASTER should work well. It also verifies binlog checksum mechanism. |
| 134 |
# |
| 135 |
include/rpl_reset.inc |
| 136 |
# |
| 137 |
# Test binlog cache rename to binlog file with checksum on |
| 138 |
# |
| 139 |
SET GLOBAL binlog_checksum = "CRC32"; |
| 140 |
# It will not rename the cache to file, since the cache's checksum was |
| 141 |
# initialized when reset the cache at the end of previous transaction. |
| 142 |
UPDATE t1 SET c1 = repeat('5', 5242880); |
| 143 |
include/assert.inc [Binlog is not rotated] |
| 144 |
# |
| 145 |
# Not rename to binlog file If the cache's checksum is not same |
| 146 |
# to binlog_checksum |
| 147 |
# |
| 148 |
BEGIN; |
| 149 |
UPDATE t1 SET c1 = repeat('6', 5242880); |
| 150 |
SET GLOBAL binlog_checksum = "NONE"; |
| 151 |
COMMIT; |
| 152 |
include/assert.inc [Binlog is not rotated] |
| 153 |
BEGIN; |
| 154 |
UPDATE t1 SET c1 = repeat('7', 5242880); |
| 155 |
SET GLOBAL binlog_checksum = "CRC32"; |
| 156 |
COMMIT; |
| 157 |
include/assert.inc [Binlog is not rotated] |
| 158 |
# |
| 159 |
# Not rename to binlog file If both stmt and trx cache are not empty |
| 160 |
# |
| 161 |
UPDATE t1, t2 SET t1.c1 = repeat('8', 5242880), t2.c1 = repeat('7', 5242880); |
| 162 |
include/assert.inc [Binlog is not rotated] |
| 163 |
# |
| 164 |
# Not rename to binlog file If binlog_legacy_event_pos is on |
| 165 |
# |
| 166 |
SET GLOBAL binlog_legacy_event_pos = ON; |
| 167 |
UPDATE t1 SET c1 = repeat('9', 5242880); |
| 168 |
SET GLOBAL binlog_legacy_event_pos = OFF; |
| 169 |
include/assert.inc [Binlog is not rotated] |
| 170 |
DROP TABLE t1, t2, t3, t4; |
| 171 |
SET GLOBAL binlog_large_commit_threshold = @saved_binlog_large_commit_threshold; |
| 172 |
SET GLOBAL binlog_checksum = @saved_binlog_checksum; |
| 173 |
include/rpl_end.inc |