| 1 |
###################################################################### |
| 2 |
# Bug#35199996 table map entry for certain table were logged in to the |
| 3 |
# binlogs even though the log_replica_updates is disabled |
| 4 |
###################################################################### |
| 5 |
CREATE TABLE test_log_table_maps (id INT PRIMARY KEY, what VARCHAR(128)) ENGINE = NDB; |
| 6 |
SET @save_debug= @@GLOBAL.debug; |
| 7 |
SET @@GLOBAL.debug="+d,ndb_binlog_log_table_maps"; |
| 8 |
SET @@GLOBAL.debug= @save_debug; |
| 9 |
# Show data written |
| 10 |
SELECT * FROM test_log_table_maps ORDER BY id; |
| 11 |
id what |
| 12 |
1 change from non replica |
| 13 |
2 change from replica |
| 14 |
3 change from non replica |
| 15 |
4 change from replica |
| 16 |
5 change from first replica |
| 17 |
6 change from second replica |
| 18 |
7 no logging change from replica |
| 19 |
8 no logging change from non-replica |
| 20 |
9 change from replica |
| 21 |
10 no logging change from non-replica |
| 22 |
11 no logging change from non-replica |
| 23 |
12 read-op change from non-replica |
| 24 |
13 no logging change from replica |
| 25 |
14 read-op change from replica |
| 26 |
15 read-op change from non-replica |
| 27 |
16 read-op change from replica |
| 28 |
include/show_binlog_events.inc |
| 29 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 30 |
binlog.000001 # Query # # use `test`; CREATE TABLE test_log_table_maps (id INT PRIMARY KEY, what VARCHAR(128)) ENGINE = NDB |
| 31 |
binlog.000001 # Query # # BEGIN |
| 32 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 33 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 34 |
binlog.000001 # Write_rows # # table_id: # |
| 35 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 36 |
binlog.000001 # Query # # COMMIT |
| 37 |
binlog.000001 # Query # # BEGIN |
| 38 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 39 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 40 |
binlog.000001 # Write_rows # # table_id: # |
| 41 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 42 |
binlog.000001 # Query # # COMMIT |
| 43 |
binlog.000001 # Query # # BEGIN |
| 44 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 45 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 46 |
binlog.000001 # Write_rows # # table_id: # |
| 47 |
binlog.000001 # Write_rows # # table_id: # |
| 48 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 49 |
binlog.000001 # Query # # COMMIT |
| 50 |
binlog.000001 # Query # # BEGIN |
| 51 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 52 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 53 |
binlog.000001 # Write_rows # # table_id: # |
| 54 |
binlog.000001 # Write_rows # # table_id: # |
| 55 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 56 |
binlog.000001 # Query # # COMMIT |
| 57 |
binlog.000001 # Query # # BEGIN |
| 58 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 59 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 60 |
binlog.000001 # Write_rows # # table_id: # |
| 61 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 62 |
binlog.000001 # Query # # COMMIT |
| 63 |
binlog.000001 # Query # # BEGIN |
| 64 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 65 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 66 |
binlog.000001 # Write_rows # # table_id: # |
| 67 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 68 |
binlog.000001 # Query # # COMMIT |
| 69 |
binlog.000001 # Query # # BEGIN |
| 70 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 71 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 72 |
binlog.000001 # Write_rows # # table_id: # |
| 73 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 74 |
binlog.000001 # Query # # COMMIT |
| 75 |
binlog.000001 # Query # # BEGIN |
| 76 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 77 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 78 |
binlog.000001 # Write_rows # # table_id: # |
| 79 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 80 |
binlog.000001 # Query # # COMMIT |
| 81 |
# Verify server1 Binlog changes |
| 82 |
# Some rows are not logged because no-logging bit was set |
| 83 |
include/ndb_binlog_verify_table.inc |
| 84 |
SELECT * FROM verify.test_log_table_maps ORDER BY id; |
| 85 |
id what |
| 86 |
1 change from non replica |
| 87 |
2 change from replica |
| 88 |
3 change from non replica |
| 89 |
4 change from replica |
| 90 |
5 change from first replica |
| 91 |
6 change from second replica |
| 92 |
9 change from replica |
| 93 |
12 read-op change from non-replica |
| 94 |
14 read-op change from replica |
| 95 |
15 read-op change from non-replica |
| 96 |
16 read-op change from replica |
| 97 |
[connection server2] |
| 98 |
include/show_binlog_events.inc |
| 99 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 100 |
binlog.000001 # Query # # use `test`; CREATE TABLE test_log_table_maps (id INT PRIMARY KEY, what VARCHAR(128)) ENGINE = NDB |
| 101 |
binlog.000001 # Query # # BEGIN |
| 102 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 103 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 104 |
binlog.000001 # Write_rows # # table_id: # |
| 105 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 106 |
binlog.000001 # Query # # COMMIT |
| 107 |
binlog.000001 # Query # # BEGIN |
| 108 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 109 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 110 |
binlog.000001 # Write_rows # # table_id: # |
| 111 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 112 |
binlog.000001 # Query # # COMMIT |
| 113 |
binlog.000001 # Query # # BEGIN |
| 114 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 115 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 116 |
binlog.000001 # Write_rows # # table_id: # |
| 117 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 118 |
binlog.000001 # Query # # COMMIT |
| 119 |
binlog.000001 # Query # # BEGIN |
| 120 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 121 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 122 |
binlog.000001 # Write_rows # # table_id: # |
| 123 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 124 |
binlog.000001 # Query # # COMMIT |
| 125 |
binlog.000001 # Query # # BEGIN |
| 126 |
binlog.000001 # Table_map # # table_id: # (test.test_log_table_maps) |
| 127 |
binlog.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) |
| 128 |
binlog.000001 # Write_rows # # table_id: # |
| 129 |
binlog.000001 # Write_rows # # table_id: # flags: STMT_END_F |
| 130 |
binlog.000001 # Query # # COMMIT |
| 131 |
# Verify server2 Binlog changes |
| 132 |
# Additional rows are not logged because server2 does NOT log replica updates |
| 133 |
include/ndb_binlog_verify_table.inc |
| 134 |
SELECT * FROM verify.test_log_table_maps ORDER BY id; |
| 135 |
id what |
| 136 |
1 change from non replica |
| 137 |
3 change from non replica |
| 138 |
12 read-op change from non-replica |
| 139 |
14 read-op change from replica |
| 140 |
15 read-op change from non-replica |
| 141 |
16 read-op change from replica |
| 142 |
[connection server1] |
| 143 |
DROP TABLE test_log_table_maps; |
| 144 |
###################################################################### |
| 145 |
# Bug#37953883 table map entry is logged in binlog for create table |
| 146 |
# statements when sql_log_bin is disabled for the session. |
| 147 |
###################################################################### |
| 148 |
[connection server2] |
| 149 |
SET sql_log_bin=0; |
| 150 |
SET @save_debug= @@GLOBAL.debug; |
| 151 |
SET @@GLOBAL.debug="+d,ndb_binlog_verify_table_maps"; |
| 152 |
CREATE TABLE test_blob_log_table_maps (id INT PRIMARY KEY, b BLOB, lb LONGBLOB, lt LONGTEXT) ENGINE = NDB; |
| 153 |
INSERT INTO test_blob_log_table_maps VALUES (1, repeat("!", 512), repeat("@", 512), repeat("#", 512)), |
| 154 |
(2, repeat("!", 512), repeat("$", 512), repeat("&", 512)), |
| 155 |
(3, repeat("!", 512), repeat("%", 512), repeat("^", 512)), |
| 156 |
(4, repeat("!", 512), repeat("*", 512), repeat("~", 512)); |
| 157 |
# Should not abort |
| 158 |
SELECT id FROM test_blob_log_table_maps ORDER by id; |
| 159 |
id |
| 160 |
1 |
| 161 |
2 |
| 162 |
3 |
| 163 |
4 |
| 164 |
UPDATE test_blob_log_table_maps |
| 165 |
SET lb = repeat("+", 256), lt = repeat("-", 128) |
| 166 |
WHERE id BETWEEN 1 and 4; |
| 167 |
SELECT COUNT(lb), COUNT(lt) FROM test_blob_log_table_maps; |
| 168 |
COUNT(lb) COUNT(lt) |
| 169 |
4 4 |
| 170 |
DELETE FROM test_blob_log_table_maps; |
| 171 |
SELECT COUNT(*) FROM test_blob_log_table_maps; |
| 172 |
COUNT(*) |
| 173 |
0 |
| 174 |
# Cleanup |
| 175 |
SET @@GLOBAL.debug = @save_debug; |
| 176 |
SET sql_log_bin=1; |
| 177 |
DROP TABLE test_blob_log_table_maps; |