Skip to content

Commit

Permalink
FB8-116, FB8-152, FB8-83, FB8-125: Implement trx metadata in binlog (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
dutow authored and facebook-github-bot committed Nov 18, 2019
1 parent 3fb11bd commit 3847e40
Show file tree
Hide file tree
Showing 40 changed files with 1,333 additions and 88 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ ENDIF()

IF(NOT WITHOUT_SERVER)
INCLUDE(cmake/boost.cmake)
INCLUDE_DIRECTORIES(SYSTEM ${BOOST_PATCHES_DIR} ${BOOST_INCLUDE_DIR})
ENDIF()

IF (LINUX)
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/r/all_persisted_variables.result
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ include/assert.inc [Expect 500+ variables in the table. Due to open Bugs, we are

# Test SET PERSIST

include/assert.inc [Expect 403 persisted variables in the table.]
include/assert.inc [Expect 404 persisted variables in the table.]

************************************************************
* 3. Restart server, it must preserve the persisted variable
* settings. Verify persisted configuration.
************************************************************
# restart

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

************************************************************
* 4. Test RESET PERSIST IF EXISTS. Verify persisted variable
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/r/mysqld--help-notwin.result
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ The following options may be given as the first argument:
to assess which transactions can be executed in parallel
by the slave's multi-threaded applier. Possible values
are COMMIT_ORDER, WRITESET and WRITESET_SESSION.
--binlog-trx-meta-data
Log meta data about every trx in the binary log. This
information is logged as a comment in a Rows_query_log
event in JSON format.
--block-encryption-mode=name
mode for AES_ENCRYPT/AES_DECRYPT
--bulk-insert-buffer-size=#
Expand Down Expand Up @@ -1479,6 +1483,7 @@ binlog-rows-query-log-events FALSE
binlog-stmt-cache-size 32768
binlog-transaction-dependency-history-size 25000
binlog-transaction-dependency-tracking COMMIT_ORDER
binlog-trx-meta-data FALSE
block-encryption-mode aes-128-ecb
bulk-insert-buffer-size 8388608
caching-sha2-password-private-key-path private_key.pem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ VARIABLE_NAME LIKE '%slave%') AND
'reset_seconds_behind_master', 'skip_flush_master_info'))
ORDER BY VARIABLE_NAME;

include/assert.inc ['Expect 86 variables in the table.']
include/assert.inc ['Expect 87 variables in the table.']

# Test SET PERSIST_ONLY
SET PERSIST_ONLY binlog_cache_size = @@GLOBAL.binlog_cache_size;
Expand All @@ -52,6 +52,7 @@ SET PERSIST_ONLY binlog_rows_query_log_events = @@GLOBAL.binlog_rows_query_log_e
SET PERSIST_ONLY binlog_stmt_cache_size = @@GLOBAL.binlog_stmt_cache_size;
SET PERSIST_ONLY binlog_transaction_dependency_history_size = @@GLOBAL.binlog_transaction_dependency_history_size;
SET PERSIST_ONLY binlog_transaction_dependency_tracking = @@GLOBAL.binlog_transaction_dependency_tracking;
SET PERSIST_ONLY binlog_trx_meta_data = @@GLOBAL.binlog_trx_meta_data;
SET PERSIST_ONLY enforce_gtid_consistency = @@GLOBAL.enforce_gtid_consistency;
SET PERSIST_ONLY gtid_executed = @@GLOBAL.gtid_executed;
ERROR HY000: Variable 'gtid_executed' is a non persistent read only variable
Expand Down Expand Up @@ -129,16 +130,16 @@ SET PERSIST_ONLY sync_master_info = @@GLOBAL.sync_master_info;
SET PERSIST_ONLY sync_relay_log = @@GLOBAL.sync_relay_log;
SET PERSIST_ONLY sync_relay_log_info = @@GLOBAL.sync_relay_log_info;

include/assert.inc ['Expect 75 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 76 persisted variables in persisted_variables table.']

############################################################
# 2. Restart server, it must preserve the persisted variable
# settings. Verify persisted configuration.
# restart

