Skip to content

Commit 3847e40

Browse files
dutowfacebook-github-bot
authored andcommitted
FB8-116, FB8-152, FB8-83, FB8-125: Implement trx metadata in binlog (#965)
Summary: Jira ticket: https://jira.percona.com/browse/FB8-116 Jira ticket: https://jira.percona.com/browse/FB8-152 Jira ticket: https://jira.percona.com/browse/FB8-83 Jira ticket: https://jira.percona.com/browse/FB8-125 Reference commit: 316e0e5 Reference commit: a85b8d3 Reference commit: 21edb26 Reference commit: 96de6c4 Reference commit: e1cb53ba0f9 Reference commit: bd25e29 Reference commit: e392a18d40e Reference commit: fa4f588a248 Reference commit: 68f8c9a58fa Reference commit: 4519ab421f8 Reference commit: 42bdfc8 Reference commit: 3950491 Reference commit: bc17d30 Reference commit: eb7b1df Reference commit: 6a27bd42dfe Reference commit: 9503743bf59 Porting notes: The deadlock/ASAN bugfixes were skipped - I wasn't able to reproduce the issue mentioned in the commit messages even without the patches, and the pathes themselves caused early guaranteed crashes in the server. -------- 316e0e5 -------- If enabled, For every trx before the commit event is written we write a rows query event which contains meta data in JSON format wrapped inside a comment. Storing timestamps in the meta data to calculate slave lag in millisecond granularity. -------- a85b8d3 -------- Supporting binlog trx meta data for SBR. The meta data event is written right before every query event in a trx representing a statement. -------- 21edb26 -------- Milli-seconds behind master was not calculated correctly for MTS. With this change we calculate it just like seconds behind master. One difference between these is that sec timestamp is available for every event but msec timestamp is only available once per query/rows event in form of trx metadata inside a Rows_query_event. -------- bd25e29 -------- A separate event for trx metadata was causing an unreasonable increase in binlog size. Also, now we're not writing rows query event if there are no comments in the query and `log_only_query_comments` is enabled. -------- eb7b1df -------- Log meta data event before logging the rows query event for a statement. Pull Request resolved: #965 Reviewed By: yizhang82 Differential Revision: D14652380 Pulled By: yizhang82 fbshipit-source-id: ef13b78
1 parent 3fb11bd commit 3847e40

40 files changed

+1333
-88
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,7 @@ ENDIF()
969969

970970
IF(NOT WITHOUT_SERVER)
971971
INCLUDE(cmake/boost.cmake)
972+
INCLUDE_DIRECTORIES(SYSTEM ${BOOST_PATCHES_DIR} ${BOOST_INCLUDE_DIR})
972973
ENDIF()
973974

974975
IF (LINUX)

mysql-test/r/all_persisted_variables.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ include/assert.inc [Expect 500+ variables in the table. Due to open Bugs, we are
3737

3838
# Test SET PERSIST
3939

40-
include/assert.inc [Expect 403 persisted variables in the table.]
40+
include/assert.inc [Expect 404 persisted variables in the table.]
4141

4242
************************************************************
4343
* 3. Restart server, it must preserve the persisted variable
4444
* settings. Verify persisted configuration.
4545
************************************************************
4646
# restart
4747

48-
include/assert.inc [Expect 403 persisted variables in persisted_variables table.]
49-
include/assert.inc [Expect 403 persisted variables shown as PERSISTED in variables_info table.]
50-
include/assert.inc [Expect 403 persisted variables with matching peristed and global values.]
48+
include/assert.inc [Expect 404 persisted variables in persisted_variables table.]
49+
include/assert.inc [Expect 404 persisted variables shown as PERSISTED in variables_info table.]
50+
include/assert.inc [Expect 404 persisted variables with matching peristed and global values.]
5151

5252
************************************************************
5353
* 4. Test RESET PERSIST IF EXISTS. Verify persisted variable

mysql-test/r/mysqld--help-notwin.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ The following options may be given as the first argument:
210210
to assess which transactions can be executed in parallel
211211
by the slave's multi-threaded applier. Possible values
212212
are COMMIT_ORDER, WRITESET and WRITESET_SESSION.
213+
--binlog-trx-meta-data
214+
Log meta data about every trx in the binary log. This
215+
information is logged as a comment in a Rows_query_log
216+
event in JSON format.
213217
--block-encryption-mode=name
214218
mode for AES_ENCRYPT/AES_DECRYPT
215219
--bulk-insert-buffer-size=#
@@ -1479,6 +1483,7 @@ binlog-rows-query-log-events FALSE
14791483
binlog-stmt-cache-size 32768
14801484
binlog-transaction-dependency-history-size 25000
14811485
binlog-transaction-dependency-tracking COMMIT_ORDER
1486+
binlog-trx-meta-data FALSE
14821487
block-encryption-mode aes-128-ecb
14831488
bulk-insert-buffer-size 8388608
14841489
caching-sha2-password-private-key-path private_key.pem

mysql-test/suite/binlog_nogtid/r/binlog_persist_only_variables.result

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ VARIABLE_NAME LIKE '%slave%') AND
2525
'reset_seconds_behind_master', 'skip_flush_master_info'))
2626
ORDER BY VARIABLE_NAME;
2727

