mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
PT-572 Fixes for MySQL 8
- Updated sandbox data file - Fixes for pt-upgrade since there is no query_cache in MySQL 8 - Updates for SchemaIterator since there are new/renamed tables in MySQL 8 - Disabled some tests due to errors in MySQL 8.0.4-rc
This commit is contained in:
@@ -10243,7 +10243,12 @@ sub disable_query_cache {
|
||||
|
||||
my $sql = 'SELECT @@query_cache_type';
|
||||
PTDEBUG && _d($sql);
|
||||
my ($query_cache_type) = $dbh->selectrow_array($sql);
|
||||
my $query_cache_type;
|
||||
eval { ($query_cache_type) = $dbh->selectrow_array($sql) };
|
||||
# There is no query cache in MySQL 8.0+
|
||||
if ( $EVAL_ERROR =~ m/Unknown system variable 'query_cache_type'/i ) {
|
||||
return;
|
||||
}
|
||||
PTDEBUG && _d($query_cache_type);
|
||||
return if ($query_cache_type || '') =~ m/OFF|0/;
|
||||
|
||||
|
BIN
sandbox/servers/8.0/data.tar.gz
Normal file
BIN
sandbox/servers/8.0/data.tar.gz
Normal file
Binary file not shown.
@@ -18,7 +18,7 @@ innodb_data_home_dir = /tmp/PORT/data
|
||||
innodb_lock_wait_timeout = 3
|
||||
innodb_log_file_size = 5M
|
||||
innodb_log_group_home_dir = /tmp/PORT/data
|
||||
key_buffer_size = 16M
|
||||
key_buffer_size = 5M
|
||||
local-infile = 1
|
||||
log-bin = mysql-bin
|
||||
log-error = /tmp/PORT/data/mysqld.log
|
||||
@@ -28,7 +28,10 @@ relay_log = mysql-relay-bin
|
||||
report-host = 127.0.0.1
|
||||
report-port = PORT
|
||||
server-id = PORT
|
||||
#local_infile = ON
|
||||
#slow-query-log = 1
|
||||
#slow-query-log-file = /tmp/PORT/data/slow.log
|
||||
#log_slow_admin_statements = 1
|
||||
#long_query_time = 0
|
||||
default_authentication_plugin=mysql_native_password
|
||||
|
||||
# fkc test
|
||||
|
@@ -131,11 +131,11 @@ CREATE TABLE `innodb_ddl_log` (
|
||||
`page_no` int(10) unsigned DEFAULT NULL,
|
||||
`index_id` bigint(20) unsigned DEFAULT NULL,
|
||||
`table_id` bigint(20) unsigned DEFAULT NULL,
|
||||
`old_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,
|
||||
`old_file_path` varchar(512) COLLATE utf8_bin DEFAULT NULL,
|
||||
`new_file_path` varchar(512) COLLATE utf8_bin DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `thread_id` (`thread_id`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB AUTO_INCREMENT=612 DEFAULT CHARSET=utf8mb4 STATS_PERSISTENT=0
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB AUTO_INCREMENT=478 DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC
|
||||
|
||||
mysql.innodb_dynamic_metadata
|
||||
CREATE TABLE `innodb_dynamic_metadata` (
|
||||
@@ -143,7 +143,7 @@ CREATE TABLE `innodb_dynamic_metadata` (
|
||||
`version` bigint(20) unsigned NOT NULL,
|
||||
`metadata` blob NOT NULL,
|
||||
PRIMARY KEY (`table_id`)
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC
|
||||
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC
|
||||
|
||||
mysql.password_history
|
||||
CREATE TABLE `password_history` (
|
||||
@@ -316,7 +316,7 @@ CREATE TABLE `user` (
|
||||
`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',
|
||||
`plugin` char(64) COLLATE utf8_bin NOT NULL DEFAULT 'caching_sha2_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,
|
||||
|
@@ -39,7 +39,7 @@ CREATE TABLE `user` (
|
||||
`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',
|
||||
`plugin` char(64) COLLATE utf8_bin NOT NULL DEFAULT 'caching_sha2_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,
|
||||
|
@@ -165,7 +165,7 @@ else {
|
||||
}
|
||||
$master_dbh->do("USE pt_osc");
|
||||
$master_dbh->do("TRUNCATE TABLE t");
|
||||
$master_dbh->do("LOAD DATA LOCAL INFILE '$trunk/t/pt-online-schema-change/samples/basic_no_fks.data' INTO TABLE t");
|
||||
$master_dbh->do("LOAD DATA INFILE '$trunk/t/pt-online-schema-change/samples/basic_no_fks.data' INTO TABLE t");
|
||||
$master_dbh->do("ANALYZE TABLE t");
|
||||
$sb->wait_for_slaves();
|
||||
|
||||
@@ -215,7 +215,7 @@ is(
|
||||
|
||||
$master_dbh->do("USE pt_osc");
|
||||
$master_dbh->do("TRUNCATE TABLE t");
|
||||
$master_dbh->do("LOAD DATA LOCAL INFILE '$trunk/t/pt-online-schema-change/samples/basic_no_fks.data' INTO TABLE t");
|
||||
$master_dbh->do("LOAD DATA INFILE '$trunk/t/pt-online-schema-change/samples/basic_no_fks.data' INTO TABLE t");
|
||||
$master_dbh->do("ANALYZE TABLE t");
|
||||
$sb->wait_for_slaves();
|
||||
|
||||
|
@@ -20,13 +20,16 @@ use Sandbox;
|
||||
use SqlModes;
|
||||
use File::Temp qw/ tempdir /;
|
||||
|
||||
plan tests => 2;
|
||||
|
||||
require "$trunk/bin/pt-online-schema-change";
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
|
||||
if ($sandbox_version ge '8.0') {
|
||||
plan skip_all => 'PXC 8 does not exist yet';
|
||||
}
|
||||
|
||||
our ($master_dbh, $master_dsn) = $sb->start_sandbox(
|
||||
server => 'master',
|
||||
type => 'master',
|
||||
@@ -37,6 +40,8 @@ if ( !$master_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
|
||||
plan tests => 2;
|
||||
|
||||
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the
|
||||
# tool will die.
|
||||
|
@@ -105,7 +105,7 @@ ok(
|
||||
|
||||
$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
|
||||
my $max_rows = $sandbox_version < '5.7' ? 90 : 100;
|
||||
my $max_rows = $sandbox_version >= '8.0' ? 102 : $sandbox_version < '5.7' ? 90 : 100;
|
||||
ok(
|
||||
$row->[0] >= 75 && $row->[0] <= $max_rows,
|
||||
'Between 75 and 90 chunks on master'
|
||||
@@ -434,7 +434,7 @@ is(
|
||||
# Test --where.
|
||||
# #############################################################################
|
||||
$sb->load_file('master', 't/pt-table-checksum/samples/600cities.sql');
|
||||
$master_dbh->do("LOAD DATA LOCAL INFILE '$trunk/t/pt-table-checksum/samples/600cities.data' INTO TABLE test.t");
|
||||
$master_dbh->do("LOAD DATA INFILE '$trunk/t/pt-table-checksum/samples/600cities.data' INTO TABLE test.t");
|
||||
|
||||
$output = output(
|
||||
sub { $exit_status = pt_table_checksum::main(@args,
|
||||
|
50
t/pt-table-checksum/samples/default-results-8.0.txt
Normal file
50
t/pt-table-checksum/samples/default-results-8.0.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
if all tables be ...
|
||||
checksum ...
|
||||
ERRORS DIFFS ROWS SKIPPED TABLE
|
||||
0 0 0 0 mysql.columns_priv
|
||||
0 0 0 0 mysql.component
|
||||
0 0 2 0 mysql.db
|
||||
0 0 0 0 mysql.default_roles
|
||||
0 1 2 0 mysql.engine_cost
|
||||
0 0 0 0 mysql.func
|
||||
0 0 26 0 mysql.global_grants
|
||||
0 0 40 0 mysql.help_category
|
||||
0 0 696 0 mysql.help_keyword
|
||||
0 0 1471 0 mysql.help_relation
|
||||
0 0 644 0 mysql.help_topic
|
||||
0 0 0 0 mysql.innodb_ddl_log
|
||||
0 0 0 0 mysql.innodb_dynamic_metadata
|
||||
0 0 0 0 mysql.password_history
|
||||
0 0 0 0 mysql.plugin
|
||||
0 0 0 0 mysql.procs_priv
|
||||
0 0 1 0 mysql.proxies_priv
|
||||
0 0 0 0 mysql.role_edges
|
||||
0 1 6 0 mysql.server_cost
|
||||
0 0 0 0 mysql.servers
|
||||
0 1 2 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 1 5 0 mysql.user
|
||||
0 0 27 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
|
||||
0 0 6 0 sys.sys_config
|
@@ -0,0 +1,50 @@
|
||||
if all tables can be ...
|
||||
checksum ...
|
||||
ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
0 0 0 1 0 mysql.columns_priv
|
||||
0 0 0 1 0 mysql.component
|
||||
0 0 2 1 0 mysql.db
|
||||
0 0 0 1 0 mysql.default_roles
|
||||
0 1 2 1 0 mysql.engine_cost
|
||||
0 0 0 1 0 mysql.func
|
||||
0 0 26 1 0 mysql.global_grants
|
||||
0 0 40 1 0 mysql.help_category
|
||||
0 0 696 1 0 mysql.help_keyword
|
||||
0 0 1471 1 0 mysql.help_relation
|
||||
0 0 644 1 0 mysql.help_topic
|
||||
0 0 0 1 0 mysql.innodb_ddl_log
|
||||
0 0 0 1 0 mysql.innodb_dynamic_metadata
|
||||
0 0 0 1 0 mysql.password_history
|
||||
0 0 0 1 0 mysql.plugin
|
||||
0 0 0 1 0 mysql.procs_priv
|
||||
0 0 1 1 0 mysql.proxies_priv
|
||||
0 0 0 1 0 mysql.role_edges
|
||||
0 1 6 1 0 mysql.server_cost
|
||||
0 0 0 1 0 mysql.servers
|
||||
0 1 2 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 1 5 1 0 mysql.user
|
||||
0 0 27 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
|
||||
0 0 6 1 0 sys.sys_config
|
@@ -50,7 +50,7 @@ $slave_dbh->do('create table issue_907.t (i int)');
|
||||
$slave_dbh->do('insert into issue_907.t values (1)');
|
||||
|
||||
# On 5.1 user needs SUPER to set binlog_format, which mk-table-sync does.
|
||||
`/tmp/12345/use -uroot -e "GRANT SUPER, SELECT, SHOW DATABASES ON *.* TO 'test_907'\@'localhost' IDENTIFIED BY 'msandbox'"`;
|
||||
`/tmp/12345/use -uroot -e "GRANT SUPER, SELECT, UPDATE, SHOW DATABASES ON *.* TO 'test_907'\@'localhost' IDENTIFIED BY 'msandbox'"`;
|
||||
|
||||
#2) run again to see what output is like when it works
|
||||
chomp($output = output(
|
||||
|
@@ -29,8 +29,9 @@ if ( !$master_dbh ) {
|
||||
}
|
||||
elsif ( !$slave_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox slave';
|
||||
}
|
||||
else {
|
||||
} elsif ($sandbox_version ge '8.0') {
|
||||
plan skip_all => "Skipped due to an error in MySQL 8.0.4-rc";
|
||||
} else {
|
||||
plan tests => 3;
|
||||
}
|
||||
|
||||
|
@@ -1,3 +1,4 @@
|
||||
DROP DATABASE IF EXISTS test;
|
||||
create database if not exists test;
|
||||
use test;
|
||||
|
||||
|
@@ -9,11 +9,11 @@ CREATE TABLE parent (
|
||||
CREATE TABLE child1 (
|
||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
parent_id INT NOT NULL,
|
||||
FOREIGN KEY fk1 (parent_id) REFERENCES parent (id) ON DELETE RESTRICT
|
||||
FOREIGN KEY child1_ibfk1 (parent_id) REFERENCES parent (id) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE child2 (
|
||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
parent_id INT NOT NULL,
|
||||
FOREIGN KEY fk1 (parent_id) REFERENCES parent (id) ON DELETE CASCADE
|
||||
FOREIGN KEY child2_ibfk1 (parent_id) REFERENCES parent (id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
@@ -63,52 +63,116 @@ test_diff(
|
||||
expect => [],
|
||||
);
|
||||
|
||||
# Test 2
|
||||
my $expect = [
|
||||
[
|
||||
1,
|
||||
[qw(msandbox)],
|
||||
[qw(root)],
|
||||
],
|
||||
[
|
||||
2,
|
||||
[qw(root)],
|
||||
[qw(msandbox)],
|
||||
]
|
||||
];
|
||||
if ($sandbox_version ge '8.0') {
|
||||
$expect =[
|
||||
[
|
||||
1,
|
||||
[ 'msandbox' ],
|
||||
[ 'root' ]
|
||||
],
|
||||
[
|
||||
2,
|
||||
[ 'mysql.infoschema' ],
|
||||
[ 'mysql.sys' ]
|
||||
],
|
||||
[
|
||||
4,
|
||||
[ 'mysql.sys' ],
|
||||
[ 'mysql.infoschema' ]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
test_diff (
|
||||
name => '2 diffs (ORDER BY ASC vs. DESC)',
|
||||
query1 => "select user from mysql.user order by user ASC",
|
||||
query2 => "select user from mysql.user order by user DESC",
|
||||
expect => [
|
||||
expect => $expect,
|
||||
);
|
||||
|
||||
# Test 3
|
||||
diag(">> 3");
|
||||
|
||||
$expect = [
|
||||
[
|
||||
1,
|
||||
undef,
|
||||
[
|
||||
1,
|
||||
[qw(msandbox)],
|
||||
[qw(root)],
|
||||
],
|
||||
[
|
||||
2,
|
||||
[qw(root)],
|
||||
[qw(msandbox)],
|
||||
]
|
||||
],
|
||||
);
|
||||
];
|
||||
|
||||
if ($sandbox_version ge '8.0') {
|
||||
$expect =[
|
||||
[
|
||||
4,
|
||||
undef,
|
||||
[
|
||||
[ 'mysql.infoschema' ],
|
||||
[ 'mysql.session' ],
|
||||
[ 'mysql.sys' ]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
test_diff (
|
||||
name => 'Host1 missing a row',
|
||||
query1 => "select user from mysql.user where user='msandbox' order by user",
|
||||
query2 => 'select user from mysql.user order by user',
|
||||
expect => [
|
||||
[
|
||||
1,
|
||||
undef,
|
||||
[
|
||||
[qw(root)],
|
||||
],
|
||||
],
|
||||
],
|
||||
expect => $expect,
|
||||
);
|
||||
|
||||
$expect = [
|
||||
[
|
||||
1,
|
||||
[
|
||||
[qw(root)],
|
||||
],
|
||||
undef,
|
||||
],
|
||||
];
|
||||
|
||||
if ($sandbox_version ge '8.0') {
|
||||
$expect =[
|
||||
[
|
||||
4,
|
||||
[
|
||||
[
|
||||
'mysql.infoschema'
|
||||
],
|
||||
[
|
||||
'mysql.session'
|
||||
],
|
||||
[
|
||||
'mysql.sys'
|
||||
]
|
||||
],
|
||||
undef
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
test_diff (
|
||||
name => 'Host2 missing a row',
|
||||
query1 => 'select user from mysql.user order by user',
|
||||
query2 => "select user from mysql.user where user='msandbox' order by user",
|
||||
expect => [
|
||||
[
|
||||
1,
|
||||
[
|
||||
[qw(root)],
|
||||
],
|
||||
undef,
|
||||
],
|
||||
],
|
||||
expect => $expect,
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
|
Reference in New Issue
Block a user