PT-2340 - Support MySQL 8.4

- Added test for replica lag check for pt-archiver
- Re-added deprecated slave- options
- Added tests for deprecation warnings and for legacy options for pt-archiver
- Removed practically not supported options --replica-user and --replica-password from pt-archiver, pt-kill, pt-query-digest
- Added legacy source/replica options (master/slave) variants and tests for pt-heartbeat, pt-online-schema-change, pt-replica-find, pt-replica-restart, pt-table-checksum, pt-table-sync
- Updated modules after lib/MasterSlave.pm change
This commit is contained in:
Sveta Smirnova
2024-09-24 03:04:46 +03:00
parent 1de149116a
commit 33086769a1
29 changed files with 2122 additions and 139 deletions

View File

@@ -44,7 +44,7 @@ elsif ( !$replica2_dbh ) {
plan skip_all => 'Cannot connect to second sandbox replica';
}
else {
plan tests => 10;
plan tests => 13;
}
my @args = ('h=127.0.0.1,P=12345,u=msandbox,p=msandbox,s=1');
@@ -68,6 +68,63 @@ my $expected = <<EOF;
EOF
is($output, $expected, 'Source with replica and replica of replica');
###############################################################################
# Test --replica-user and --replica-password options
###############################################################################
# Create a new user that is going to be replicated on replicas.
if ($sandbox_version eq '8.0') {
$sb->do_as_root("replica1", q/CREATE USER 'replica_user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'replica_password'/);
} else {
$sb->do_as_root("replica1", q/CREATE USER 'replica_user'@'localhost' IDENTIFIED BY 'replica_password'/);
}
$sb->do_as_root("replica1", q/GRANT REPLICATION CLIENT ON *.* TO 'replica_user'@'localhost'/);
$sb->do_as_root("replica1", q/GRANT REPLICATION SLAVE ON *.* TO 'replica_user'@'localhost'/);
$sb->do_as_root("replica1", q/FLUSH PRIVILEGES/);
$sb->wait_for_replicas();
# Ensure we cannot connect to replicas using standard credentials
# Since replica2 is a replica of replica1, removing the user from the replica1 will remove
# the user also from replica2
$sb->do_as_root("replica1", q/RENAME USER 'msandbox'@'%' TO 'msandbox_old'@'%'/);
$sb->do_as_root("replica1", q/FLUSH PRIVILEGES/);
$sb->do_as_root("replica1", q/FLUSH TABLES/);
$output = `$trunk/bin/pt-replica-find -h 127.0.0.1 -P 12345 -u msandbox -p msandbox s=1 --report-format hostname --replica-user replica_user --replica-password replica_password`;
$expected = <<EOF;
127.0.0.1:12345
+- 127.0.0.1:12346
+- 127.0.0.1:12347
EOF
is(
$output,
$expected,
'Source with replica and replica of replica with --replica-user/--replica-password'
) or diag($output);
unlike(
$output,
qr/Option --slave-user is deprecated and will be removed in future versions./,
'Deprecation warning not printed for option --replica-user'
) or diag($output);
unlike(
$output,
qr/Option --slave-password is deprecated and will be removed in future versions./,
'Deprecation warning not printed for option --replica-password'
) or diag($output);
# Drop test user
$sb->do_as_root("replica1", q/DROP USER 'replica_user'@'localhost'/);
$sb->do_as_root("replica1", q/FLUSH PRIVILEGES/);
# Restore privilegs for the other tests
$sb->do_as_root("replica1", q/RENAME USER 'msandbox_old'@'%' TO 'msandbox'@'%'/);
$sb->do_as_root("source", q/FLUSH PRIVILEGES/);
$sb->do_as_root("source", q/FLUSH TABLES/);
###############################################################################
# Test --resolve-hostname option (we don't know the hostname of the test
# machine so we settle for any non null string)
@@ -79,20 +136,6 @@ like (
"--resolve-address option"
) or diag($output);
# #############################################################################
# Until MasterSlave::find_replica_hosts() is improved to overcome the problems
# with SHOW REPLICA HOSTS, this test won't work.
# #############################################################################
# Make replica2 replica of source.
#diag(`../../mk-slave-move/mk-slave-move --sibling-of-master h=127.1,P=12347`);
#$output = `perl ../mk-slave-find -h 127.0.0.1 -P 12345 -u msandbox -p msandbox`;
#$expected = <<EOF;
#127.0.0.1:12345
#+- 127.0.0.1:12346
#+- 127.0.0.1:12347
#EOF
#is($output, $expected, 'Source with two replicas');
# #########################################################################
# Issue 391: Add --pid option to all scripts
# #########################################################################