include/assert.inc ['Expect 75 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 75 persisted variables shown as PERSISTED in variables_info table.']
include/assert.inc ['Expect 74 persisted variables with matching persisted and global values.']
include/assert.inc ['Expect 76 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 76 persisted variables shown as PERSISTED in variables_info table.']
include/assert.inc ['Expect 75 persisted variables with matching persisted and global values.']

############################################################
# 3. Test RESET PERSIST. Verify persisted variable settings
Expand All @@ -164,6 +165,7 @@ RESET PERSIST binlog_rows_query_log_events;
RESET PERSIST binlog_stmt_cache_size;
RESET PERSIST binlog_transaction_dependency_history_size;
RESET PERSIST binlog_transaction_dependency_tracking;
RESET PERSIST binlog_trx_meta_data;
RESET PERSIST enforce_gtid_consistency;
RESET PERSIST gtid_executed;
ERROR HY000: Variable gtid_executed does not exist in persisted config file
Expand Down
12 changes: 7 additions & 5 deletions mysql-test/suite/binlog_nogtid/r/binlog_persist_variables.result
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ VARIABLE_NAME LIKE '%slave%') AND
'reset_seconds_behind_master', 'skip_flush_master_info'))
ORDER BY VARIABLE_NAME;

include/assert.inc ['Expect 86 variables in the table.']
include/assert.inc ['Expect 87 variables in the table.']

# Test SET PERSIST
SET PERSIST binlog_cache_size = @@GLOBAL.binlog_cache_size;
Expand Down Expand Up @@ -55,6 +55,7 @@ SET PERSIST binlog_rows_query_log_events = @@GLOBAL.binlog_rows_query_log_events
SET PERSIST binlog_stmt_cache_size = @@GLOBAL.binlog_stmt_cache_size;
SET PERSIST binlog_transaction_dependency_history_size = @@GLOBAL.binlog_transaction_dependency_history_size;
SET PERSIST binlog_transaction_dependency_tracking = @@GLOBAL.binlog_transaction_dependency_tracking;
SET PERSIST binlog_trx_meta_data = @@GLOBAL.binlog_trx_meta_data;
SET PERSIST enforce_gtid_consistency = @@GLOBAL.enforce_gtid_consistency;
SET PERSIST gtid_executed = @@GLOBAL.gtid_executed;
ERROR HY000: Variable 'gtid_executed' is a read only variable
Expand Down Expand Up @@ -136,16 +137,16 @@ SET PERSIST sync_master_info = @@GLOBAL.sync_master_info;
SET PERSIST sync_relay_log = @@GLOBAL.sync_relay_log;
SET PERSIST sync_relay_log_info = @@GLOBAL.sync_relay_log_info;

include/assert.inc ['Expect 68 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 69 persisted variables in persisted_variables table.']

############################################################
# 2. Restart server, it must preserve the persisted variable
# settings. Verify persisted configuration.
# restart

include/assert.inc ['Expect 68 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 68 persisted variables shown as PERSISTED in variables_info table.']
include/assert.inc ['Expect 68 persisted variables with matching persisted and global values.']
include/assert.inc ['Expect 69 persisted variables in persisted_variables table.']
include/assert.inc ['Expect 69 persisted variables shown as PERSISTED in variables_info table.']
include/assert.inc ['Expect 69 persisted variables with matching persisted and global values.']

############################################################
# 3. Test RESET PERSIST IF EXISTS. Verify persisted variable
Expand Down Expand Up @@ -177,6 +178,7 @@ RESET PERSIST IF EXISTS binlog_rows_query_log_events;
RESET PERSIST IF EXISTS binlog_stmt_cache_size;
RESET PERSIST IF EXISTS binlog_transaction_dependency_history_size;
RESET PERSIST IF EXISTS binlog_transaction_dependency_tracking;
RESET PERSIST IF EXISTS binlog_trx_meta_data;
RESET PERSIST IF EXISTS enforce_gtid_consistency;
RESET PERSIST IF EXISTS gtid_executed;
Warnings:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ INSERT INTO rplvars (varname, varvalue)
# If this count differs, it means a variable has been added or removed.
# In that case, this testcase needs to be updated accordingly.
--echo
--let $expected=86
--let $expected=87
--let $assert_text= 'Expect $expected variables in the table.'
--let $assert_cond= [SELECT COUNT(*) as count FROM rplvars, count, 1] = $expected
--source include/assert.inc
Expand All @@ -80,7 +80,7 @@ while ( $varid <= $countvars )
--eval SET PERSIST_ONLY $varnames = @@GLOBAL.$varnames