28-
include/assert.inc ['Expect 86 variables in the table.']
28+
include/assert.inc ['Expect 87 variables in the table.']
2929

3030
# Test SET PERSIST_ONLY
3131
SET PERSIST_ONLY binlog_cache_size = @@GLOBAL.binlog_cache_size;
@@ -52,6 +52,7 @@ SET PERSIST_ONLY binlog_rows_query_log_events = @@GLOBAL.binlog_rows_query_log_e
5252
SET PERSIST_ONLY binlog_stmt_cache_size = @@GLOBAL.binlog_stmt_cache_size;
5353
SET PERSIST_ONLY binlog_transaction_dependency_history_size = @@GLOBAL.binlog_transaction_dependency_history_size;
5454
SET PERSIST_ONLY binlog_transaction_dependency_tracking = @@GLOBAL.binlog_transaction_dependency_tracking;
55+
SET PERSIST_ONLY binlog_trx_meta_data = @@GLOBAL.binlog_trx_meta_data;
5556
SET PERSIST_ONLY enforce_gtid_consistency = @@GLOBAL.enforce_gtid_consistency;
5657
SET PERSIST_ONLY gtid_executed = @@GLOBAL.gtid_executed;
5758
ERROR HY000: Variable 'gtid_executed' is a non persistent read only variable
@@ -129,16 +130,16 @@ SET PERSIST_ONLY sync_master_info = @@GLOBAL.sync_master_info;
129130
SET PERSIST_ONLY sync_relay_log = @@GLOBAL.sync_relay_log;
130131
SET PERSIST_ONLY sync_relay_log_info = @@GLOBAL.sync_relay_log_info;
131132

132-
include/assert.inc ['Expect 75 persisted variables in persisted_variables table.']
133+
include/assert.inc ['Expect 76 persisted variables in persisted_variables table.']
133134

134135
############################################################
135136
# 2. Restart server, it must preserve the persisted variable
136137
# settings. Verify persisted configuration.
137138
# restart
138139

139-
include/assert.inc ['Expect 75 persisted variables in persisted_variables table.']
140-
include/assert.inc ['Expect 75 persisted variables shown as PERSISTED in variables_info table.']
141-
include/assert.inc ['Expect 74 persisted variables with matching persisted and global values.']
140+
include/assert.inc ['Expect 76 persisted variables in persisted_variables table.']
141+
include/assert.inc ['Expect 76 persisted variables shown as PERSISTED in variables_info table.']
142+
include/assert.inc ['Expect 75 persisted variables with matching persisted and global values.']
142143

