mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 21:51:21 +00:00
WIP
This commit is contained in:
@@ -2546,7 +2546,6 @@ sub get_dbh {
|
|||||||
|
|
||||||
if ( $cxn_string =~ m/mysql/i ) {
|
if ( $cxn_string =~ m/mysql/i ) {
|
||||||
my $sql;
|
my $sql;
|
||||||
|
|
||||||
if ( my ($charset) = $cxn_string =~ m/charset=([\w]+)/ ) {
|
if ( my ($charset) = $cxn_string =~ m/charset=([\w]+)/ ) {
|
||||||
$sql = qq{/*!40101 SET NAMES "$charset"*/};
|
$sql = qq{/*!40101 SET NAMES "$charset"*/};
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
@@ -5932,6 +5931,7 @@ sub _d {
|
|||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
package pt_archiver;
|
package pt_archiver;
|
||||||
|
|
||||||
|
use utf8;
|
||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use List::Util qw(max);
|
use List::Util qw(max);
|
||||||
use IO::File;
|
use IO::File;
|
||||||
@@ -6030,6 +6030,7 @@ sub main {
|
|||||||
$archive_file =~ s/%([dHimsYDt])/$fmt{$1}/g;
|
$archive_file =~ s/%([dHimsYDt])/$fmt{$1}/g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( !$o->got('help') ) {
|
if ( !$o->got('help') ) {
|
||||||
$o->save_error("--source DSN requires a 't' (table) part")
|
$o->save_error("--source DSN requires a 't' (table) part")
|
||||||
unless $src->{t};
|
unless $src->{t};
|
||||||
@@ -6129,6 +6130,14 @@ sub main {
|
|||||||
$dbh->do("SET SQL_LOG_BIN=0");
|
$dbh->do("SET SQL_LOG_BIN=0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my ($dbh_version) = $dbh->selectrow_array("SELECT version()");
|
||||||
|
#if ($dbh_version =~ m/^(\d+\.\d+)\.\d+.*/ && $1 ge '8.0' && !$o->get('charset')) {
|
||||||
|
if ($dbh_version =~ m/^(\d+\.\d+)\.\d+.*/ && $1 ge '8.0') {
|
||||||
|
PTDEBUG && _d("MySQL 8.0+ detected and charset was not specified.\n Setting character_set_client = utf8mb4 and --charset=utf8");
|
||||||
|
$dbh->do('/*!40101 SET character_set_connection = utf8mb4 */;');
|
||||||
|
$o->set('charset', 'utf8');
|
||||||
|
}
|
||||||
|
|
||||||
$table->{dbh} = $dbh;
|
$table->{dbh} = $dbh;
|
||||||
$table->{irot} = get_irot($dbh);
|
$table->{irot} = get_irot($dbh);
|
||||||
|
|
||||||
@@ -6166,7 +6175,10 @@ sub main {
|
|||||||
my $sql = 'SELECT CONCAT(/*!40100 @@session.character_set_connection, */ "")';
|
my $sql = 'SELECT CONCAT(/*!40100 @@session.character_set_connection, */ "")';
|
||||||
PTDEBUG && _d($sql);
|
PTDEBUG && _d($sql);
|
||||||
my ($dbh_charset) = $table->{dbh}->selectrow_array($sql);
|
my ($dbh_charset) = $table->{dbh}->selectrow_array($sql);
|
||||||
if ( ($dbh_charset || "") ne ($table->{info}->{charset} || "") ) {
|
|
||||||
|
if ( ($dbh_charset || "") ne ($table->{info}->{charset} || "") &&
|
||||||
|
!($dbh_charset eq "utf8mb4" && ($table->{info}->{charset} || "") eq ("utf8"))
|
||||||
|
) {
|
||||||
$src->{dbh}->disconnect() if $src && $src->{dbh};
|
$src->{dbh}->disconnect() if $src && $src->{dbh};
|
||||||
$dst->{dbh}->disconnect() if $dst && $dst->{dbh};
|
$dst->{dbh}->disconnect() if $dst && $dst->{dbh};
|
||||||
die "Character set mismatch: "
|
die "Character set mismatch: "
|
||||||
|
@@ -4671,6 +4671,8 @@ type: size; group: Tests
|
|||||||
Table data uses n bytes of space. This tests the Data_length column.
|
Table data uses n bytes of space. This tests the Data_length column.
|
||||||
The specified size can be "NULL" to test where Data_length IS NULL.
|
The specified size can be "NULL" to test where Data_length IS NULL.
|
||||||
|
|
||||||
|
Note: Starting from MySQL 8.0, empty tables return 0 instead of NULL.
|
||||||
|
|
||||||
=item --dblike
|
=item --dblike
|
||||||
|
|
||||||
type: string; group: Tests
|
type: string; group: Tests
|
||||||
|
@@ -542,8 +542,11 @@ sub no_diff {
|
|||||||
$expected_output = "/tmp/pt-test-outfile-trf";
|
$expected_output = "/tmp/pt-test-outfile-trf";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print("====================================================================================================");
|
||||||
|
warn("TEST >>>>>>>>>>>>");
|
||||||
# Determine cmd type and run it.
|
# Determine cmd type and run it.
|
||||||
if ( ref $cmd eq 'CODE' ) {
|
if ( ref $cmd eq 'CODE' ) {
|
||||||
|
diag("CODE >>>>>>>>>>>>>>>>");
|
||||||
output($cmd, file => $tmp_file);
|
output($cmd, file => $tmp_file);
|
||||||
}
|
}
|
||||||
elsif ( $args{cmd_output} ) {
|
elsif ( $args{cmd_output} ) {
|
||||||
|
@@ -77,6 +77,7 @@ eval {
|
|||||||
chomp(my $v = `$trunk/sandbox/test-env version 2>/dev/null`);
|
chomp(my $v = `$trunk/sandbox/test-env version 2>/dev/null`);
|
||||||
$sandbox_version = $v if $v;
|
$sandbox_version = $v if $v;
|
||||||
};
|
};
|
||||||
|
our $number=0;
|
||||||
|
|
||||||
our $can_load_data = can_load_data();
|
our $can_load_data = can_load_data();
|
||||||
|
|
||||||
@@ -576,7 +577,7 @@ sub no_diff {
|
|||||||
`cat $expected_output | sed $sed_args > /tmp/pt-test-outfile-trf`;
|
`cat $expected_output | sed $sed_args > /tmp/pt-test-outfile-trf`;
|
||||||
$expected_output = "/tmp/pt-test-outfile-trf";
|
$expected_output = "/tmp/pt-test-outfile-trf";
|
||||||
}
|
}
|
||||||
|
$number++;
|
||||||
# Determine cmd type and run it.
|
# Determine cmd type and run it.
|
||||||
if ( ref $cmd eq 'CODE' ) {
|
if ( ref $cmd eq 'CODE' ) {
|
||||||
output($cmd, file => $tmp_file);
|
output($cmd, file => $tmp_file);
|
||||||
@@ -654,7 +655,7 @@ sub no_diff {
|
|||||||
if ( $res_file ne $tmp_file ) {
|
if ( $res_file ne $tmp_file ) {
|
||||||
unlink $res_file if -f $res_file;
|
unlink $res_file if -f $res_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $cmp_file ne $expected_output ) {
|
if ( $cmp_file ne $expected_output ) {
|
||||||
unlink $cmp_file if -f $cmp_file;
|
unlink $cmp_file if -f $cmp_file;
|
||||||
}
|
}
|
||||||
|
@@ -59,8 +59,6 @@ else
|
|||||||
fi
|
fi
|
||||||
cd $PWD
|
cd $PWD
|
||||||
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
# Wait for MySQL to actually be up, i.e. to respond to queries.
|
# Wait for MySQL to actually be up, i.e. to respond to queries.
|
||||||
for i in $(_seq 60); do
|
for i in $(_seq 60); do
|
||||||
if sandbox_is_alive; then
|
if sandbox_is_alive; then
|
||||||
|
@@ -138,21 +138,8 @@ make_sandbox() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#if [ ! -e $PERCONA_TOOLKIT_BRANCH/sandbox/servers/${APP#mysql}/$version/data.tar.gz ]; then
|
|
||||||
# if [ "$version" > "5.6" ]; then
|
|
||||||
# rm -f /tmp/empty-defaults.txt
|
|
||||||
# touch /tmp/empty-defaults.txt
|
|
||||||
# rm -rf /tmp/$port/data
|
|
||||||
# $PERCONA_TOOLKIT_SANDBOX/$mysqld --defaults-file=/tmp/${port}/my.sandbox.cnf --initialize
|
|
||||||
# else
|
|
||||||
# # MySQL up to 5.6 needs mysql_install_db
|
|
||||||
# # Support for it is a TODO
|
|
||||||
# echo "For MySQL < 5.7 data.tar.gz is required to be in $PERCONA_TOOLKIT_BRANCH/sandbox/servers/${APP#mysql}/$version/"
|
|
||||||
# exit 1
|
|
||||||
# fi
|
|
||||||
#fi
|
|
||||||
|
|
||||||
if [ $generating_database -eq 1 ]; then
|
if [ $generating_database -eq 1 ]; then
|
||||||
|
echo "Creating default databases ..."
|
||||||
if [ "$version" > "5.6" ]; then
|
if [ "$version" > "5.6" ]; then
|
||||||
rm -f /tmp/empty-defaults.txt
|
rm -f /tmp/empty-defaults.txt
|
||||||
touch /tmp/empty-defaults.txt
|
touch /tmp/empty-defaults.txt
|
||||||
@@ -171,8 +158,14 @@ make_sandbox() {
|
|||||||
$PERCONA_TOOLKIT_BRANCH/util/version_cmp $minor_version 5.7.5
|
$PERCONA_TOOLKIT_BRANCH/util/version_cmp $minor_version 5.7.5
|
||||||
if [ $? -eq 2 ]; then
|
if [ $? -eq 2 ]; then
|
||||||
echo "ALTER USER 'root'@'localhost' IDENTIFIED BY 'msandbox';" > $init_file
|
echo "ALTER USER 'root'@'localhost' IDENTIFIED BY 'msandbox';" > $init_file
|
||||||
echo "GRANT ALL PRIVILEGES ON *.* TO 'msandbox'@'127.0.0.1' IDENTIFIED BY 'msandbox';" >> $init_file
|
echo "CREATE USER IF NOT EXISTS 'msandbox'@'%';" > $init_file
|
||||||
echo "GRANT ALL PRIVILEGES ON *.* TO 'msandbox'@'localhost' IDENTIFIED BY 'msandbox';" >> $init_file
|
echo "ALTER USER 'msandbox'@'%' IDENTIFIED BY 'msandbox' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;" >> $init_file
|
||||||
|
echo "GRANT ALL PRIVILEGES ON *.* TO 'msandbox'@'%';" >> $init_file
|
||||||
|
echo "-- Grants for 'root'@'localhost'" >> $init_file
|
||||||
|
echo "CREATE USER IF NOT EXISTS 'root'@'localhost';" >> $init_file
|
||||||
|
echo "ALTER USER 'root'@'localhost' IDENTIFIED BY 'msandbox' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;" >> $init_file
|
||||||
|
echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;" >> $init_file
|
||||||
|
echo "GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION;" >> $init_file
|
||||||
echo "FLUSH PRIVILEGES;" >> $init_file
|
echo "FLUSH PRIVILEGES;" >> $init_file
|
||||||
else
|
else
|
||||||
echo "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('msandbox');" > $init_file
|
echo "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('msandbox');" > $init_file
|
||||||
|
@@ -824,7 +824,13 @@ SKIP: {
|
|||||||
$config->mysql_version(),
|
$config->mysql_version(),
|
||||||
qr/5\.\d+\.\d+/,
|
qr/5\.\d+\.\d+/,
|
||||||
"MySQL version from dbh"
|
"MySQL version from dbh"
|
||||||
);
|
) if ($sandbox_version lt '8.0');
|
||||||
|
|
||||||
|
like(
|
||||||
|
$config->mysql_version(),
|
||||||
|
qr/8\.\d+\.\d+/,
|
||||||
|
"MySQL version from dbh"
|
||||||
|
) if ($sandbox_version ge '8.0');
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = new MySQLConfig(
|
$config = new MySQLConfig(
|
||||||
|
@@ -1142,6 +1142,7 @@ SKIP: {
|
|||||||
: $sandbox_version ge '5.1' ? "t/lib/samples/QueryReportFormatter/report025.txt"
|
: $sandbox_version ge '5.1' ? "t/lib/samples/QueryReportFormatter/report025.txt"
|
||||||
: "t/lib/samples/QueryReportFormatter/report026.txt");
|
: "t/lib/samples/QueryReportFormatter/report026.txt");
|
||||||
|
|
||||||
|
# 30
|
||||||
is(
|
is(
|
||||||
$qrf->explain_report("select * from qrf.t where i=2", 'qrf'),
|
$qrf->explain_report("select * from qrf.t where i=2", 'qrf'),
|
||||||
$explain,
|
$explain,
|
||||||
|
@@ -98,6 +98,9 @@ sub test_so {
|
|||||||
|
|
||||||
if ( $result_file ) {
|
if ( $result_file ) {
|
||||||
my $transform = sub { print sort_query_output(slurp_file(shift)) };
|
my $transform = sub { print sort_query_output(slurp_file(shift)) };
|
||||||
|
if ($sandbox_version gt '5.7') {
|
||||||
|
$transform = sub { print sort_query_output(fix_auto_increment(slurp_file(shift))) };
|
||||||
|
}
|
||||||
ok(
|
ok(
|
||||||
no_diff(
|
no_diff(
|
||||||
$res,
|
$res,
|
||||||
@@ -149,6 +152,15 @@ sub sort_query_output {
|
|||||||
return $sorted;
|
return $sorted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Starting with MySQL 8, AUTO_INCREMENT value is maintained between sessions.
|
||||||
|
# Since we cannot predict the value of the test environment for each table and since its value
|
||||||
|
# is not important for these tests, we just replace it by 0
|
||||||
|
sub fix_auto_increment {
|
||||||
|
my $in = shift;
|
||||||
|
$in =~ s/AUTO_INCREMENT=\d+/AUTO_INCREMENT=0/g;
|
||||||
|
return $in;
|
||||||
|
}
|
||||||
|
|
||||||
SKIP: {
|
SKIP: {
|
||||||
skip "Cannot connect to sandbox master", 22 unless $dbh;
|
skip "Cannot connect to sandbox master", 22 unless $dbh;
|
||||||
$sb->wipe_clean($dbh);
|
$sb->wipe_clean($dbh);
|
||||||
@@ -156,7 +168,6 @@ SKIP: {
|
|||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Test simple, unfiltered get_db_itr().
|
# Test simple, unfiltered get_db_itr().
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
warn "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM";
|
|
||||||
test_so(
|
test_so(
|
||||||
result => "$out/all-dbs-tbls-$sandbox_version.txt",
|
result => "$out/all-dbs-tbls-$sandbox_version.txt",
|
||||||
test_name => "Iterate all schema objects with dbh",
|
test_name => "Iterate all schema objects with dbh",
|
||||||
@@ -166,61 +177,61 @@ SKIP: {
|
|||||||
# Test filters.
|
# Test filters.
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
$sb->load_file('master', "t/lib/samples/SchemaIterator.sql");
|
$sb->load_file('master', "t/lib/samples/SchemaIterator.sql");
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => [qw(-d this_db_does_not_exist)],
|
filters => [qw(-d this_db_does_not_exist)],
|
||||||
result => "",
|
result => "",
|
||||||
test_name => "No databases match",
|
test_name => "No databases match",
|
||||||
);
|
);
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => [qw(-t this_table_does_not_exist)],
|
filters => [qw(-t this_table_does_not_exist)],
|
||||||
result => "",
|
result => "",
|
||||||
test_name => "No tables match",
|
test_name => "No tables match",
|
||||||
);
|
);
|
||||||
|
|
||||||
# Filter by --databases (-d).
|
# Filter by --databases (-d).
|
||||||
test_so(
|
test_so(
|
||||||
filters => [qw(--databases d1)],
|
filters => [qw(--databases d1)],
|
||||||
result => "d1.t1 d1.t2 d1.t3 ",
|
result => "d1.t1 d1.t2 d1.t3 ",
|
||||||
test_name => '--databases',
|
test_name => '--databases',
|
||||||
);
|
);
|
||||||
|
|
||||||
# Filter by --databases (-d) and --tables (-t).
|
# Filter by --databases (-d) and --tables (-t).
|
||||||
test_so(
|
test_so(
|
||||||
filters => [qw(-d d1 -t t2)],
|
filters => [qw(-d d1 -t t2)],
|
||||||
result => "d1.t2 ",
|
result => "d1.t2 ",
|
||||||
test_name => '--databases and --tables',
|
test_name => '--databases and --tables',
|
||||||
);
|
);
|
||||||
|
|
||||||
# Ignore some dbs and tbls.
|
# Ignore some dbs and tbls.
|
||||||
test_so(
|
test_so(
|
||||||
filters => ['--ignore-databases', 'mysql,sakila,d1,d3,percona_test,sys'],
|
filters => ['--ignore-databases', 'mysql,sakila,d1,d3,percona_test,sys'],
|
||||||
result => "d2.t1 ",
|
result => "d2.t1 ",
|
||||||
test_name => '--ignore-databases',
|
test_name => '--ignore-databases',
|
||||||
);
|
);
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => ['--ignore-databases', 'mysql,sakila,d2,d3,percona_test,sys',
|
filters => ['--ignore-databases', 'mysql,sakila,d2,d3,percona_test,sys',
|
||||||
'--ignore-tables', 't1,t2'],
|
'--ignore-tables', 't1,t2'],
|
||||||
result => "d1.t3 ",
|
result => "d1.t3 ",
|
||||||
test_name => '--ignore-databases and --ignore-tables',
|
test_name => '--ignore-databases and --ignore-tables',
|
||||||
);
|
);
|
||||||
|
|
||||||
# Select some dbs but ignore some tables.
|
# Select some dbs but ignore some tables.
|
||||||
test_so(
|
test_so(
|
||||||
filters => ['-d', 'd1', '--ignore-tables', 't1,t3'],
|
filters => ['-d', 'd1', '--ignore-tables', 't1,t3'],
|
||||||
result => "d1.t2 ",
|
result => "d1.t2 ",
|
||||||
test_name => '--databases and --ignore-tables',
|
test_name => '--databases and --ignore-tables',
|
||||||
);
|
);
|
||||||
|
|
||||||
# Filter by engines. This also tests that --engines is case-insensitive
|
# Filter by engines. This also tests that --engines is case-insensitive
|
||||||
test_so(
|
test_so(
|
||||||
filters => ['-d', 'd1,d2,d3', '--engines', 'INNODB'],
|
filters => ['-d', 'd1,d2,d3', '--engines', 'INNODB'],
|
||||||
result => ($sandbox_version ge '5.5' ? 'd1.t2 d2.t1 ' : "d1.t2 "),
|
result => ($sandbox_version ge '5.5' ? 'd1.t2 d2.t1 ' : "d1.t2 "),
|
||||||
test_name => '--engines',
|
test_name => '--engines',
|
||||||
);
|
);
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => ['-d', 'd1,d2,d3', '--ignore-engines', 'innodb,myisam'],
|
filters => ['-d', 'd1,d2,d3', '--ignore-engines', 'innodb,myisam'],
|
||||||
result => "d1.t3 ",
|
result => "d1.t3 ",
|
||||||
@@ -233,21 +244,21 @@ SKIP: {
|
|||||||
result => "d1.t1 d1.t2 ",
|
result => "d1.t1 d1.t2 ",
|
||||||
test_name => '--databases-regex and --tables-regex',
|
test_name => '--databases-regex and --tables-regex',
|
||||||
);
|
);
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => ['--ignore-databases-regex', '(?:^d[23]|mysql|info|sakila|percona_test|sys)',
|
filters => ['--ignore-databases-regex', '(?:^d[23]|mysql|info|sakila|percona_test|sys)',
|
||||||
'--ignore-tables-regex', 't[^23]'],
|
'--ignore-tables-regex', 't[^23]'],
|
||||||
result => "d1.t2 d1.t3 ",
|
result => "d1.t2 d1.t3 ",
|
||||||
test_name => '--ignore-databases-regex',
|
test_name => '--ignore-databases-regex',
|
||||||
);
|
);
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Filter views.
|
# Filter views.
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
SKIP: {
|
SKIP: {
|
||||||
skip 'Sandbox master does not have the sakila database', 1
|
skip 'Sandbox master does not have the sakila database', 1
|
||||||
unless @{$dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")};
|
unless @{$dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")};
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => [qw(-d sakila)],
|
filters => [qw(-d sakila)],
|
||||||
result => "", # hack; uses unlike instead
|
result => "", # hack; uses unlike instead
|
||||||
@@ -262,37 +273,37 @@ SKIP: {
|
|||||||
test_name => "Iterator does not return views",
|
test_name => "Iterator does not return views",
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Issue 806: mk-table-sync --tables does not honor schema qualier
|
# Issue 806: mk-table-sync --tables does not honor schema qualier
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Filter by db-qualified table. There is t1 in both d1 and d2.
|
# Filter by db-qualified table. There is t1 in both d1 and d2.
|
||||||
# We want only d1.t1.
|
# We want only d1.t1.
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => [qw(-t d1.t1)],
|
filters => [qw(-t d1.t1)],
|
||||||
result => "d1.t1 ",
|
result => "d1.t1 ",
|
||||||
test_name => '-t d1.t1 (issue 806)',
|
test_name => '-t d1.t1 (issue 806)',
|
||||||
);
|
);
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => [qw(-d d1 -t d1.t1)],
|
filters => [qw(-d d1 -t d1.t1)],
|
||||||
result => "d1.t1 ",
|
result => "d1.t1 ",
|
||||||
test_name => '-d d1 -t d1.t1 (issue 806)',
|
test_name => '-d d1 -t d1.t1 (issue 806)',
|
||||||
);
|
);
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => [qw(-d d2 -t d1.t1)],
|
filters => [qw(-d d2 -t d1.t1)],
|
||||||
result => "",
|
result => "",
|
||||||
test_name => '-d d2 -t d1.t1 (issue 806)',
|
test_name => '-d d2 -t d1.t1 (issue 806)',
|
||||||
);
|
);
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => ['-t','d1.t1,d1.t3'],
|
filters => ['-t','d1.t1,d1.t3'],
|
||||||
result => "d1.t1 d1.t3 ",
|
result => "d1.t1 d1.t3 ",
|
||||||
test_name => '-t d1.t1,d1.t3 (issue 806)',
|
test_name => '-t d1.t1,d1.t3 (issue 806)',
|
||||||
);
|
);
|
||||||
|
|
||||||
my $want = $sandbox_version le '5.6' ? "d1.t2 d1.t3 d2.t1 " : 'd1.t2 d1.t3 d2.t1 sys.sys_config ';
|
my $want = $sandbox_version le '5.6' ? "d1.t2 d1.t3 d2.t1 " : 'd1.t2 d1.t3 d2.t1 sys.sys_config ';
|
||||||
test_so(
|
test_so(
|
||||||
filters => ['--ignore-databases', 'mysql,sakila,percona_test',
|
filters => ['--ignore-databases', 'mysql,sakila,percona_test',
|
||||||
@@ -300,13 +311,13 @@ SKIP: {
|
|||||||
result => $want,
|
result => $want,
|
||||||
test_name => '--ignore-databases and --ignore-tables d1.t1 (issue 806)',
|
test_name => '--ignore-databases and --ignore-tables d1.t1 (issue 806)',
|
||||||
);
|
);
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => ['-t','d1.t3,d2.t1'],
|
filters => ['-t','d1.t3,d2.t1'],
|
||||||
result => "d1.t3 d2.t1 ",
|
result => "d1.t3 d2.t1 ",
|
||||||
test_name => '-t d1.t3,d2.t1 (issue 806)',
|
test_name => '-t d1.t3,d2.t1 (issue 806)',
|
||||||
);
|
);
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Issue 1161: make_filter() with only --tables db.foo filter does not work
|
# Issue 1161: make_filter() with only --tables db.foo filter does not work
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
@@ -315,26 +326,26 @@ SKIP: {
|
|||||||
# filter.
|
# filter.
|
||||||
$o = new OptionParser(description => 'SchemaIterator');
|
$o = new OptionParser(description => 'SchemaIterator');
|
||||||
$o->get_specs("$trunk/bin/pt-index-usage");
|
$o->get_specs("$trunk/bin/pt-index-usage");
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
filters => [qw(-t d1.t1)],
|
filters => [qw(-t d1.t1)],
|
||||||
result => "d1.t1 ",
|
result => "d1.t1 ",
|
||||||
test_name => '-t d1.t1 (issue 1161)',
|
test_name => '-t d1.t1 (issue 1161)',
|
||||||
);
|
);
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Issue 1193: Make SchemaIterator skip PERFORMANCE_SCHEMA
|
# Issue 1193: Make SchemaIterator skip PERFORMANCE_SCHEMA
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
SKIP: {
|
SKIP: {
|
||||||
skip "Test for MySQL v5.5", 1 unless $sandbox_version ge '5.5';
|
skip "Test for MySQL v5.5", 1 unless $sandbox_version ge '5.5';
|
||||||
|
|
||||||
test_so(
|
test_so(
|
||||||
result => "", # hack, uses unlike instead
|
result => "", # hack, uses unlike instead
|
||||||
unlike => qr/^performance_schema/,
|
unlike => qr/^performance_schema/,
|
||||||
test_name => "performance_schema automatically ignored",
|
test_name => "performance_schema automatically ignored",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
# Getting CREATE TALBE (ddl).
|
# Getting CREATE TALBE (ddl).
|
||||||
# ########################################################################
|
# ########################################################################
|
||||||
@@ -343,7 +354,7 @@ SKIP: {
|
|||||||
result => "$out/mysql-user-ddl-$sandbox_version.txt",
|
result => "$out/mysql-user-ddl-$sandbox_version.txt",
|
||||||
test_name => "Get CREATE TABLE with dbh",
|
test_name => "Get CREATE TABLE with dbh",
|
||||||
);
|
);
|
||||||
|
|
||||||
$sb->wipe_clean($dbh);
|
$sb->wipe_clean($dbh);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -456,23 +467,24 @@ test_so(
|
|||||||
test_name => "Bug 911385: ...and continues to the next table"
|
test_name => "Bug 911385: ...and continues to the next table"
|
||||||
);
|
);
|
||||||
|
|
||||||
warn ">>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Bug 1047335: pt-duplicate-key-checker fails when it encounters a crashed table
|
# Bug 1047335: pt-duplicate-key-checker fails when it encounters a crashed table
|
||||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1047335
|
# https://bugs.launchpad.net/percona-toolkit/+bug/1047335
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|
||||||
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");
|
|
||||||
|
|
||||||
warn "A >>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
|
||||||
SKIP: {
|
SKIP: {
|
||||||
skip "No /dev/urandom, can't corrupt the database", 1
|
skip "No /dev/urandom, can't corrupt the database", 2
|
||||||
unless -e q{/dev/urandom};
|
unless -e q{/dev/urandom};
|
||||||
|
|
||||||
|
skip "Cannot test on MySQL > 5.7 since there are no .frm files", 2 if $sandbox_version gt '5.7';
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
$sb->load_file('master3', "t/lib/samples/bug_1047335_crashed_table.sql");
|
$sb->load_file('master3', "t/lib/samples/bug_1047335_crashed_table.sql");
|
||||||
|
|
||||||
# Create the SI object before crashing the table
|
# Create the SI object before crashing the table
|
||||||
@@ -496,21 +508,17 @@ SKIP: {
|
|||||||
# Truncate the .myi file to corrupt it
|
# Truncate the .myi file to corrupt it
|
||||||
truncate($myi, 4096);
|
truncate($myi, 4096);
|
||||||
|
|
||||||
warn "B >>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
|
||||||
use File::Slurp qw( write_file );
|
use File::Slurp qw( write_file );
|
||||||
|
|
||||||
# Corrupt the .frm file
|
# Corrupt the .frm file
|
||||||
open my $urand_fh, q{<}, "/dev/urandom"
|
open my $urand_fh, q{<}, "/dev/urandom"
|
||||||
or die "Cannot open /dev/urandom";
|
or die "Cannot open /dev/urandom";
|
||||||
warn "B1>>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
|
||||||
write_file($frm, scalar(<$urand_fh>), slurp_file($frm), scalar(<$urand_fh>));
|
write_file($frm, scalar(<$urand_fh>), slurp_file($frm), scalar(<$urand_fh>));
|
||||||
close $urand_fh;
|
close $urand_fh;
|
||||||
|
|
||||||
warn "B2>>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
|
||||||
$dbh3->do("FLUSH TABLES");
|
$dbh3->do("FLUSH TABLES");
|
||||||
eval { $dbh3->do("SELECT etc FROM bug_1047335.crashed_table WHERE etc LIKE '10001' ORDER BY id ASC LIMIT 1") };
|
eval { $dbh3->do("SELECT etc FROM bug_1047335.crashed_table WHERE etc LIKE '10001' ORDER BY id ASC LIMIT 1") };
|
||||||
|
|
||||||
warn "C >>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
|
||||||
my $w = '';
|
my $w = '';
|
||||||
{
|
{
|
||||||
local $SIG{__WARN__} = sub { $w .= shift };
|
local $SIG{__WARN__} = sub { $w .= shift };
|
||||||
@@ -522,50 +530,49 @@ SKIP: {
|
|||||||
qr/bug_1047335.crashed_table because SHOW CREATE TABLE failed:/,
|
qr/bug_1047335.crashed_table because SHOW CREATE TABLE failed:/,
|
||||||
"->next() gives a warning if ->get_create_table dies from a strange error",
|
"->next() gives a warning if ->get_create_table dies from a strange error",
|
||||||
);
|
);
|
||||||
warn "D >>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
|
||||||
|
|
||||||
|
|
||||||
|
$dbh3->do(q{DROP DATABASE IF EXISTS bug_1047335_2});
|
||||||
|
$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";
|
||||||
|
|
||||||
|
diag(`cp $broken_frm $db_dir_2 2>&1`);
|
||||||
|
|
||||||
|
$dbh3->do("FLUSH TABLES");
|
||||||
|
|
||||||
|
my $tmp_si2 = new SchemaIterator(
|
||||||
|
dbh => $dbh3,
|
||||||
|
OptionParser => $o,
|
||||||
|
Quoter => $q,
|
||||||
|
TableParser => $tp,
|
||||||
|
# This is needed because the way we corrupt tables
|
||||||
|
# accidentally removes the database from SHOW DATABASES
|
||||||
|
db => 'bug_1047335_2',
|
||||||
|
);
|
||||||
|
|
||||||
|
$w = '';
|
||||||
|
{
|
||||||
|
local $SIG{__WARN__} = sub { $w .= shift };
|
||||||
|
1 while $tmp_si2->next();
|
||||||
|
}
|
||||||
|
|
||||||
|
like(
|
||||||
|
$w,
|
||||||
|
qr/\QSkipping bug_1047335_2.broken_tbl because SHOW CREATE TABLE failed:/,
|
||||||
|
"...same as above, but using t/lib/samples/broken_tbl.frm",
|
||||||
|
);
|
||||||
|
|
||||||
|
# This might fail. Doesn't matter -- stop_sandbox will just rm -rf the folder
|
||||||
|
eval {
|
||||||
|
$dbh3->do("DROP DATABASE IF EXISTS bug_1047335");
|
||||||
|
$dbh3->do("DROP DATABASE IF EXISTS bug_1047335_2");
|
||||||
|
};
|
||||||
|
|
||||||
|
diag(`$trunk/sandbox/stop-sandbox $master3_port >/dev/null`);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbh3->do(q{DROP DATABASE IF EXISTS bug_1047335_2});
|
|
||||||
$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";
|
|
||||||
|
|
||||||
diag(`cp $broken_frm $db_dir_2 2>&1`);
|
|
||||||
|
|
||||||
$dbh3->do("FLUSH TABLES");
|
|
||||||
|
|
||||||
my $tmp_si2 = new SchemaIterator(
|
|
||||||
dbh => $dbh3,
|
|
||||||
OptionParser => $o,
|
|
||||||
Quoter => $q,
|
|
||||||
TableParser => $tp,
|
|
||||||
# This is needed because the way we corrupt tables
|
|
||||||
# accidentally removes the database from SHOW DATABASES
|
|
||||||
db => 'bug_1047335_2',
|
|
||||||
);
|
|
||||||
|
|
||||||
my $w = '';
|
|
||||||
{
|
|
||||||
local $SIG{__WARN__} = sub { $w .= shift };
|
|
||||||
1 while $tmp_si2->next();
|
|
||||||
}
|
|
||||||
|
|
||||||
like(
|
|
||||||
$w,
|
|
||||||
qr/\QSkipping bug_1047335_2.broken_tbl because SHOW CREATE TABLE failed:/,
|
|
||||||
"...same as above, but using t/lib/samples/broken_tbl.frm",
|
|
||||||
);
|
|
||||||
|
|
||||||
# This might fail. Doesn't matter -- stop_sandbox will just rm -rf the folder
|
|
||||||
eval {
|
|
||||||
$dbh3->do("DROP DATABASE IF EXISTS bug_1047335");
|
|
||||||
$dbh3->do("DROP DATABASE IF EXISTS bug_1047335_2");
|
|
||||||
};
|
|
||||||
|
|
||||||
diag(`$trunk/sandbox/stop-sandbox $master3_port >/dev/null`);
|
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Bug 1136559: Deep recursion on subroutine "SchemaIterator::_iterate_dbh"
|
# Bug 1136559: Deep recursion on subroutine "SchemaIterator::_iterate_dbh"
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
@@ -1039,20 +1039,21 @@ is_deeply(
|
|||||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1047335
|
# https://bugs.launchpad.net/percona-toolkit/+bug/1047335
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|
||||||
# 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");
|
|
||||||
|
|
||||||
$sb->load_file('master3', "t/lib/samples/bug_1047335_crashed_table.sql");
|
|
||||||
|
|
||||||
SKIP: {
|
SKIP: {
|
||||||
skip "No /dev/urandom, can't corrupt the database", 1
|
skip "No /dev/urandom, can't corrupt the database", 2 unless -e q{/dev/urandom};
|
||||||
unless -e q{/dev/urandom};
|
skip "Cannot corrupt a table in MySQL 8", 2 if ($sandbox_version gt '5.7');
|
||||||
|
|
||||||
|
# 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");
|
||||||
|
|
||||||
|
$sb->load_file('master3', "t/lib/samples/bug_1047335_crashed_table.sql");
|
||||||
|
|
||||||
my $db_dir = "$master_basedir/data/bug_1047335";
|
my $db_dir = "$master_basedir/data/bug_1047335";
|
||||||
my $myi = glob("$db_dir/crashed_table.[Mm][Yy][Iy]");
|
my $myi = glob("$db_dir/crashed_table.[Mm][Yy][Iy]");
|
||||||
@@ -1086,26 +1087,26 @@ SKIP: {
|
|||||||
# This might fail. Doesn't matter -- stop_sandbox will just rm -rf the folder
|
# This might fail. Doesn't matter -- stop_sandbox will just rm -rf the folder
|
||||||
eval { $dbh3->do("DROP DATABASE IF EXISTS bug_1047335") };
|
eval { $dbh3->do("DROP DATABASE IF EXISTS bug_1047335") };
|
||||||
|
|
||||||
|
|
||||||
|
$dbh3->do(q{DROP DATABASE IF EXISTS bug_1047335_2});
|
||||||
|
$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";
|
||||||
|
|
||||||
|
diag(`cp $broken_frm $db_dir_2 2>&1`);
|
||||||
|
|
||||||
|
$dbh3->do("FLUSH TABLES");
|
||||||
|
|
||||||
|
eval { $tp->get_create_table($dbh3, 'bug_1047335_2', 'broken_tbl') };
|
||||||
|
ok(
|
||||||
|
$EVAL_ERROR,
|
||||||
|
"get_create_table dies if SHOW CREATE TABLE failed (using broken_tbl.frm)",
|
||||||
|
);
|
||||||
|
|
||||||
|
diag(`$trunk/sandbox/stop-sandbox $master3_port >/dev/null`);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbh3->do(q{DROP DATABASE IF EXISTS bug_1047335_2});
|
|
||||||
$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";
|
|
||||||
|
|
||||||
diag(`cp $broken_frm $db_dir_2 2>&1`);
|
|
||||||
|
|
||||||
$dbh3->do("FLUSH TABLES");
|
|
||||||
|
|
||||||
eval { $tp->get_create_table($dbh3, 'bug_1047335_2', 'broken_tbl') };
|
|
||||||
ok(
|
|
||||||
$EVAL_ERROR,
|
|
||||||
"get_create_table dies if SHOW CREATE TABLE failed (using broken_tbl.frm)",
|
|
||||||
);
|
|
||||||
|
|
||||||
diag(`$trunk/sandbox/stop-sandbox $master3_port >/dev/null`);
|
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# pt-duplicate-key-checker doesn't support triple quote in column name
|
# pt-duplicate-key-checker doesn't support triple quote in column name
|
||||||
# https://bugs.launchpad.net/percona-toolkit/+bug/1462904
|
# https://bugs.launchpad.net/percona-toolkit/+bug/1462904
|
||||||
|
@@ -135,7 +135,7 @@ CREATE TABLE `innodb_ddl_log` (
|
|||||||
`new_file_path` varchar(512) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
`new_file_path` varchar(512) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `thread_id` (`thread_id`)
|
KEY `thread_id` (`thread_id`)
|
||||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB AUTO_INCREMENT=96 DEFAULT CHARSET=utf8mb4 STATS_PERSISTENT=0
|
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB AUTO_INCREMENT=280 DEFAULT CHARSET=utf8mb4 STATS_PERSISTENT=0
|
||||||
|
|
||||||
mysql.innodb_dynamic_metadata
|
mysql.innodb_dynamic_metadata
|
||||||
CREATE TABLE `innodb_dynamic_metadata` (
|
CREATE TABLE `innodb_dynamic_metadata` (
|
||||||
|
54
t/lib/samples/SchemaIterator/mysql-user-ddl-8.0.txt
Normal file
54
t/lib/samples/SchemaIterator/mysql-user-ddl-8.0.txt
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
mysql.user
|
||||||
|
CREATE TABLE `user` (
|
||||||
|
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||||
|
`User` char(32) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||||
|
`Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||||
|
`ssl_cipher` blob NOT NULL,
|
||||||
|
`x509_issuer` blob NOT NULL,
|
||||||
|
`x509_subject` blob NOT NULL,
|
||||||
|
`max_questions` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`max_updates` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`max_connections` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`max_user_connections` int(11) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`plugin` char(64) COLLATE utf8_bin NOT NULL DEFAULT 'mysql_native_password',
|
||||||
|
`authentication_string` text COLLATE utf8_bin,
|
||||||
|
`password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`password_last_changed` timestamp NULL DEFAULT NULL,
|
||||||
|
`password_lifetime` smallint(5) unsigned DEFAULT NULL,
|
||||||
|
`account_locked` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Create_role_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Drop_role_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||||
|
`Password_reuse_history` smallint(5) unsigned DEFAULT NULL,
|
||||||
|
`Password_reuse_time` smallint(5) unsigned DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`Host`,`User`)
|
||||||
|
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0 COMMENT='Users and global privileges'
|
||||||
|
|
@@ -43,16 +43,20 @@ is_deeply(
|
|||||||
"Inserted UTF8 data"
|
"Inserted UTF8 data"
|
||||||
);
|
);
|
||||||
|
|
||||||
throws_ok(
|
SKIP: {
|
||||||
sub { pt_archiver::main(
|
skip "MySQL 8.0+ uses UTF8 as default", 1 if ($sandbox_version gt '5.7');
|
||||||
'--source', 'h=127.1,P=12345,D=issue_1225,t=t,u=msandbox,p=msandbox',
|
|
||||||
'--dest', 't=a',
|
|
||||||
qw(--where 1=1 --purge))
|
|
||||||
},
|
|
||||||
qr/Character set mismatch/,
|
|
||||||
"--check-charset"
|
|
||||||
);
|
|
||||||
|
|
||||||
|
throws_ok(
|
||||||
|
sub { pt_archiver::main(
|
||||||
|
'--source', 'h=127.1,P=12345,D=issue_1225,t=t,u=msandbox,p=msandbox',
|
||||||
|
'--dest', 't=a',
|
||||||
|
qw(--where 1=1 --purge))
|
||||||
|
},
|
||||||
|
qr/Character set mismatch/,
|
||||||
|
"--check-charset"
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
$output = output(
|
$output = output(
|
||||||
sub { pt_archiver::main(
|
sub { pt_archiver::main(
|
||||||
'--source', 'h=127.1,P=12345,D=issue_1225,t=t,u=msandbox,p=msandbox',
|
'--source', 'h=127.1,P=12345,D=issue_1225,t=t,u=msandbox,p=msandbox',
|
||||||
|
@@ -13,7 +13,7 @@ CREATE TABLE test.`stats_r` (
|
|||||||
`min` float DEFAULT NULL,
|
`min` float DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`,`start`,`end`,`user_id`(13),`interval`),
|
PRIMARY KEY (`id`,`start`,`end`,`user_id`(13),`interval`),
|
||||||
KEY `cid_start_end` (`user_id`(13),`start`,`end`)
|
KEY `cid_start_end` (`user_id`(13),`start`,`end`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
CREATE TABLE test.stats_s LIKE test.stats_r;
|
CREATE TABLE test.stats_s LIKE test.stats_r;
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ CREATE TABLE `comp` (
|
|||||||
`name` varchar(255) default NULL,
|
`name` varchar(255) default NULL,
|
||||||
`otherinfo` varchar(255) default NULL,
|
`otherinfo` varchar(255) default NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
|
) ENGINE=InnoDB AUTO_INCREMENT=4;
|
||||||
SET character_set_client = @saved_cs_client;
|
SET character_set_client = @saved_cs_client;
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -54,7 +54,7 @@ CREATE TABLE `prod` (
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `prod_comp_id` (`comp_id`),
|
KEY `prod_comp_id` (`comp_id`),
|
||||||
CONSTRAINT `prod_comp_id` FOREIGN KEY (`comp_id`) REFERENCES `comp` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
CONSTRAINT `prod_comp_id` FOREIGN KEY (`comp_id`) REFERENCES `comp` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
|
) ENGINE=InnoDB AUTO_INCREMENT=7;
|
||||||
SET character_set_client = @saved_cs_client;
|
SET character_set_client = @saved_cs_client;
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -81,7 +81,7 @@ CREATE TABLE `prod_details` (
|
|||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `prod_det_prod_id` (`prod_id`),
|
KEY `prod_det_prod_id` (`prod_id`),
|
||||||
CONSTRAINT `prod_det_prod_id` FOREIGN KEY (`prod_id`) REFERENCES `prod` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
CONSTRAINT `prod_det_prod_id` FOREIGN KEY (`prod_id`) REFERENCES `prod` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
|
) ENGINE=InnoDB AUTO_INCREMENT=7;
|
||||||
SET character_set_client = @saved_cs_client;
|
SET character_set_client = @saved_cs_client;
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -111,7 +111,7 @@ CREATE TABLE `user` (
|
|||||||
KEY `user_prod_id` (`prod_id`),
|
KEY `user_prod_id` (`prod_id`),
|
||||||
CONSTRAINT `user_comp_id` FOREIGN KEY (`comp_id`) REFERENCES `comp` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
CONSTRAINT `user_comp_id` FOREIGN KEY (`comp_id`) REFERENCES `comp` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||||
CONSTRAINT `user_prod_id` FOREIGN KEY (`prod_id`) REFERENCES `prod` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
CONSTRAINT `user_prod_id` FOREIGN KEY (`prod_id`) REFERENCES `prod` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
|
) ENGINE=InnoDB AUTO_INCREMENT=5;
|
||||||
SET character_set_client = @saved_cs_client;
|
SET character_set_client = @saved_cs_client;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
DROP DATABASE IF EXISTS test;
|
||||||
|
CREATE DATABASE test;
|
||||||
use test;
|
use test;
|
||||||
|
|
||||||
drop table if exists table_1;
|
drop table if exists table_1;
|
||||||
|
@@ -184,21 +184,24 @@ SKIP: {
|
|||||||
"--trigger that doesn't match with non-matching --trigger-table"
|
"--trigger that doesn't match with non-matching --trigger-table"
|
||||||
);
|
);
|
||||||
|
|
||||||
# Test NULL sizes.
|
SKIP: {
|
||||||
$output = `$cmd sakila --datasize NULL`,
|
skip "MySQL 8.0+ returns 0, not NULL", 1 if ($sandbox_version gt '5.7');
|
||||||
is(
|
# Test NULL sizes.
|
||||||
$output,
|
$output = `$cmd sakila --datasize NULL`,
|
||||||
"`sakila`.`actor_info`
|
is(
|
||||||
`sakila`.`customer_list`
|
$output,
|
||||||
`sakila`.`film_list`
|
"`sakila`.`actor_info`
|
||||||
`sakila`.`nicer_but_slower_film_list`
|
`sakila`.`customer_list`
|
||||||
`sakila`.`sales_by_film_category`
|
`sakila`.`film_list`
|
||||||
`sakila`.`sales_by_store`
|
`sakila`.`nicer_but_slower_film_list`
|
||||||
`sakila`.`staff_list`
|
`sakila`.`sales_by_film_category`
|
||||||
",
|
`sakila`.`sales_by_store`
|
||||||
'--datasize NULL',
|
`sakila`.`staff_list`
|
||||||
);
|
",
|
||||||
};
|
'--datasize NULL',
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
$sb->load_file('master', "t/pt-find/samples/pseudo-sakila.sql");
|
$sb->load_file('master', "t/pt-find/samples/pseudo-sakila.sql");
|
||||||
|
|
||||||
|
@@ -284,6 +284,9 @@ my $b = $ENV{PERCONA_TOOLKIT_BRANCH};
|
|||||||
$output = `perl $b/bin/pt-heartbeat -D test --interval 0.8 --update --replace --run-time 1 u=bob,F=/tmp/12346/my.sandbox.cnf 2>&1`;
|
$output = `perl $b/bin/pt-heartbeat -D test --interval 0.8 --update --replace --run-time 1 u=bob,F=/tmp/12346/my.sandbox.cnf 2>&1`;
|
||||||
|
|
||||||
|
|
||||||
|
diag(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||||
|
diag($output);
|
||||||
|
diag("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||||
like(
|
like(
|
||||||
$output,
|
$output,
|
||||||
qr/--read-only/,
|
qr/--read-only/,
|
||||||
@@ -313,8 +316,8 @@ diag(`/tmp/12345/use -u root -e "DROP DATABASE test"`);
|
|||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
diag(`rm $pid_file $sent_file 2>/dev/null`);
|
diag(`rm $pid_file $sent_file 2>/dev/null`);
|
||||||
$sb->wipe_clean($master_dbh);
|
# $sb->wipe_clean($master_dbh);
|
||||||
$sb->wipe_clean($slave1_dbh);
|
# $sb->wipe_clean($slave1_dbh);
|
||||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
Reference in New Issue
Block a user