PT-2340 - Support MySQL 8.4

- Removed runtime.txt after discussion with Anastasia Alexandrova
- Added "use VersionParser" into tests in t/lib when needed
- Removed word master from tests for pt-archiver, pt-config-diff, pt-deadlock-logger, pt-duplicate-key-checker, pt-find, pt-fk-error-logger, pt-heartbeat, pt-index-usage, pt-ioprofile, pt-kill, pt-mysql-summary
- Removed word slave from tests for pt-archiver, pt-config-diff, pt-deadlock-logger, pt-duplicate-key-checker, pt-find, pt-fk-error-logger, pt-heartbeat, pt-index-usage, pt-ioprofile, pt-kill, pt-mysql-summary
- Updated modules for pt-archiver, pt-config-diff, pt-deadlock-logger, pt-duplicate-key-checker, pt-find, pt-fk-error-logger, pt-heartbeat, pt-index-usage, pt-ioprofile, pt-kill, pt-mysql-summary
- Changed mysql_ssl patch, so it is now short option s
- Added a check for existing zombies in t/pt-kill/execute_command.t
- Added bin/pt-galera-log-explainer to .gitignore
This commit is contained in:
Sveta Smirnova
2024-07-26 13:35:29 +03:00
parent 8cbb5a0c8f
commit 5c999ca3e0
114 changed files with 1898 additions and 1455 deletions

View File

@@ -25,18 +25,18 @@ require "$trunk/bin/pt-heartbeat";
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $master_dbh = $sb->get_dbh_for('master');
my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
my $source_dbh = $sb->get_dbh_for('source');
my $source_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
my ($tfh, $pid_file) = tempfile();
close($tfh);
unlink($pid_file);
my $slave1_dbh = $sb->get_dbh_for('slave1');
my $slave1_dsn = 'h=127.1,P=12346,u=unprivileged,p=password';
my $replica1_dbh = $sb->get_dbh_for('replica1');
my $replica1_dsn = 'h=127.1,P=12346,u=unprivileged,p=password,s=1';
if ( !$master_dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
if ( !$source_dbh ) {
plan skip_all => 'Cannot connect to sandbox source';
}
sub start_thread {
@@ -44,7 +44,7 @@ sub start_thread {
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh= $sb->get_dbh_for('slave1');
my $dbh= $sb->get_dbh_for('replica1');
diag("Thread started");
warn "Sleeping $sleep seconds";
@@ -57,28 +57,28 @@ my $create_table_sql = <<__EOQ;
CREATE TABLE IF NOT EXISTS sakila.heartbeat (
ts varchar(26) NOT NULL,
server_id int unsigned NOT NULL PRIMARY KEY,
file varchar(255) DEFAULT NULL, -- SHOW MASTER STATUS
position bigint unsigned DEFAULT NULL, -- SHOW MASTER STATUS
relay_master_log_file varchar(255) DEFAULT NULL, -- SHOW SLAVE STATUS
exec_master_log_pos bigint unsigned DEFAULT NULL -- SHOW SLAVE STATUS
file varchar(255) DEFAULT NULL, -- SHOW BINARY LOG STATUS
position bigint unsigned DEFAULT NULL, -- SHOW BINARY LOG STATUS
relay_${source_name}_log_file varchar(255) DEFAULT NULL, -- SHOW REPLICA STATUS
exec_${source_name}_log_pos bigint unsigned DEFAULT NULL -- SHOW REPLICA STATUS
);
__EOQ
$sb->do_as_root('master', "$create_table_sql");
if ($sandbox_version ge '8.0') {
$sb->do_as_root('slave1', 'CREATE USER "unprivileged"@"localhost" IDENTIFIED WITH mysql_native_password BY "password"');
$sb->do_as_root('source', "$create_table_sql");
if ($sandbox_version eq '8.0') {
$sb->do_as_root('replica1', 'CREATE USER "unprivileged"@"localhost" IDENTIFIED WITH mysql_native_password BY "password"');
} else {
$sb->do_as_root('slave1', 'CREATE USER "unprivileged"@"localhost" IDENTIFIED BY "password"');
$sb->do_as_root('replica1', 'CREATE USER "unprivileged"@"localhost" IDENTIFIED BY "password"');
}
$sb->do_as_root('slave1', 'GRANT SELECT, INSERT, UPDATE, REPLICATION CLIENT ON *.* TO "unprivileged"@"localhost"');
$sb->do_as_root('slave1', "FLUSH TABLES WITH READ LOCK;");
$sb->do_as_root('slave1', "SET GLOBAL read_only = 1;");
$sb->do_as_root('replica1', 'GRANT SELECT, INSERT, UPDATE, REPLICATION CLIENT ON *.* TO "unprivileged"@"localhost"');
$sb->do_as_root('replica1', "FLUSH TABLES WITH READ LOCK;");
$sb->do_as_root('replica1', "SET GLOBAL read_only = 1;");
my $thread = threads->create('start_thread', $dsn_opts, 4, $pid_file);
$thread->detach();
threads->yield();
my $output = `PTDEBUG=1 $trunk/bin/pt-heartbeat --database=sakila --table heartbeat --read-only-interval 2 --check-read-only --run-time 5 --update $slave1_dsn 2>&1`;
my $output = `PTDEBUG=1 $trunk/bin/pt-heartbeat --database=sakila --table heartbeat --read-only-interval 2 --check-read-only --run-time 5 --update $replica1_dsn 2>&1`;
like (
$output,
@@ -86,14 +86,14 @@ like (
'PT-1508 --read-only-interval',
);
$master_dbh->do("DROP DATABASE IF EXISTS test");
$source_dbh->do("DROP DATABASE IF EXISTS test");
# #############################################################################
# Done.
# #############################################################################
$sb->do_as_root('master', 'DROP TABLE IF EXISTS sakila.heartbeat');
$sb->do_as_root('slave1', 'DROP USER "unprivileged"@"localhost"');
$sb->do_as_root('source', 'DROP TABLE IF EXISTS sakila.heartbeat');
$sb->do_as_root('replica1', 'DROP USER "unprivileged"@"localhost"');
$sb->wipe_clean($master_dbh);
$sb->wipe_clean($source_dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
done_testing;