# TODO: Remove/update this once Bug#27322592 is FIXED.
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')`)
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')`)
{
--disable_query_log
--eval SELECT varvalue INTO @varvalues FROM rplvars WHERE id=$varid
Expand All @@ -92,7 +92,7 @@ while ( $varid <= $countvars )
}

--echo
--let $expected=75
--let $expected=76
--let $assert_text= 'Expect $expected persisted variables in persisted_variables table.'
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = $expected
--source include/assert.inc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ INSERT INTO rplvars (varname, varvalue)
# If this count differs, it means a variable has been added or removed.
# In that case, this testcase needs to be updated accordingly.
--echo
--let $expected=86
--let $expected=87
--let $assert_text= 'Expect $expected variables in the table.'
--let $assert_cond= [SELECT COUNT(*) as count FROM rplvars, count, 1] = $expected
--source include/assert.inc
Expand All @@ -84,7 +84,7 @@ while ( $varid <= $countvars )
}

--echo
--let $expected=68
--let $expected=69
--let $assert_text= 'Expect $expected persisted variables in persisted_variables table.'
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = $expected
--source include/assert.inc
Expand Down
65 changes: 65 additions & 0 deletions mysql-test/suite/rpl/include/binlog_trx_meta_data.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Init
--source include/rpl_connection_master.inc
--source include/sync_slave_sql_with_master.inc
--source include/rpl_connection_master.inc
flush logs;
--source include/sync_slave_sql_with_master.inc
--source include/rpl_connection_master.inc
let $master_last_log = query_get_value("SHOW MASTER STATUS", "File", 1);
eval purge binary logs to '$master_last_log';
--source include/rpl_connection_slave.inc
flush logs;
let $slave_last_log = query_get_value("SHOW MASTER STATUS", "File", 1);
eval purge binary logs to '$slave_last_log';

# Generate load
--source include/rpl_connection_master.inc
disable_result_log;
disable_query_log;
create table t1(a int auto_increment primary key) engine=innodb;
# the following loop will generate 300 meta data events, 1 for each statement
# the total number of meta data events will be 301, +1 for create stmt above
let $iter= 10;
while ($iter > 0)
{
begin;
eval /*insert { hello: { world } }*/insert into t1 values();
eval /*update { { hello : world } }*/update t1 set a= a + 1;
/*delete { }*/delete from t1;
commit;
dec $iter;
}
enable_result_log;
enable_query_log;
--source include/sync_slave_sql_with_master.inc

# Check binlogs for meta data
--source include/rpl_connection_master.inc
disable_query_log;
let $MYSQLD_DATADIR = `select @@datadir`;
let $MYSQLD_SECURE_FILE_DIR = `select @@secure_file_priv`;
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;
set sql_log_bin=0;
create table test.meta_data(meta text);
eval load data infile '$MYSQLD_SECURE_FILE_DIR/meta_data.dat' into table test.meta_data;
select meta, count(*) from test.meta_data group by meta;
drop table test.meta_data;
set sql_log_bin=1;
remove_file $MYSQLD_SECURE_FILE_DIR/meta_data.dat;

--source include/rpl_connection_slave.inc
let $MYSQLD_DATADIR = `select @@datadir`;
let $MYSQLD_SECURE_FILE_DIR = `select @@secure_file_priv`;
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;
set sql_log_bin=0;
create table test.meta_data(meta text);
eval load data infile '$MYSQLD_SECURE_FILE_DIR/meta_data.dat' into table test.meta_data;
select meta, count(*) from test.meta_data group by meta;
drop table test.meta_data;
set sql_log_bin=1;
remove_file $MYSQLD_SECURE_FILE_DIR/meta_data.dat;
enable_query_log;

