PT-2340 - Support MySQL 8.4

- Fixed 5.7 tests
This commit is contained in:
Sveta Smirnova
2024-08-25 04:36:37 +03:00
parent b332537481
commit 194bb99ef9
7 changed files with 83 additions and 32 deletions

View File

@@ -0,0 +1,15 @@
STOP SLAVE FOR CHANNEL '';
SET GLOBAL master_info_repository = 'TABLE';
SET @@GLOBAL.relay_log_info_repository = 'TABLE';
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY=ON;
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;
SET @@GLOBAL.GTID_MODE = ON;
CHANGE MASTER TO master_host='127.0.0.1', master_port=2900, master_user='msandbox', master_password='msandbox', master_auto_position=1 FOR CHANNEL 'sourcechan1';
CHANGE MASTER TO master_host='127.0.0.1', master_port=2901, master_user='msandbox', master_password='msandbox', master_auto_position=1 FOR CHANNEL 'sourcechan2';
START SLAVE for channel 'sourcechan1';
START SLAVE for channel 'sourcechan2';

View File

@@ -0,0 +1,13 @@
STOP REPLICA FOR CHANNEL '';
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY=ON;
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;
SET @@GLOBAL.GTID_MODE = ON;
CHANGE REPLICATION SOURCE TO source_host='127.0.0.1', source_port=2900, source_user='msandbox', source_password='msandbox', source_auto_position=1 FOR CHANNEL 'sourcechan1';
CHANGE REPLICATION SOURCE TO source_host='127.0.0.1', source_port=2901, source_user='msandbox', source_password='msandbox', source_auto_position=1 FOR CHANNEL 'sourcechan2';
START REPLICA for channel 'sourcechan1';
START REPLICA for channel 'sourcechan2';

View File

@@ -782,9 +782,15 @@ SKIP: {
);
my $slave1_port = $sb->port_for('chan_replica1');
$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);
if ( $sandbox_version lt '8.1' ) {
$sb->load_file('chan_source1', "sandbox/gtid_on-legacy.sql", undef, no_wait => 1);
$sb->load_file('chan_source2', "sandbox/gtid_on-legacy.sql", undef, no_wait => 1);
$sb->load_file('chan_replica1', "sandbox/replica_channels-legacy.sql", undef, no_wait => 1);
} else {
$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 $chan_slaves;
eval {

View File

@@ -1062,15 +1062,15 @@ SKIP: {
# We need to create a new server here, otherwise the whole test suite might die
# if the crashed table can't be dropped.
my $master3_port = 2900;
my $master_basedir = "/tmp/$master3_port";
diag(`$trunk/sandbox/stop-sandbox $master3_port >/dev/null`);
diag(`$trunk/sandbox/start-sandbox master $master3_port >/dev/null`);
my $dbh3 = $sb->get_dbh_for("master3");
my $source3_port = 2900;
my $source_basedir = "/tmp/$source3_port";
diag(`$trunk/sandbox/stop-sandbox $source3_port >/dev/null`);
diag(`$trunk/sandbox/start-sandbox source $source3_port >/dev/null`);
my $dbh3 = $sb->get_dbh_for("source3");
$sb->load_file('master3', "t/lib/samples/bug_1047335_crashed_table.sql");
$sb->load_file('source3', "t/lib/samples/bug_1047335_crashed_table.sql");
my $db_dir = "$master_basedir/data/bug_1047335";
my $db_dir = "$source_basedir/data/bug_1047335";
my $myi = glob("$db_dir/crashed_table.[Mm][Yy][Iy]");
my $frm = glob("$db_dir/crashed_table.[Ff][Rr][Mm]");
@@ -1107,7 +1107,7 @@ SKIP: {
$dbh3->do(q{CREATE DATABASE bug_1047335_2});
my $broken_frm = "$trunk/t/lib/samples/broken_tbl.frm";
my $db_dir_2 = "$master_basedir/data/bug_1047335_2";
my $db_dir_2 = "$source_basedir/data/bug_1047335_2";
diag(`cp $broken_frm $db_dir_2 2>&1`);
@@ -1119,7 +1119,7 @@ SKIP: {
"get_create_table dies if SHOW CREATE TABLE failed (using broken_tbl.frm)",
);
diag(`$trunk/sandbox/stop-sandbox $master3_port >/dev/null`);
diag(`$trunk/sandbox/stop-sandbox $source3_port >/dev/null`);
}
# #############################################################################

View File

@@ -45,9 +45,15 @@ my ($replica1_dbh, $replica1_dsn) = $sb->start_sandbox(
);
my $replica1_port = $sb->port_for('chan_replica1');
$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);
if ( $sandbox_version lt '8.1' ) {
$sb->load_file('chan_source1', "sandbox/gtid_on-legacy.sql", undef, no_wait => 1);
$sb->load_file('chan_source2', "sandbox/gtid_on-legacy.sql", undef, no_wait => 1);
$sb->load_file('chan_replica1', "sandbox/replica_channels-legacy.sql", undef, no_wait => 1);
} else {
$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 $source1_port = $sb->port_for('chan_source1');
my $num_rows = 40000;

View File

@@ -775,16 +775,21 @@ SKIP: {
type => 'source',
);
my $replica1_port = $sb->port_for('chan_replica1');
$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);
if ( $sandbox_version lt '8.1' ) {
$sb->load_file('chan_source1', "sandbox/gtid_on-legacy.sql", undef, no_wait => 1);
$sb->load_file('chan_source2', "sandbox/gtid_on-legacy.sql", undef, no_wait => 1);
$sb->load_file('chan_replica1', "sandbox/replica_channels_t-legacy.sql", undef, no_wait => 1);
} else {
$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_t.sql", undef, no_wait => 1);
}
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=$replica_cnf >$log_file 2>&1";
diag ($cmd);
system($cmd);
sleep 5;
PerconaTest::kill_program(pid_file => $pid_file);
@@ -806,14 +811,14 @@ SKIP: {
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/*-${replica_name}-status 2>/dev/null`;
like(
$output,
system($cmd);
sleep 5;
PerconaTest::kill_program(pid_file => $pid_file);
$output = `cat $dest/*-${replica_name}-status 2>/dev/null`;
like(
$output,
qr/SHOW SLAVE STATUS/,
"MySQL 5.6 SLAVE STATUS"
);

View File

@@ -45,9 +45,15 @@ my ($replica1_dbh, $replica1_dsn) = $sb->start_sandbox(
);
my $replica1_port = $sb->port_for('chan_replica1');
$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);
if ( $sandbox_version lt '8.1' ) {
$sb->load_file('chan_source1', "sandbox/gtid_on-legacy.sql", undef, no_wait => 1);
$sb->load_file('chan_source2', "sandbox/gtid_on-legacy.sql", undef, no_wait => 1);
$sb->load_file('chan_replica1', "sandbox/replica_channels-legacy.sql", undef, no_wait => 1);
} else {
$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 @args = qw(--execute --no-foreign-key-checks --verbose --databases=sakila --tables=actor --sync-to-source --channel=sourcechan1);
my $exit_status;
@@ -61,7 +67,7 @@ like (
$output,
qr/sakila.actor/,
'Synced actor table'
);
) or diag($output);
$sb->stop_sandbox(qw(chan_source1 chan_source2 chan_replica1));