143144
############################################################
144145
# 3. Test RESET PERSIST. Verify persisted variable settings
@@ -164,6 +165,7 @@ RESET PERSIST binlog_rows_query_log_events;
164165
RESET PERSIST binlog_stmt_cache_size;
165166
RESET PERSIST binlog_transaction_dependency_history_size;
166167
RESET PERSIST binlog_transaction_dependency_tracking;
168+
RESET PERSIST binlog_trx_meta_data;
167169
RESET PERSIST enforce_gtid_consistency;
168170
RESET PERSIST gtid_executed;
169171
ERROR HY000: Variable gtid_executed does not exist in persisted config file

mysql-test/suite/binlog_nogtid/r/binlog_persist_variables.result

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ VARIABLE_NAME LIKE '%slave%') AND
2525
'reset_seconds_behind_master', 'skip_flush_master_info'))
2626
ORDER BY VARIABLE_NAME;
2727

28-
include/assert.inc ['Expect 86 variables in the table.']
28+
include/assert.inc ['Expect 87 variables in the table.']
2929

3030
# Test SET PERSIST
3131
SET PERSIST binlog_cache_size = @@GLOBAL.binlog_cache_size;
@@ -55,6 +55,7 @@ SET PERSIST binlog_rows_query_log_events = @@GLOBAL.binlog_rows_query_log_events
5555
SET PERSIST binlog_stmt_cache_size = @@GLOBAL.binlog_stmt_cache_size;
5656
SET PERSIST binlog_transaction_dependency_history_size = @@GLOBAL.binlog_transaction_dependency_history_size;
5757
SET PERSIST binlog_transaction_dependency_tracking = @@GLOBAL.binlog_transaction_dependency_tracking;
58+
SET PERSIST binlog_trx_meta_data = @@GLOBAL.binlog_trx_meta_data;
5859
SET PERSIST enforce_gtid_consistency = @@GLOBAL.enforce_gtid_consistency;
5960
SET PERSIST gtid_executed = @@GLOBAL.gtid_executed;
6061
ERROR HY000: Variable 'gtid_executed' is a read only variable
@@ -136,16 +137,16 @@ SET PERSIST sync_master_info = @@GLOBAL.sync_master_info;
136137
SET PERSIST sync_relay_log = @@GLOBAL.sync_relay_log;
137138
SET PERSIST sync_relay_log_info = @@GLOBAL.sync_relay_log_info;
138139

139-
include/assert.inc ['Expect 68 persisted variables in persisted_variables table.']
140+
include/assert.inc ['Expect 69 persisted variables in persisted_variables table.']
140141

141142
############################################################
142143
# 2. Restart server, it must preserve the persisted variable
143144
# settings. Verify persisted configuration.
144145
# restart
145146

146-
include/assert.inc ['Expect 68 persisted variables in persisted_variables table.']
147-
include/assert.inc ['Expect 68 persisted variables shown as PERSISTED in variables_info table.']
148-
include/assert.inc ['Expect 68 persisted variables with matching persisted and global values.']
147+
include/assert.inc ['Expect 69 persisted variables in persisted_variables table.']
148+
include/assert.inc ['Expect 69 persisted variables shown as PERSISTED in variables_info table.']
149+
include/assert.inc ['Expect 69 persisted variables with matching persisted and global values.']
149150

150151
############################################################
151152
# 3. Test RESET PERSIST IF EXISTS. Verify persisted variable
@@ -177,6 +178,7 @@ RESET PERSIST IF EXISTS binlog_rows_query_log_events;
177178
RESET PERSIST IF EXISTS binlog_stmt_cache_size;
178179
RESET PERSIST IF EXISTS binlog_transaction_dependency_history_size;
179180
RESET PERSIST IF EXISTS binlog_transaction_dependency_tracking;
181+
RESET PERSIST IF EXISTS binlog_trx_meta_data;
180182
RESET PERSIST IF EXISTS enforce_gtid_consistency;
181183
RESET PERSIST IF EXISTS gtid_executed;
182184
Warnings:

