PT-2340 - Support MySQL 8.4

- Updated modules and tests for pt-table-sync, pt-table-usage, pt-upgrade, pt-variable-advisor
This commit is contained in:
Sveta Smirnova
2024-08-03 17:03:48 +03:00
parent 56599f01ad
commit a38bee6d60
69 changed files with 1442 additions and 1304 deletions

View File

@@ -18,32 +18,32 @@ require "$trunk/bin/pt-table-sync";
sub set_binlog_format {
my ($sb, $format) = @_;
my $master_dbh = $sb->get_dbh_for('master');
my $slave1_dbh = $sb->get_dbh_for('slave1');
my $slave2_dbh = $sb->get_dbh_for('slave2');
my $source_dbh = $sb->get_dbh_for('source');
my $replica1_dbh = $sb->get_dbh_for('replica1');
my $replica2_dbh = $sb->get_dbh_for('replica2');
$slave2_dbh->do("STOP SLAVE");
$slave1_dbh->do("STOP SLAVE");
$replica2_dbh->do("STOP ${replica_name}");
$replica1_dbh->do("STOP ${replica_name}");
$slave2_dbh->do("SET GLOBAL binlog_format='$format'");
$slave1_dbh->do("SET GLOBAL binlog_format='$format'");
$master_dbh->do("SET GLOBAL binlog_format='$format'");
$replica2_dbh->do("SET GLOBAL binlog_format='$format'");
$replica1_dbh->do("SET GLOBAL binlog_format='$format'");
$source_dbh->do("SET GLOBAL binlog_format='$format'");
$slave2_dbh->do("START SLAVE");
$slave1_dbh->do("START SLAVE");
$replica2_dbh->do("START ${replica_name}");
$replica1_dbh->do("START ${replica_name}");
}
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp, env => q/BINLOG_FORMAT="ROW"/);
my $master_dbh = $sb->get_dbh_for('master');
my $master_dsn = $sb->dsn_for('master');
my $slave_dsn = $sb->dsn_for('slave1');
my $source_dbh = $sb->get_dbh_for('source');
my $source_dsn = $sb->dsn_for('source');
my $replica_dsn = $sb->dsn_for('replica1');
if ( !$master_dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
} elsif ($sb->has_engine('master', 'rocksdb') != 1) {
if ( !$source_dbh ) {
plan skip_all => 'Cannot connect to sandbox source';
} elsif ($sb->has_engine('source', 'rocksdb') != 1) {
plan skip_all => 'This test needs RocksDB engine';
} else {
plan tests => 4;
@@ -51,12 +51,12 @@ if ( !$master_dbh ) {
set_binlog_format($sb, 'ROW');
$master_dbh->disconnect();
$master_dbh = $sb->get_dbh_for('master');
$source_dbh->disconnect();
$source_dbh = $sb->get_dbh_for('source');
$sb->load_file('master', 't/pt-table-sync/samples/pt_221.sql');
$sb->load_file('source', 't/pt-table-sync/samples/pt_221.sql');
my @args = ('--sync-to-master', $slave_dsn, qw(-t test.t1 --print --execute));
my @args = ('--sync-to-source', $replica_dsn, qw(-t test.t1 --print --execute));
my ($output, $exit) = full_output(
sub { pt_table_sync::main(@args, qw()) },
@@ -66,18 +66,18 @@ my ($output, $exit) = full_output(
isnt(
$exit,
0,
"PT-221 fails if using --sync-to-master with RocksDB",
"PT-221 fails if using --sync-to-source with RocksDB",
);
like(
$output,
qr/Cannot sync using --sync-to-master with test.t1 due to the limitations of the RocksDB engine/,
"PT-221 Cannot use --sync-to-master with RockSDB",
qr/Cannot sync using --sync-to-source with test.t1 due to the limitations of the RocksDB engine/,
"PT-221 Cannot use --sync-to-source with RockSDB",
);
$sb->wait_for_slaves();
$sb->wait_for_replicas();
@args = ('--replicate', 'test.checksums', $master_dsn, qw(-t test.t1 --print --execute));
@args = ('--replicate', 'test.checksums', $source_dsn, qw(-t test.t1 --print --execute));
($output, $exit) = full_output(
sub { pt_table_sync::main(@args, qw()) },
@@ -95,7 +95,7 @@ set_binlog_format($sb, 'STATEMENT');
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($master_dbh);
$sb->wipe_clean($source_dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");