# Cleanup
--source include/rpl_connection_master.inc
drop table t1;
78 changes: 78 additions & 0 deletions mysql-test/suite/rpl/r/binlog_db_metadata.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection master]
set @save.binlog_trx_meta_data= @@global.binlog_trx_meta_data;
set @@global.binlog_trx_meta_data= true;
set @save.binlog_trx_meta_data= @@global.binlog_trx_meta_data;
set @@global.binlog_trx_meta_data= true;
drop database if exists test2;
drop database if exists test3;
drop database if exists test4;
create database test2 db_metadata '{"shard":"test2_shard", "replicaset":"test2_replicaset"}';
create database test3 db_metadata '{"shard":"test3_shard", "replicaset":"test3_replicaset"}';
use test;
create table t1 (a int primary key, b char(8));
insert into t1 values(1, 'a');
insert into t1 values(2, 'b');
use test2;
create table t1 (a int primary key, b char(8));
insert into t1 values(1, 'a');
insert into t1 values(2, 'b');
use test3;
create table t1 (a int primary key, b char(8));
insert into t1 values(1, 'a');
insert into t1 values(2, 'b');
alter database test3 db_metadata '{"shard":"test3_shard_updated", "replicaset":"test3_replicaset_updated"}';
insert into t1 values(3, 'c');
insert into t1 values(4, 'd');
create database test4 db_metadata '{"shard":"newly_added_shard_for_test4", "replicaset":"new_replicaset_for_test4"}';
insert into t1 values(5, 'e');
insert into t1 values(6, 'f');
use test4;
create table t1 (a int primary key, b char(8));
insert into t1 values(1, 'a');
insert into t1 values(2, 'b');
# /*::TRX_META_DATA::{"ts":[ts]}*/
# /*::TRX_META_DATA::{"ts":[ts]}*/
# /*::TRX_META_DATA::{"ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts]}*/
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts]}*/
include/sync_slave_sql_with_master.inc
# /*::TRX_META_DATA::{"ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"test2_shard","replicaset":"test2_replicaset","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard","replicaset":"test3_replicaset","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"test3_shard_updated","replicaset":"test3_replicaset_updated","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts,ts]}*/
# /*::TRX_META_DATA::{"shard":"newly_added_shard_for_test4","replicaset":"new_replicaset_for_test4","ts":[ts,ts]}*/
use test;
drop table if exists t1;
drop database if exists test2;
drop database if exists test3;
drop database if exists test4;
include/sync_slave_sql_with_master.inc
set @@global.binlog_trx_meta_data= @save.binlog_trx_meta_data;
set @@global.binlog_trx_meta_data= @save.binlog_trx_meta_data;
include/rpl_end.inc
34 changes: 34 additions & 0 deletions mysql-test/suite/rpl/r/binlog_trx_meta_data.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection master]
[connection master]
set @@global.binlog_trx_meta_data= true;
[connection slave]
set @@global.binlog_trx_meta_data= true;
[connection master]
include/sync_slave_sql_with_master.inc
[connection master]
flush logs;
include/sync_slave_sql_with_master.inc
[connection master]
purge binary logs to 'master-bin.000002';
[connection slave]
flush logs;
purge binary logs to 'slave-bin.000002';
[connection master]
include/sync_slave_sql_with_master.inc
[connection master]
meta count(*)
# /*::TRX_META_DATA::{"ts":[ts]}*/ 31
[connection slave]
meta count(*)
# /*::TRX_META_DATA::{"ts":[ts,ts]}*/ 31
[connection master]
drop table t1;
[connection master]
set @@global.binlog_trx_meta_data= 0;
[connection slave]
set @@global.binlog_trx_meta_data= 0;
include/rpl_end.inc
Loading

0 comments on commit 3847e40

Please sign in to comment.