mysql-test/suite/binlog_nogtid/t/binlog_persist_only_variables.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ INSERT INTO rplvars (varname, varvalue)
6060
# If this count differs, it means a variable has been added or removed.
6161
# In that case, this testcase needs to be updated accordingly.
6262
--echo
63-
--let $expected=86
63+
--let $expected=87
6464
--let $assert_text= 'Expect $expected variables in the table.'
6565
--let $assert_cond= [SELECT COUNT(*) as count FROM rplvars, count, 1] = $expected
6666
--source include/assert.inc
@@ -80,7 +80,7 @@ while ( $varid <= $countvars )
8080
--eval SET PERSIST_ONLY $varnames = @@GLOBAL.$varnames
8181

8282
# TODO: Remove/update this once Bug#27322592 is FIXED.
83-
if (`SELECT '$varnames' IN ('binlog_direct_non_transactional_updates', 'binlog_order_commits', 'binlog_rows_query_log_events', 'log_bin_trust_function_creators', 'log_slow_slave_statements', 'log_statements_unsafe_for_binlog', 'master_verify_checksum', 'slave_allow_batching', 'slave_compressed_protocol', 'slave_preserve_commit_order', 'slave_sql_verify_checksum', 'relay_log_purge', 'rpl_semi_sync_master_enabled', 'rpl_semi_sync_master_wait_no_slave', 'rpl_semi_sync_slave_enabled', 'binlog_gtid_simple_recovery', 'log_slave_updates', 'relay_log_recovery', 'binlog_rotate_encryption_master_key_at_startup')`)
83+
if (`SELECT '$varnames' IN ('binlog_direct_non_transactional_updates', 'binlog_order_commits', 'binlog_rows_query_log_events', 'log_bin_trust_function_creators', 'log_slow_slave_statements', 'log_statements_unsafe_for_binlog', 'master_verify_checksum', 'slave_allow_batching', 'slave_compressed_protocol', 'slave_preserve_commit_order', 'slave_sql_verify_checksum', 'relay_log_purge', 'rpl_semi_sync_master_enabled', 'rpl_semi_sync_master_wait_no_slave', 'rpl_semi_sync_slave_enabled', 'binlog_gtid_simple_recovery', 'log_slave_updates', 'relay_log_recovery', 'binlog_rotate_encryption_master_key_at_startup', 'binlog_trx_meta_data')`)
8484
{
8585
--disable_query_log
8686
--eval SELECT varvalue INTO @varvalues FROM rplvars WHERE id=$varid
@@ -92,7 +92,7 @@ while ( $varid <= $countvars )
9292
}
9393

9494
--echo
95-
--let $expected=75
95+
--let $expected=76
9696
--let $assert_text= 'Expect $expected persisted variables in persisted_variables table.'
9797
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = $expected
9898
--source include/assert.inc

mysql-test/suite/binlog_nogtid/t/binlog_persist_variables.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ INSERT INTO rplvars (varname, varvalue)
6161
# If this count differs, it means a variable has been added or removed.
6262
# In that case, this testcase needs to be updated accordingly.
6363
--echo
64-
--let $expected=86
64+
--let $expected=87
6565
--let $assert_text= 'Expect $expected variables in the table.'
6666
--let $assert_cond= [SELECT COUNT(*) as count FROM rplvars, count, 1] = $expected
6767
--source include/assert.inc
@@ -84,7 +84,7 @@ while ( $varid <= $countvars )
8484
}
8585

