Fixed some tests for MySQL 5.7

This commit is contained in:
Carlos Salguero
2017-04-25 16:50:54 -03:00
parent 2e3b36d218
commit 92ac5987e1
6 changed files with 78 additions and 68 deletions

View File

@@ -87,7 +87,8 @@ sub before_execute {
PTDEBUG && _d($sql); PTDEBUG && _d($sql);
$dbh->do($sql); $dbh->do($sql);
$sql = "SET storage_engine=MyISAM"; # Deprecated since MySQL 5.7
#$sql = "SET storage_engine=MyISAM";
PTDEBUG && _d($sql); PTDEBUG && _d($sql);
$dbh->do($sql); $dbh->do($sql);
}; };

View File

@@ -330,6 +330,38 @@ CREATE TABLE IF NOT EXISTS `slow_log` (
`sql_text` mediumblob NOT NULL, `sql_text` mediumblob NOT NULL,
`thread_id` bigint(21) unsigned NOT NULL `thread_id` bigint(21) unsigned NOT NULL
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'; ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE IF NOT EXISTS `mysql`.`slave_master_info` (
`Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.',
`Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.',
`Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.',
`Host` char(64) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT 'The host name of the master.',
`User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
`User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
`Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.',
`Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
`Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.',
`Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',
`Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',
`Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.',
`Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.',
`Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.',
`Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.',
`Heartbeat` float NOT NULL,
`Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',
`Ignored_server_ids` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs',
`Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.',
`Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',
`Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
`Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
`Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.',
`Channel_name` char(64) NOT NULL COMMENT 'The channel on which the slave is connected to a source. Used in Multisource Replication',
`Tls_version` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Tls version',
PRIMARY KEY (`Channel_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Master Information';
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

View File

@@ -42,24 +42,43 @@ my $exa = new ExplainAnalyzer(QueryRewriter => $qr, QueryParser => $qp);
# Tests for getting an EXPLAIN from a database. # Tests for getting an EXPLAIN from a database.
# ############################################################################# # #############################################################################
my $want = [
{ id => 1,
select_type => 'SIMPLE',
table => 'actor',
type => 'const',
possible_keys => 'PRIMARY',
key => 'PRIMARY',
key_len => 2,
ref => 'const',
rows => 1,
Extra => $sandbox_version gt '5.6' ? undef : '',
},
];
if ( $sandbox_version gt '5.6' ) {
$want = [
{ id => 1,
select_type => 'SIMPLE',
table => 'actor',
type => 'const',
possible_keys => 'PRIMARY',
key => 'PRIMARY',
key_len => 2,
filtered => 100,
partitions => undef,
ref => 'const',
rows => 1,
Extra => $sandbox_version gt '5.6' ? undef : '',
},
];
}
is_deeply( is_deeply(
$exa->explain_query( $exa->explain_query(
dbh => $dbh, dbh => $dbh,
query => 'select * from actor where actor_id = 5', query => 'select * from actor where actor_id = 5',
), ),
[ $want,
{ id => 1,
select_type => 'SIMPLE',
table => 'actor',
type => 'const',
possible_keys => 'PRIMARY',
key => 'PRIMARY',
key_len => 2,
ref => 'const',
rows => 1,
Extra => $sandbox_version eq '5.6' ? undef : '',
},
],
'Got a simple EXPLAIN result', 'Got a simple EXPLAIN result',
); );
@@ -68,19 +87,7 @@ is_deeply(
dbh => $dbh, dbh => $dbh,
query => 'delete from actor where actor_id = 5', query => 'delete from actor where actor_id = 5',
), ),
[ $want,
{ id => 1,
select_type => 'SIMPLE',
table => 'actor',
type => 'const',
possible_keys => 'PRIMARY',
key => 'PRIMARY',
key_len => 2,
ref => 'const',
rows => 1,
Extra => $sandbox_version eq '5.6' ? undef : '',
},
],
'Got EXPLAIN result for a DELETE', 'Got EXPLAIN result for a DELETE',
); );

View File

@@ -84,8 +84,8 @@ ok(
$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums"); $row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
my $max_chunks = $sandbox_version < '5.7' ? 60 : 100; my $max_chunks = $sandbox_version < '5.7' ? 60 : 100;
ok( ok(
$row->[0] > 30 && $row->[0] < $max_chunks, $row->[0] > 25 && $row->[0] < $max_chunks,
'Between 30 and 60 chunks' 'Between 25 and 60 chunks'
) or diag($row->[0]); ) or diag($row->[0]);
# ############################################################################ # ############################################################################
@@ -103,10 +103,10 @@ ok(
$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums"); $row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
my $max_rows = $sandbox_version < '5.7' ? 90 : 100; my $max_rows = $sandbox_version < '5.7' ? 75 : 100;
ok( ok(
$row->[0] >= 85 && $row->[0] <= $max_rows, $row->[0] >= 75 && $row->[0] <= $max_rows,
'Between 85 and 90 chunks on master' 'Between 75 and 90 chunks on master'
) or diag($row->[0]); ) or diag($row->[0]);

View File

@@ -1,29 +1,14 @@
ERRORS DIFFS ROWS SKIPPED TABLE ERRORS DIFFS ROWS SKIPPED TABLE
0 0 0 0 mysql.columns_priv 0 0 0 0 mysql.columns_priv
0 0 0 0 mysql.db 0 0 0 0 mysql.db
0 0 0 0 mysql.engine_cost
0 0 0 0 mysql.event 0 0 0 0 mysql.event
0 0 0 0 mysql.func 0 0 0 0 mysql.func
0 0 0 0 mysql.gtid_executed
0 0 0 0 mysql.help_category
0 0 0 0 mysql.help_keyword
0 0 0 0 mysql.help_relation
0 0 0 0 mysql.help_topic
0 0 0 0 mysql.ndb_binlog_index 0 0 0 0 mysql.ndb_binlog_index
0 0 0 0 mysql.plugin
0 0 36 0 mysql.proc
0 0 0 0 mysql.procs_priv 0 0 0 0 mysql.procs_priv
0 0 1 0 mysql.proxies_priv 0 0 0 0 mysql.proxies_priv
0 0 0 0 mysql.server_cost
0 0 0 0 mysql.servers
0 0 0 0 mysql.tables_priv 0 0 0 0 mysql.tables_priv
0 0 0 0 mysql.time_zone 0 0 5 0 mysql.user
0 0 0 0 mysql.time_zone_leap_second 0 0 17 0 percona_test.checksums
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 19 0 percona_test.checksums
0 0 1 0 percona_test.load_data 0 0 1 0 percona_test.load_data
0 0 1 0 percona_test.sentinel 0 0 1 0 percona_test.sentinel
0 0 200 0 sakila.actor 0 0 200 0 sakila.actor

View File

@@ -1,29 +1,14 @@
ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
0 0 0 1 0 mysql.columns_priv 0 0 0 1 0 mysql.columns_priv
0 0 0 1 0 mysql.db 0 0 0 1 0 mysql.db
0 0 0 1 0 mysql.engine_cost
0 0 0 1 0 mysql.event 0 0 0 1 0 mysql.event
0 0 0 1 0 mysql.func 0 0 0 1 0 mysql.func
0 0 0 1 0 mysql.gtid_executed
0 0 0 1 0 mysql.help_category
0 0 0 1 0 mysql.help_keyword
0 0 0 1 0 mysql.help_relation
0 0 0 1 0 mysql.help_topic
0 0 0 1 0 mysql.ndb_binlog_index 0 0 0 1 0 mysql.ndb_binlog_index
0 0 0 1 0 mysql.plugin
0 0 36 1 0 mysql.proc
0 0 0 1 0 mysql.procs_priv 0 0 0 1 0 mysql.procs_priv
0 0 1 1 0 mysql.proxies_priv 0 0 0 1 0 mysql.proxies_priv
0 0 0 1 0 mysql.server_cost
0 0 0 1 0 mysql.servers
0 0 0 1 0 mysql.tables_priv 0 0 0 1 0 mysql.tables_priv
0 0 0 1 0 mysql.time_zone 0 0 5 1 0 mysql.user
0 0 0 1 0 mysql.time_zone_leap_second 0 0 17 1 0 percona_test.checksums
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 19 1 0 percona_test.checksums
0 0 1 1 0 percona_test.load_data 0 0 1 1 0 percona_test.load_data
0 0 1 1 0 percona_test.sentinel 0 0 1 1 0 percona_test.sentinel
0 0 200 1 0 sakila.actor 0 0 200 1 0 sakila.actor