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

@@ -19,32 +19,32 @@ require "$trunk/bin/pt-table-sync";
my $output;
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $master_dbh = $sb->get_dbh_for('master');
my $slave_dbh = $sb->get_dbh_for('slave1');
my $source_dbh = $sb->get_dbh_for('source');
my $replica_dbh = $sb->get_dbh_for('replica1');
if ( !$master_dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
if ( !$source_dbh ) {
plan skip_all => 'Cannot connect to sandbox source';
}
elsif ( !$slave_dbh ) {
plan skip_all => 'Cannot connect to sandbox slave';
elsif ( !$replica_dbh ) {
plan skip_all => 'Cannot connect to sandbox replica';
}
my $master_dsn = $sb->dsn_for('master');
my $slave1_dsn = $sb->dsn_for('slave1');
my $source_dsn = $sb->dsn_for('source');
my $replica1_dsn = $sb->dsn_for('replica1');
# #############################################################################
# Issue 410: mk-table-sync doesn't have --float-precision
# #############################################################################
$sb->create_dbs($master_dbh, ['test']);
$master_dbh->do('create table test.fl (id int not null primary key, f float(12,10), d double)');
$master_dbh->do('insert into test.fl values (1, 1.0000012, 2.0000012)');
$sb->wait_for_slaves();
$slave_dbh->do('update test.fl set d = 2.0000013 where id = 1');
$sb->create_dbs($source_dbh, ['test']);
$source_dbh->do('create table test.fl (id int not null primary key, f float(12,10), d double)');
$source_dbh->do('insert into test.fl values (1, 1.0000012, 2.0000012)');
$sb->wait_for_replicas();
$replica_dbh->do('update test.fl set d = 2.0000013 where id = 1');
# The columns really are different at this point so we should
# get a REPLACE without using --float-precision.
$output = `$trunk/bin/pt-table-sync --sync-to-master h=127.1,P=12346,u=msandbox,p=msandbox,D=test,t=fl --print 2>&1`;
$output = `$trunk/bin/pt-table-sync --sync-to-source h=127.1,P=12346,u=msandbox,p=msandbox,D=test,t=fl --print 2>&1`;
$output = remove_traces($output);
is(
$output,
@@ -56,7 +56,7 @@ is(
# Now use --float-precision to roundoff the differing columns.
# We have 2.0000012
# vs. 2.0000013, so if we round at 6 places, they should be the same.
$output = `$trunk/bin/pt-table-sync --sync-to-master h=127.1,P=12346,u=msandbox,p=msandbox,D=test,t=fl --print --float-precision 6 2>&1`;
$output = `$trunk/bin/pt-table-sync --sync-to-source h=127.1,P=12346,u=msandbox,p=msandbox,D=test,t=fl --print --float-precision 6 2>&1`;
is(
$output,
'',
@@ -68,19 +68,19 @@ is(
# https://bugs.launchpad.net/percona-toolkit/+bug/1229861
# #############################################################################
$sb->load_file('master', "t/pt-table-sync/samples/sync-float.sql");
$slave_dbh->do("INSERT INTO sync_float_1229861.t (`c1`, `c2`, `c3`, `snrmin`, `snrmax`, `snravg`) VALUES (1,1,1,29.5,33.5,31.6)");
$sb->load_file('source', "t/pt-table-sync/samples/sync-float.sql");
$replica_dbh->do("INSERT INTO sync_float_1229861.t (`c1`, `c2`, `c3`, `snrmin`, `snrmax`, `snravg`) VALUES (1,1,1,29.5,33.5,31.6)");
$output = output(sub {
pt_table_sync::main(
"$master_dsn,D=sync_float_1229861,t=t",
"$slave1_dsn",
qw(--no-check-slave --print --execute))
"$source_dsn,D=sync_float_1229861,t=t",
"$replica1_dsn",
qw(--no-check-replica --print --execute))
},
stderr => 1,
);
my $rows = $slave_dbh->selectall_arrayref("SELECT * FROM sync_float_1229861.t");
my $rows = $replica_dbh->selectall_arrayref("SELECT * FROM sync_float_1229861.t");
is_deeply(
$rows,
[],
@@ -90,7 +90,7 @@ is_deeply(
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($master_dbh);
$sb->wipe_clean($slave_dbh);
$sb->wipe_clean($source_dbh);
$sb->wipe_clean($replica_dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
done_testing;