8686
--echo
87-
--let $expected=68
87+
--let $expected=69
8888
--let $assert_text= 'Expect $expected persisted variables in persisted_variables table.'
8989
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = $expected
9090
--source include/assert.inc
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Init
2+
--source include/rpl_connection_master.inc
3+
--source include/sync_slave_sql_with_master.inc
4+
--source include/rpl_connection_master.inc
5+
flush logs;
6+
--source include/sync_slave_sql_with_master.inc
7+
--source include/rpl_connection_master.inc
8+
let $master_last_log = query_get_value("SHOW MASTER STATUS", "File", 1);
9+
eval purge binary logs to '$master_last_log';
10+
--source include/rpl_connection_slave.inc
11+
flush logs;
12+
let $slave_last_log = query_get_value("SHOW MASTER STATUS", "File", 1);
13+
eval purge binary logs to '$slave_last_log';
14+
15+
# Generate load
16+
--source include/rpl_connection_master.inc
17+
disable_result_log;
18+
disable_query_log;
19+
create table t1(a int auto_increment primary key) engine=innodb;
20+
# the following loop will generate 300 meta data events, 1 for each statement
21+
# the total number of meta data events will be 301, +1 for create stmt above
22+
let $iter= 10;
23+
while ($iter > 0)
24+
{
25+
begin;
26+
eval /*insert { hello: { world } }*/insert into t1 values();
27+
eval /*update { { hello : world } }*/update t1 set a= a + 1;
28+
/*delete { }*/delete from t1;
29+
commit;
30+
dec $iter;
31+
}
32+
enable_result_log;
33+
enable_query_log;
34+
--source include/sync_slave_sql_with_master.inc
35+
36+
# Check binlogs for meta data
37+
--source include/rpl_connection_master.inc
38+
disable_query_log;
39+
let $MYSQLD_DATADIR = `select @@datadir`;
40+
let $MYSQLD_SECURE_FILE_DIR = `select @@secure_file_priv`;
41+
exec $MYSQL_BINLOG -v -v $MYSQLD_DATADIR/master-bin.0* | grep "::TRX_META_DATA::" | sed 's/\"[0-9]*\"/ts/g' > $MYSQLD_SECURE_FILE_DIR/meta_data.dat;
42+
set sql_log_bin=0;
43+
create table test.meta_data(meta text);
44+
eval load data infile '$MYSQLD_SECURE_FILE_DIR/meta_data.dat' into table test.meta_data;
45+
select meta, count(*) from test.meta_data group by meta;
46+
drop table test.meta_data;
47+
set sql_log_bin=1;
48+
remove_file $MYSQLD_SECURE_FILE_DIR/meta_data.dat;
49+
50+
--source include/rpl_connection_slave.inc
51+
let $MYSQLD_DATADIR = `select @@datadir`;
52+
let $MYSQLD_SECURE_FILE_DIR = `select @@secure_file_priv`;
53+
exec $MYSQL_BINLOG -v -v $MYSQLD_DATADIR/slave-bin.0* | grep "::TRX_META_DATA::" | sed 's/\"[0-9]*\"/ts/g' > $MYSQLD_SECURE_FILE_DIR/meta_data.dat;
54+
set sql_log_bin=0;
55+
create table test.meta_data(meta text);
56+
eval load data infile '$MYSQLD_SECURE_FILE_DIR/meta_data.dat' into table test.meta_data;
57+
select meta, count(*) from test.meta_data group by meta;
58+
drop table test.meta_data;
59+
set sql_log_bin=1;
60+
remove_file $MYSQLD_SECURE_FILE_DIR/meta_data.dat;
61+
enable_query_log;
62+
63+
# Cleanup
64+
--source include/rpl_connection_master.inc
65+
drop table t1;
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
include/master-slave.inc
2+
Warnings:
3+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4+
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection master]
6+
set @save.binlog_trx_meta_data= @@global.binlog_trx_meta_data;
7+
set @@global.binlog_trx_meta_data= true;
8+
set @save.binlog_trx_meta_data= @@global.binlog_trx_meta_data;
9+
set @@global.binlog_trx_meta_data= true;
10+
drop database if exists test2;
11+
drop database if exists test3;
12+
drop database if exists test4;
13+
create database test2 db_metadata '{"shard":"test2_shard", "replicaset":"test2_replicaset"}';
14+
create database test3 db_metadata '{"shard":"test3_shard", "replicaset":"test3_replicaset"}';
15+
use test;
16+
create table t1 (a int primary key, b char(8));
17+
insert into t1 values(1, 'a');
18+
insert into t1 values(2, 'b');
19+
use test2;
20+
create table t1 (a int primary key, b char(8));
21+
insert into t1 values(1, 'a');
22+
insert into t1 values(2, 'b');
23+
use test3;
24+
create table t1 (a int primary key, b char(8));
25+
insert into t1 values(1, 'a');
26+
insert into t1 values(2, 'b');
27+
alter database test3 db_metadata '{"shard":"test3_shard_updated", "replicaset":"test3_replicaset_updated"}';
28+
insert into t1 values(3, 'c');
29+
insert into t1 values(4, 'd');
30+
create database test4 db_metadata '{"shard":"newly_added_shard_for_test4", "replicaset":"new_replicaset_for_test4"}';
31+
insert into t1 values(5, 'e');
32+
insert into t1 values(6, 'f');
33+
use test4;
34+
create table t1 (a int primary key, b char(8));
35+
insert into t1 values(1, 'a');
36+
insert into t1 values(2, 'b');
37+
# /*::TRX_META_DATA::{"ts":[ts]}*/
38+
# /*::TRX_META_DATA::{"ts":[ts]}*/
39+
# /*::TRX_META_DATA::{"ts":[ts]}*/
40+
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts]}*/
41+
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts]}*/
42+
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts]}*/
43+
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts]}*/
44+
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts]}*/
45+
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts]}*/
46+
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts]}*/
47+
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts]}*/
48+
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts]}*/
49+
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts]}*/
50+
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts]}*/
51+
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts]}*/
52+
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts]}*/
53+
include/sync_slave_sql_with_master.inc
54+
# /*::TRX_META_DATA::{"ts":[ts,ts]}*/
55+
# /*::TRX_META_DATA::{"ts":[ts,ts]}*/
56+
# /*::TRX_META_DATA::{"ts":[ts,ts]}*/
57+
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts,ts]}*/
58+
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts,ts]}*/
59+
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts,ts]}*/
60+
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts,ts]}*/
61+
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts,ts]}*/
62+
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts,ts]}*/
63+
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts,ts]}*/
64+
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts,ts]}*/
65+
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts,ts]}*/
66+
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts,ts]}*/
67+
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts,ts]}*/
68+
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts,ts]}*/
69+
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts,ts]}*/
70+
use test;
71+
drop table if exists t1;
72+
drop database if exists test2;
73+
drop database if exists test3;
74+
drop database if exists test4;
75+
include/sync_slave_sql_with_master.inc
76+
set @@global.binlog_trx_meta_data= @save.binlog_trx_meta_data;
77+
set @@global.binlog_trx_meta_data= @save.binlog_trx_meta_data;
78+
include/rpl_end.inc
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
include/master-slave.inc
2+
Warnings:
3+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4+
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection master]
6+
[connection master]
7+
set @@global.binlog_trx_meta_data= true;
8+
[connection slave]
9+
set @@global.binlog_trx_meta_data= true;
10+
[connection master]
11+
include/sync_slave_sql_with_master.inc
12+
[connection master]
13+
flush logs;
14+
include/sync_slave_sql_with_master.inc
15+
[connection master]
16+
purge binary logs to 'master-bin.000002';
17+
[connection slave]
18+
flush logs;
19+
purge binary logs to 'slave-bin.000002';
20+
[connection master]
21+
include/sync_slave_sql_with_master.inc
22+
[connection master]
23+
meta count(*)
24+
# /*::TRX_META_DATA::{"ts":[ts]}*/ 31
25+
[connection slave]
26+
meta count(*)
27+
# /*::TRX_META_DATA::{"ts":[ts,ts]}*/ 31
28+
[connection master]
29+
drop table t1;
30+
[connection master]
31+
set @@global.binlog_trx_meta_data= 0;
32+
[connection slave]
33+
set @@global.binlog_trx_meta_data= 0;
34+
include/rpl_end.inc

0 commit comments

Comments
 (0)