PT-2340 - Support MySQL 8.4

- Updated modules and tests for pt-query-digest, pt-show-grants, pt-slave-delay, pt-slave-find, pt-slave-restart, pt-stalk, pt-summary, pt-table-checksum
This commit is contained in:
Sveta Smirnova
2024-07-30 18:35:36 +03:00
parent 76c1202cb5
commit d02355f89b
94 changed files with 2930 additions and 2306 deletions

View File

@@ -15,13 +15,14 @@ use Time::HiRes qw(sleep);
use PerconaTest;
use DSNParser;
use Sandbox;
require VersionParser;
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
my $dbh = $sb->get_dbh_for('source');
if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
plan skip_all => 'Cannot connect to sandbox source';
}
my $cnf = "/tmp/12345/my.sandbox.cnf";

View File

@@ -15,14 +15,15 @@ use Time::HiRes qw(sleep);
use PerconaTest;
use DSNParser;
require VersionParser;
use Sandbox;
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
my $dbh = $sb->get_dbh_for('source');
if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
plan skip_all => 'Cannot connect to sandbox source';
}
my $cnf = "/tmp/12345/my.sandbox.cnf";
@@ -54,16 +55,16 @@ sub wait_n_cycles {
}
# ###########################################################################
# Test that SHOW SLAVE STATUS outputs are captured
# Test that SHOW REPLICA STATUS outputs are captured
# ###########################################################################
my $retval = system("$trunk/bin/pt-stalk --no-stalk --run-time 1 --dest $dest --prefix nostalk --pid $pid_file --iterations 1 -- --defaults-file=$cnf --socket=/tmp/12346/mysql_sandbox12346.sock >$log_file 2>&1");
my $output = `cat $dest/nostalk-slave-status|grep Slave_IO_Running`;
my $output = `cat $dest/nostalk-${replica_name}-status|grep -i ${replica_name}_IO_Running`;
like(
$output,
qr/Slave_IO_Running: Yes/,
"SHOW SLAVE STATUS outputs gathered."
qr/${replica_name}_IO_Running: Yes/i,
"SHOW REPLICA STATUS outputs gathered."
);
is(

View File

@@ -16,13 +16,14 @@ use Time::HiRes qw(sleep);
use PerconaTest;
use DSNParser;
use Sandbox;
require VersionParser;
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
my $dbh = $sb->get_dbh_for('source');
if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
plan skip_all => 'Cannot connect to sandbox source';
}
my $cnf = "/tmp/12345/my.sandbox.cnf";
@@ -719,15 +720,15 @@ cleanup();
SKIP: {
skip "Only test on mysql 5.7" if ( $sandbox_version lt '5.7' );
skip "Only test on mysql 5.7+" if ( $sandbox_version lt '5.7' );
sub start_thread {
# this must run in a thread because we need to have an uncommitted transaction
my ($dsn_opts) = @_;
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
$sb->load_file('master', "t/pt-stalk/samples/issue-1642751.sql");
my $dbh = $sb->get_dbh_for('source');
$sb->load_file('source', "t/pt-stalk/samples/issue-1642751.sql");
}
my $thr = threads->create('start_thread', $dsn_opts);
$thr->detach();
@@ -745,13 +746,13 @@ SKIP: {
like(
$output,
qr/ STATE: ACTIVE/,
"MySQL 5.7 ACTIVE transactions"
"MySQL 5.7+ ACTIVE transactions"
);
like(
$output,
qr/ STATE: COMMITTED/,
"MySQL 5.7 COMMITTED transactions"
"MySQL 5.7+ COMMITTED transactions"
);
cleanup();
@@ -759,57 +760,57 @@ SKIP: {
SKIP: {
skip "Only test on mysql 5.7" if ( $sandbox_version lt '5.7' );
skip "Only test on mysql 5.7+" if ( $sandbox_version lt '5.7' );
my ($master1_dbh, $master1_dsn) = $sb->start_sandbox(
server => 'chan_master1',
type => 'master',
my ($source1_dbh, $source1_dsn) = $sb->start_sandbox(
server => 'chan_source1',
type => 'source',
);
my ($master2_dbh, $master2_dsn) = $sb->start_sandbox(
server => 'chan_master2',
type => 'master',
my ($source2_dbh, $source2_dsn) = $sb->start_sandbox(
server => 'chan_source2',
type => 'source',
);
my ($slave1_dbh, $slave1_dsn) = $sb->start_sandbox(
server => 'chan_slave1',
type => 'master',
my ($replica1_dbh, $replica1_dsn) = $sb->start_sandbox(
server => 'chan_replica1',
type => 'source',
);
my $slave1_port = $sb->port_for('chan_slave1');
my $replica1_port = $sb->port_for('chan_replica1');
$sb->load_file('chan_master1', "sandbox/gtid_on.sql", undef, no_wait => 1);
$sb->load_file('chan_master2', "sandbox/gtid_on.sql", undef, no_wait => 1);
$sb->load_file('chan_slave1', "sandbox/slave_channels_t.sql", undef, no_wait => 1);
$sb->load_file('chan_source1', "sandbox/gtid_on.sql", undef, no_wait => 1);
$sb->load_file('chan_source2', "sandbox/gtid_on.sql", undef, no_wait => 1);
$sb->load_file('chan_replica1', "sandbox/replica_channels.sql", undef, no_wait => 1);
my $slave_cnf = "/tmp/$slave1_port/my.sandbox.cnf";
my $cmd = "$trunk/bin/pt-stalk --no-stalk --iterations=1 --host=127.0.0.1 --port=$slave1_port --user=msandbox "
my $replica_cnf = "/tmp/$replica1_port/my.sandbox.cnf";
my $cmd = "$trunk/bin/pt-stalk --no-stalk --iterations=1 --host=127.0.0.1 --port=$replica1_port --user=msandbox "
. "--password=msandbox --sleep 0 --run-time=10 --dest $dest --log $log_file --iterations=1 "
. "--run-time=2 --pid $pid_file --defaults-file=$slave_cnf >$log_file 2>&1";
. "--run-time=2 --pid $pid_file --defaults-file=$replica_cnf >$log_file 2>&1";
diag ($cmd);
system($cmd);
sleep 5;
PerconaTest::kill_program(pid_file => $pid_file);
$output = `cat $dest/*-slave-status 2>/dev/null`;
$output = `cat $dest/*-${replica_name}-status 2>/dev/null`;
like(
$output,
qr/SERVICE_STATE: ON/,
"MySQL 5.7 SLAVE STATUS"
"MySQL 5.7+ REPLICA STATUS"
) or diag ($output);
$sb->stop_sandbox(qw(chan_master1 chan_master2 chan_slave1));
$sb->stop_sandbox(qw(chan_source1 chan_source2 chan_replica1));
}
SKIP: {
skip "Only test on mysql 5.6" if ( $sandbox_version ne '5.6' );
my $slave1_port = $sb->port_for('slave1');
my $cmd = "$trunk/bin/pt-stalk --no-stalk --iterations=1 --host=127.0.0.1 --port=$slave1_port --user=msandbox "
my $replica1_port = $sb->port_for('replica1');
my $cmd = "$trunk/bin/pt-stalk --no-stalk --iterations=1 --host=127.0.0.1 --port=$replica1_port --user=msandbox "
. "--password=msandbox --sleep 0 --run-time=10 --dest $dest --log $log_file --iterations=1 "
. "--run-time=2 --pid $pid_file --defaults-file=$cnf >$log_file 2>&1";
system($cmd);
sleep 5;
PerconaTest::kill_program(pid_file => $pid_file);
$output = `cat $dest/*-slave-status 2>/dev/null`;
$output = `cat $dest/*-${replica_name}-status 2>/dev/null`;
like(
$output,
@@ -834,8 +835,8 @@ SKIP: {
my ($dsn_opts) = @_;
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
$sb->load_file('master', "t/pt-stalk/samples/issue-1642750.sql");
my $dbh = $sb->get_dbh_for('source');
$sb->load_file('source', "t/pt-stalk/samples/issue-1642750.sql");
}
my $thr = threads->create('start_thread_1642750', $dsn_opts);
$thr->detach();
@@ -878,8 +879,8 @@ sub start_thread_pt_1897_1 {
my ($dsn_opts) = @_;
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
$sb->load_file('master', "t/pt-stalk/samples/PT-1897-1.sql");
my $dbh = $sb->get_dbh_for('source');
$sb->load_file('source', "t/pt-stalk/samples/PT-1897-1.sql");
}
my $thr1 = threads->create('start_thread_pt_1897_1', $dsn_opts);
$thr1->detach();
@@ -892,8 +893,8 @@ sub start_thread_pt_1897_2 {
my ($dsn_opts) = @_;
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
$sb->load_file('master', "t/pt-stalk/samples/PT-1897-2.sql");
my $dbh = $sb->get_dbh_for('source');
$sb->load_file('source', "t/pt-stalk/samples/PT-1897-2.sql");
}
my $thr2 = threads->create('start_thread_pt_1897_2', $dsn_opts);
$thr2->detach();