PT-2340 - Support MySQL 8.4

- Fixed typos
- Added tests for MyRocks and TokuDB clustered indexes into t/pt-duplicate-key-checker/clustered_keys.t
- Updated modules
This commit is contained in:
Sveta Smirnova
2024-09-04 14:32:15 +03:00
parent 94bcfd2b69
commit d03bd604a1
14 changed files with 72 additions and 16 deletions

View File

@@ -2197,7 +2197,7 @@ sub get_keys {
ddl => $key_ddl,
};
if ( ($engine || '') =~ m/InnoDB/i && !$clustered_key ) {
if ( ($engine || '') =~ m/(InnoDB)|(TokuDB)|(RocksDB)/i && !$clustered_key ) {
my $this_key = $keys->{$name};
if ( $this_key->{name} eq 'PRIMARY' ) {
$clustered_key = 'PRIMARY';

View File

@@ -2141,7 +2141,7 @@ sub get_keys {
ddl => $key_ddl,
};
if ( ($engine || '') =~ m/InnoDB/i && !$clustered_key ) {
if ( ($engine || '') =~ m/(InnoDB)|(TokuDB)|(RocksDB)/i && !$clustered_key ) {
my $this_key = $keys->{$name};
if ( $this_key->{name} eq 'PRIMARY' ) {
$clustered_key = 'PRIMARY';

View File

@@ -4045,7 +4045,7 @@ sub get_keys {
ddl => $key_ddl,
};
if ( ($engine || '') =~ m/InnoDB/i && !$clustered_key ) {
if ( ($engine || '') =~ m/(InnoDB)|(TokuDB)|(RocksDB)/i && !$clustered_key ) {
my $this_key = $keys->{$name};
if ( $this_key->{name} eq 'PRIMARY' ) {
$clustered_key = 'PRIMARY';

View File

@@ -3393,7 +3393,7 @@ sub get_keys {
ddl => $key_ddl,
};
if ( ($engine || '') =~ m/InnoDB/i && !$clustered_key ) {
if ( ($engine || '') =~ m/(InnoDB)|(TokuDB)|(RocksDB)/i && !$clustered_key ) {
my $this_key = $keys->{$name};
if ( $this_key->{name} eq 'PRIMARY' ) {
$clustered_key = 'PRIMARY';

View File

@@ -3267,7 +3267,7 @@ sub get_keys {
ddl => $key_ddl,
};
if ( ($engine || '') =~ m/InnoDB/i && !$clustered_key ) {
if ( ($engine || '') =~ m/(InnoDB)|(TokuDB)|(RocksDB)/i && !$clustered_key ) {
my $this_key = $keys->{$name};
if ( $this_key->{name} eq 'PRIMARY' ) {
$clustered_key = 'PRIMARY';

View File

@@ -3583,7 +3583,7 @@ sub get_keys {
ddl => $key_ddl,
};
if ( ($engine || '') =~ m/InnoDB/i && !$clustered_key ) {
if ( ($engine || '') =~ m/(InnoDB)|(TokuDB)|(RocksDB)/i && !$clustered_key ) {
my $this_key = $keys->{$name};
if ( $this_key->{name} eq 'PRIMARY' ) {
$clustered_key = 'PRIMARY';

View File

@@ -9144,7 +9144,7 @@ sub get_keys {
ddl => $key_ddl,
};
if ( ($engine || '') =~ m/InnoDB/i && !$clustered_key ) {
if ( ($engine || '') =~ m/(InnoDB)|(TokuDB)|(RocksDB)/i && !$clustered_key ) {
my $this_key = $keys->{$name};
if ( $this_key->{name} eq 'PRIMARY' ) {
$clustered_key = 'PRIMARY';

View File

@@ -4777,7 +4777,7 @@ sub get_keys {
ddl => $key_ddl,
};
if ( ($engine || '') =~ m/InnoDB/i && !$clustered_key ) {
if ( ($engine || '') =~ m/(InnoDB)|(TokuDB)|(RocksDB)/i && !$clustered_key ) {
my $this_key = $keys->{$name};
if ( $this_key->{name} eq 'PRIMARY' ) {
$clustered_key = 'PRIMARY';

View File

@@ -3121,7 +3121,7 @@ sub get_keys {
ddl => $key_ddl,
};
if ( ($engine || '') =~ m/InnoDB/i && !$clustered_key ) {
if ( ($engine || '') =~ m/(InnoDB)|(TokuDB)|(RocksDB)/i && !$clustered_key ) {
my $this_key = $keys->{$name};
if ( $this_key->{name} eq 'PRIMARY' ) {
$clustered_key = 'PRIMARY';

View File

@@ -562,7 +562,7 @@ sub get_replica_status {
}
}
# Gets SHOW SOURCE STATUS, with column names all lowercased, as a hashref.
# Gets SHOW BINARY LOGS, with column names all lowercased, as a hashref.
sub get_source_status {
my ( $self, $dbh ) = @_;

View File

@@ -567,7 +567,12 @@ sub get_rules {
return 1 if ($mysql_version == '3' && $mysql_version < '3.23' )
|| ($mysql_version == '4' && $mysql_version < '4.1.20')
|| ($mysql_version == '5.0' && $mysql_version < '5.0.37')
|| ($mysql_version == '5.1' && $mysql_version < '5.1.30');
|| ($mysql_version == '5.1' && $mysql_version < '5.1.30')
|| ($mysql_version == '5.5' && $mysql_version < '5.5.8')
|| ($mysql_version == '5.6' && $mysql_version < '5.6.10')
|| ($mysql_version == '5.7' && $mysql_version < '5.7.9')
|| ($mysql_version == '8.0' && $mysql_version < '8.0.11')
;
return 0;
},
},
@@ -577,7 +582,7 @@ sub get_rules {
my ( %args ) = @_;
my $mysql_version = $args{mysql_version};
return 0 unless $mysql_version;
return $mysql_version < '5.1' ? 1 : 0; # 5.1.x
return $mysql_version < '8.0' ? 1 : 0; # 8.x
},
},
};

View File

@@ -233,10 +233,15 @@ make_sandbox() {
if [ -x "$PERCONA_TOOLKIT_SANDBOX/bin/ps-admin" ]; then
# try to enable RocksDB. Only available on Percona Server 5.7.19+
if [ "$version" > "5.6" -a -n "$ENABLE_ROCKSDB" ]; then
sudo rm -f /tmp/ps-admin.err
$PERCONA_TOOLKIT_SANDBOX/bin/ps-admin --enable-rocksdb -u root -pmsandbox -h 127.1 -P $port
fi
if [ "$version" > "5.6" -a -n "$ENABLE_TOKUDB" ]; then
sudo $PERCONA_TOOLKIT_SANDBOX/bin/ps-admin --enable-tokudb -u root -pmsandbox -h 127.1 -P $port
if [ -n "$ENABLE_TOKUDB" ]; then
$PERCONA_TOOLKIT_BRANCH/util/version_cmp $minor_version "8.0.28-19"
if [[ "$?" < "2" ]] && [[ "$version" > "5.6" ]]; then
sudo rm -f /tmp/ps-admin.err
sudo $PERCONA_TOOLKIT_SANDBOX/bin/ps-admin --enable-tokudb -u root -pmsandbox -h 127.1 -P $port
fi
fi
fi

View File

@@ -53,9 +53,55 @@ ok(
: "$sample/issue_295.txt"),
transform_sample => $transform_int
),
"Shorten, not remove, clustered dupes"
"Shorten, not remove, clustered dupes - InnoDB"
) or diag($test_diff);
SKIP: {
skip "This test requires TokuDB", 1 if ( !$sb->has_engine('source', 'TokuDB') ) ;
$dbh->do('SET binlog_format="ROW"');
$dbh->do('ALTER TABLE issue_295.t ENGINE=TokuDB');
ok(
no_diff(
sub { pt_duplicate_key_checker::main(@args, qw(-d issue_295)) },
"$sample/issue_295-51.txt",
transform_sample => $transform_int
),
"Shorten, not remove, clustered dupes - TokuDB"
) or diag($test_diff);
}
SKIP: {
skip "This test requires MyRocks", 1 if ( !$sb->has_engine('source', 'ROCKSDB') ) ;
$dbh->do('SET binlog_format="ROW"');
$dbh->do('ALTER TABLE issue_295.t ENGINE=ROCKSDB');
# MyRocks returns 0 rows istead of 1 in 5.7
# As a result, wrong size duplicate indexes reported
# We are not going to fix this, because 5.7 is EOL
my $transform_len = undef;
if ( $sandbox_version ge '5.7' && $sandbox_version lt '8.0' ) {
$transform_len = sub {
my $txt = slurp_file(shift);
$txt =~ s/Size Duplicate Indexes 0/Size Duplicate Indexes 8/g;
print $txt;
};
}
ok(
no_diff(
sub { pt_duplicate_key_checker::main(@args, qw(-d issue_295)) },
"$sample/issue_295-51.txt",
transform_sample => $transform_int,
transform_result => $transform_len,
),
"Shorten, not remove, clustered dupes - MyRocks"
) or diag($test_diff);
}
# #############################################################################
# Error if InnoDB table has no PK or unique indexes
# https://bugs.launchpad.net/percona-toolkit/+bug/1036804

View File

@@ -37,7 +37,7 @@ my $pid_file = "/tmp/pt-slave-delay-test.$PID";
# Check daemonization. This test used to print to STDOUT, causing
# false-positive test errors. The output isn't needed. The tool
# said "Reconnected to slave" every time it did SHOW SLAVE STATUS,
# said "Reconnected to slave" every time it did SHOW REPLICA STATUS,
# so needlessly. That was removed. Now it will print stuff when
# we kill the process, which we don't want either.
system("$cmd --delay 1m --interval 1s --run-time 5s --daemonize --pid $pid_file >/dev/null 2>&1");