mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-27 16:12:04 +00:00
Merged mysql-5.6-test-fixes and resolved conflicts
This commit is contained in:
@@ -68,9 +68,7 @@ sub reset_repl_db {
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_table_checksum::main(@args) },
|
||||
$sandbox_version gt "5.1 " ? "$sample/default-results-5.5.txt"
|
||||
: $sandbox_version gt "5.0 " ? "$sample/default-results-5.1.txt"
|
||||
: "$sample/default-results-5.0.txt",
|
||||
"$sample/default-results-$sandbox_version.txt",
|
||||
post_pipe => 'awk \'{print $2 " " $3 " " $4 " " $6 " " $8}\'',
|
||||
),
|
||||
"Default checksum"
|
||||
@@ -93,29 +91,28 @@ cmp_ok(
|
||||
ok(
|
||||
no_diff(
|
||||
sub { pt_table_checksum::main(@args, qw(--chunk-time 0)) },
|
||||
$sandbox_version gt "5.1" ? "$sample/static-chunk-size-results-5.5.txt"
|
||||
: $sandbox_version gt "5.0" ? "$sample/static-chunk-size-results-5.1.txt"
|
||||
: "$sample/static-chunk-size-results-5.0.txt",
|
||||
"$sample/static-chunk-size-results-$sandbox_version.txt",
|
||||
post_pipe => 'awk \'{print $2 " " $3 " " $4 " " $5 " " $6 " " $8}\'',
|
||||
),
|
||||
"Static chunk size (--chunk-time 0)"
|
||||
);
|
||||
|
||||
my $n_checksums = $sandbox_version eq "5.6" ? 88
|
||||
: $sandbox_version eq "5.5" ? 90
|
||||
: $sandbox_version eq "5.1" ? 89
|
||||
: 85;
|
||||
|
||||
$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
is(
|
||||
$row->[0],
|
||||
( $sandbox_version gt "5.1" ? 90
|
||||
: $sandbox_version gt "5.0" ? 89
|
||||
: 85),
|
||||
$n_checksums,
|
||||
'Expected checksums on master'
|
||||
);
|
||||
|
||||
$row = $slave1_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
is(
|
||||
$row->[0],
|
||||
( $sandbox_version gt "5.1" ? 90
|
||||
: $sandbox_version gt "5.0" ? 89
|
||||
: 85),
|
||||
$n_checksums,
|
||||
'Expected checksums on slave'
|
||||
);
|
||||
|
||||
|
@@ -178,8 +178,8 @@ is(
|
||||
# Use the --replicate table created by the previous ^ tests.
|
||||
|
||||
# Create a user that can't create the --replicate table.
|
||||
diag(`/tmp/12345/use -uroot -pmsandbox < $trunk/t/lib/samples/ro-checksum-user.sql`);
|
||||
diag(`/tmp/12345/use -uroot -pmsandbox -e "GRANT REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO ro_checksum_user\@'%'"`);
|
||||
diag(`/tmp/12345/use -uroot < $trunk/t/lib/samples/ro-checksum-user.sql`);
|
||||
diag(`/tmp/12345/use -uroot -e "GRANT REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO ro_checksum_user\@'%'"`);
|
||||
|
||||
# Remove the --replicate table from slave1 and slave2,
|
||||
# so it's only on the master...
|
||||
@@ -199,7 +199,7 @@ like(
|
||||
"CREATE DATABASE error and db is missing on slaves (bug 1039569)"
|
||||
);
|
||||
|
||||
diag(`/tmp/12345/use -uroot -pmsandbox -e "DROP USER ro_checksum_user\@'%'"`);
|
||||
diag(`/tmp/12345/use -uroot -e "DROP USER ro_checksum_user\@'%'"`);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
|
40
t/pt-table-checksum/samples/default-results-5.6.txt
Normal file
40
t/pt-table-checksum/samples/default-results-5.6.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
ERRORS DIFFS ROWS SKIPPED TABLE
|
||||
0 0 0 0 mysql.columns_priv
|
||||
0 0 2 0 mysql.db
|
||||
0 0 0 0 mysql.event
|
||||
0 0 0 0 mysql.func
|
||||
0 0 39 0 mysql.help_category
|
||||
0 0 461 0 mysql.help_keyword
|
||||
0 0 1045 0 mysql.help_relation
|
||||
0 0 324 0 mysql.help_topic
|
||||
0 0 0 0 mysql.plugin
|
||||
0 0 0 0 mysql.proc
|
||||
0 0 0 0 mysql.procs_priv
|
||||
0 0 2 0 mysql.proxies_priv
|
||||
0 0 0 0 mysql.servers
|
||||
0 0 0 0 mysql.tables_priv
|
||||
0 0 0 0 mysql.time_zone
|
||||
0 0 0 0 mysql.time_zone_leap_second
|
||||
0 0 0 0 mysql.time_zone_name
|
||||
0 0 0 0 mysql.time_zone_transition
|
||||
0 0 0 0 mysql.time_zone_transition_type
|
||||
0 0 2 0 mysql.user
|
||||
0 0 42 0 percona_test.checksums
|
||||
0 0 1 0 percona_test.load_data
|
||||
0 0 1 0 percona_test.sentinel
|
||||
0 0 200 0 sakila.actor
|
||||
0 0 603 0 sakila.address
|
||||
0 0 16 0 sakila.category
|
||||
0 0 600 0 sakila.city
|
||||
0 0 109 0 sakila.country
|
||||
0 0 599 0 sakila.customer
|
||||
0 0 1000 0 sakila.film
|
||||
0 0 5462 0 sakila.film_actor
|
||||
0 0 1000 0 sakila.film_category
|
||||
0 0 1000 0 sakila.film_text
|
||||
0 0 4581 0 sakila.inventory
|
||||
0 0 6 0 sakila.language
|
||||
0 0 16049 0 sakila.payment
|
||||
0 0 16044 0 sakila.rental
|
||||
0 0 2 0 sakila.staff
|
||||
0 0 2 0 sakila.store
|
19
t/pt-table-checksum/samples/repl-table-myisam.sql
Normal file
19
t/pt-table-checksum/samples/repl-table-myisam.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
DROP DATABASE IF EXISTS percona;
|
||||
CREATE DATABASE percona;
|
||||
USE percona;
|
||||
CREATE TABLE checksums (
|
||||
db char(64) NOT NULL,
|
||||
tbl char(64) NOT NULL,
|
||||
chunk int NOT NULL,
|
||||
chunk_time float NULL,
|
||||
chunk_index varchar(200) NULL,
|
||||
lower_boundary text NULL,
|
||||
upper_boundary text NULL,
|
||||
this_crc char(40) NOT NULL,
|
||||
this_cnt int NOT NULL,
|
||||
master_crc char(40) NULL,
|
||||
master_cnt int NULL,
|
||||
ts timestamp NOT NULL,
|
||||
PRIMARY KEY (db, tbl, chunk),
|
||||
INDEX ts_db_tbl (ts, db, tbl)
|
||||
) ENGINE=MyISAM;
|
@@ -0,0 +1,40 @@
|
||||
ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
0 0 0 1 0 mysql.columns_priv
|
||||
0 0 2 1 0 mysql.db
|
||||
0 0 0 1 0 mysql.event
|
||||
0 0 0 1 0 mysql.func
|
||||
0 0 39 1 0 mysql.help_category
|
||||
0 0 461 1 0 mysql.help_keyword
|
||||
0 0 1045 1 0 mysql.help_relation
|
||||
0 0 324 1 0 mysql.help_topic
|
||||
0 0 0 1 0 mysql.plugin
|
||||
0 0 0 1 0 mysql.proc
|
||||
0 0 0 1 0 mysql.procs_priv
|
||||
0 0 2 1 0 mysql.proxies_priv
|
||||
0 0 0 1 0 mysql.servers
|
||||
0 0 0 1 0 mysql.tables_priv
|
||||
0 0 0 1 0 mysql.time_zone
|
||||
0 0 0 1 0 mysql.time_zone_leap_second
|
||||
0 0 0 1 0 mysql.time_zone_name
|
||||
0 0 0 1 0 mysql.time_zone_transition
|
||||
0 0 0 1 0 mysql.time_zone_transition_type
|
||||
0 0 2 1 0 mysql.user
|
||||
0 0 42 1 0 percona_test.checksums
|
||||
0 0 1 1 0 percona_test.load_data
|
||||
0 0 1 1 0 percona_test.sentinel
|
||||
0 0 200 1 0 sakila.actor
|
||||
0 0 603 1 0 sakila.address
|
||||
0 0 16 1 0 sakila.category
|
||||
0 0 600 1 0 sakila.city
|
||||
0 0 109 1 0 sakila.country
|
||||
0 0 599 1 0 sakila.customer
|
||||
0 0 1000 1 0 sakila.film
|
||||
0 0 5462 8 0 sakila.film_actor
|
||||
0 0 1000 1 0 sakila.film_category
|
||||
0 0 1000 1 0 sakila.film_text
|
||||
0 0 4581 7 0 sakila.inventory
|
||||
0 0 6 1 0 sakila.language
|
||||
0 0 16049 19 0 sakila.payment
|
||||
0 0 16044 19 0 sakila.rental
|
||||
0 0 2 1 0 sakila.staff
|
||||
0 0 2 1 0 sakila.store
|
@@ -15,11 +15,12 @@ use PerconaTest;
|
||||
use Sandbox;
|
||||
require "$trunk/bin/pt-table-checksum";
|
||||
|
||||
diag("Stopping/reconfiguring/restarting sandboxes 12348 and 12349");
|
||||
diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
|
||||
diag(`SKIP_INNODB=1 $trunk/sandbox/start-sandbox master 12348 >/dev/null`);
|
||||
if ( $sandbox_version eq '5.6' ) {
|
||||
plan skip_all => 'http://bugs.mysql.com/67798';
|
||||
}
|
||||
|
||||
diag(`$trunk/sandbox/stop-sandbox 12349 >/dev/null`);
|
||||
diag(`$trunk/sandbox/stop-sandbox 12348 12349 >/dev/null`);
|
||||
diag(`SKIP_INNODB=1 $trunk/sandbox/start-sandbox master 12348 >/dev/null`);
|
||||
diag(`SKIP_INNODB=1 $trunk/sandbox/start-sandbox slave 12349 12348 >/dev/null`);
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
@@ -33,9 +34,6 @@ if ( !$master_dbh ) {
|
||||
elsif ( !$slave_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox slave 12349';
|
||||
}
|
||||
else {
|
||||
plan tests => 3;
|
||||
}
|
||||
|
||||
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||
# so we need to specify --lock-wait-timeout=3 else the tool will die.
|
||||
@@ -45,6 +43,26 @@ my @args = ($master_dsn, qw(--lock-wait-timeout 3), '--max-load', '');
|
||||
my $output;
|
||||
my $retval;
|
||||
|
||||
if ( $sandbox_version ge '5.6' ) {
|
||||
# Before MySQL 5.6, even with the InnoDB engine off, creating an InnoDB
|
||||
# table would simply result in:
|
||||
#
|
||||
# mysql> create table t (i int) engine=innodb;
|
||||
# Query OK, 0 rows affected, 2 warnings (0.01 sec)
|
||||
#
|
||||
# mysql> show warnings;
|
||||
# +---------+------+-------------------------------------------+
|
||||
# | Level | Code | Message |
|
||||
# +---------+------+-------------------------------------------+
|
||||
# | Warning | 1286 | Unknown table engine 'innodb' |
|
||||
# | Warning | 1266 | Using storage engine MyISAM for table 't' |
|
||||
# +---------+------+-------------------------------------------+
|
||||
#
|
||||
# But 5.6 throws an error. So we have to create the table manually.
|
||||
$sb->load_file('master1', "t/pt-table-checksum/samples/repl-table-myisam.sql");
|
||||
$sb->wait_for_slaves(master => 'master1', slave => 'master2');
|
||||
}
|
||||
|
||||
$output = output(
|
||||
sub { $retval = pt_table_checksum::main(@args) },
|
||||
stderr => 1,
|
||||
@@ -60,13 +78,12 @@ is(
|
||||
$retval,
|
||||
0,
|
||||
"0 exit status (bug 996110)"
|
||||
);
|
||||
) or diag($output);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
diag('Shutting down sandboxes');
|
||||
diag(`$trunk/sandbox/stop-sandbox 12349 >/dev/null`);
|
||||
diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
|
||||
$sb->wipe_clean($master_dbh);
|
||||
diag(`$trunk/sandbox/stop-sandbox 12349 12348 >/dev/null`);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
exit;
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user