mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-24 02:01:42 +08:00
Merge fix-ptc-slave-binglog-formats-on-5.0.
This commit is contained in:
@@ -8555,12 +8555,20 @@ sub main {
|
||||
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/938068
|
||||
if ( $o->get('check-binlog-format') ) {
|
||||
my ($master_binlog) = $master_dbh->selectrow_array(
|
||||
'SELECT @@binlog_format');
|
||||
my $master_binlog = 'STATEMENT';
|
||||
if ( VersionParser->new($master_dbh) >= '5.1.5' ) {
|
||||
($master_binlog) = $master_dbh->selectrow_array(
|
||||
'SELECT @@binlog_format');
|
||||
}
|
||||
|
||||
my $err = '';
|
||||
for my $slave_cxn (@$slaves) {
|
||||
my ($slave_binlog) = $slave_cxn->dbh->selectrow_array(
|
||||
'SELECT @@binlog_format');
|
||||
my $slave_binlog = 'STATEMENT';
|
||||
if ( VersionParser->new($slave_cxn->dbh) >= '5.1.5' ) {
|
||||
($slave_binlog) = $slave_cxn->dbh->selectrow_array(
|
||||
'SELECT @@binlog_format');
|
||||
}
|
||||
|
||||
if ( $master_binlog ne $slave_binlog ) {
|
||||
$err .= $master_cxn->name() . " has binlog_format "
|
||||
. $master_binlog . " but replica " . $slave_cxn->name()
|
||||
|
||||
@@ -180,9 +180,10 @@ is(
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1016131
|
||||
# #############################################################################
|
||||
|
||||
($output) = full_output(
|
||||
($output) = output(
|
||||
sub { pt_table_checksum::main(@args, '--tables', 'mysql.user,mysql.host',
|
||||
'--columns', 'some_fale_column') },
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
like(
|
||||
@@ -196,30 +197,33 @@ like(
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/938068
|
||||
# #############################################################################
|
||||
|
||||
{
|
||||
diag("Adding two new slaves to master");
|
||||
local $ENV{BINLOG_FORMAT} = 'ROW';
|
||||
diag(`$trunk/sandbox/start-sandbox slave 12348 12345`);
|
||||
local $ENV{BINLOG_FORMAT} = 'MIXED';
|
||||
diag(`$trunk/sandbox/start-sandbox slave 12349 12348`);
|
||||
SKIP: {
|
||||
skip "binlog_format tests require MySQL 5.1 and newer", 2
|
||||
unless $sandbox_version ge '5.1';
|
||||
|
||||
$output = output( sub { pt_table_checksum::main(@args) }, stderr => 1 );
|
||||
local $ENV{BINLOG_FORMAT} = 'ROW';
|
||||
diag(`$trunk/sandbox/start-sandbox slave 12348 12345`);
|
||||
local $ENV{BINLOG_FORMAT} = 'MIXED';
|
||||
diag(`$trunk/sandbox/start-sandbox slave 12349 12348`);
|
||||
|
||||
my $re = qr/ has binlog_format .*? has binlog_format (\S+)\./msi;
|
||||
like(
|
||||
$output,
|
||||
$re,
|
||||
"Bug 938068: doesn't warn if binlog_format=row or mixed on slaves"
|
||||
);
|
||||
$output = output( sub { pt_table_checksum::main(@args) }, stderr => 1 );
|
||||
|
||||
is_deeply(
|
||||
[ $output =~ /$re/g ],
|
||||
[ 'ROW', 'MIXED' ],
|
||||
"...and warns for both level 1 and level 2 slaves"
|
||||
) or diag($output);
|
||||
my $re = qr/ has binlog_format .*? has binlog_format (\S+)\./msi;
|
||||
like(
|
||||
$output,
|
||||
$re,
|
||||
"Bug 938068: doesn't warn if binlog_format=row or mixed on slaves"
|
||||
);
|
||||
|
||||
diag(`$trunk/sandbox/stop-sandbox 12348 12349`);
|
||||
is_deeply(
|
||||
[ $output =~ /$re/g ],
|
||||
[ 'ROW', 'MIXED' ],
|
||||
"...and warns for both level 1 and level 2 slaves"
|
||||
) or diag($output);
|
||||
|
||||
diag(`$trunk/sandbox/stop-sandbox 12348 12349`);
|
||||
}
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
||||
Reference in New Issue
Block a user