mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 21:19:59 +00:00
Merge mysql-5.6-test-fixes.
This commit is contained in:
@@ -3759,7 +3759,7 @@ my $i = qr/((?:\d{1,3}\.){3}\d+)/; # IP address
|
||||
my $n = qr/([^`\s]+)/; # MySQL object name
|
||||
my $u = qr/(\S+)/; # Username. This is somewhat wrong, but
|
||||
# usernames with spaces are rare enough.
|
||||
my $s = qr/(\d{6} .\d:\d\d:\d\d)/; # InnoDB timestamp
|
||||
my $s = qr/((?:\d{6}|\d{4}-\d\d-\d\d) .\d:\d\d:\d\d)(?: [A-Fa-f0-9]+)?/; # InnoDB timestamp
|
||||
|
||||
# A thread's proc_info can be at least 98 different things I've found in the
|
||||
# source. Fortunately, most of them begin with a gerunded verb. These are
|
||||
@@ -4140,8 +4140,11 @@ sub parse_deadlocks {
|
||||
|
||||
# Extract some miscellaneous data from the deadlock.
|
||||
my ( $ts ) = $dl_text =~ m/^$s$/m;
|
||||
my ( $year, $mon, $day, $hour, $min, $sec ) = $ts =~ m/^(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)$/;
|
||||
$ts = sprintf('%02d-%02d-%02dT%02d:%02d:%02d', $year + 2000, $mon, $day, $hour, $min, $sec);
|
||||
my ( $year, $mon, $day, $hour, $min, $sec ) = $ts =~ m/^((?:\d\d)?\d\d)-?(\d\d)-?(\d\d) +(\d+):(\d+):(\d+)$/;
|
||||
if ( length($year) == 2 ) {
|
||||
$year += 2000;
|
||||
}
|
||||
$ts = sprintf('%02d-%02d-%02dT%02d:%02d:%02d', $year, $mon, $day, $hour, $min, $sec);
|
||||
my ( $victim ) = $dl_text =~ m/^\*\*\* WE ROLL BACK TRANSACTION \((\d+)\)$/m;
|
||||
$victim ||= 0;
|
||||
|
||||
|
@@ -3026,11 +3026,16 @@ sub next {
|
||||
|
||||
if ( !$self->{initialized} ) {
|
||||
$self->{initialized} = 1;
|
||||
if ( $self->{resume}->{tbl}
|
||||
&& !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
|
||||
if ( $self->{resume}->{tbl} ) {
|
||||
if ( !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
|
||||
PTDEBUG && _d('Will resume after',
|
||||
join('.', @{$self->{resume}}{qw(db tbl)}));
|
||||
$self->{resume}->{after} = 1;
|
||||
$self->{resume}->{after}->{tbl} = 1;
|
||||
}
|
||||
if ( !$self->database_is_allowed($self->{resume}->{db}) ) {
|
||||
PTDEBUG && _d('Will resume after', $self->{resume}->{db});
|
||||
$self->{resume}->{after}->{db} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3128,16 +3133,17 @@ sub _iterate_dbh {
|
||||
if ( !defined $self->{dbs} ) {
|
||||
my $sql = 'SHOW DATABASES';
|
||||
PTDEBUG && _d($sql);
|
||||
my @dbs = grep { $self->database_is_allowed($_) }
|
||||
@{$dbh->selectcol_arrayref($sql)};
|
||||
my @dbs = grep {
|
||||
$self->_resume_from_database($_)
|
||||
&&
|
||||
$self->database_is_allowed($_)
|
||||
} @{$dbh->selectcol_arrayref($sql)};
|
||||
PTDEBUG && _d('Found', scalar @dbs, 'databases');
|
||||
$self->{dbs} = \@dbs;
|
||||
}
|
||||
|
||||
if ( !$self->{db} ) {
|
||||
do {
|
||||
$self->{db} = shift @{$self->{dbs}};
|
||||
} until $self->_resume_from_database($self->{db});
|
||||
PTDEBUG && _d('Next database:', $self->{db});
|
||||
return unless $self->{db};
|
||||
}
|
||||
@@ -3239,9 +3245,15 @@ sub table_is_allowed {
|
||||
|
||||
my $filter = $self->{filters};
|
||||
|
||||
if ( $db eq 'mysql' && ($tbl eq 'general_log' || $tbl eq 'slow_log') ) {
|
||||
return 0;
|
||||
}
|
||||
return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
|
||||
general_log
|
||||
|slow_log
|
||||
|innodb_index_stats
|
||||
|innodb_table_stats
|
||||
|slave_master_info
|
||||
|slave_relay_log_info
|
||||
|slave_worker_info
|
||||
)$/x;
|
||||
|
||||
if ( $filter->{'ignore-tables'}->{$tbl}
|
||||
&& ($filter->{'ignore-tables'}->{$tbl} eq '*'
|
||||
@@ -3310,12 +3322,18 @@ sub _resume_from_database {
|
||||
my ($self, $db) = @_;
|
||||
|
||||
return 1 unless $self->{resume}->{db};
|
||||
|
||||
if ( $db eq $self->{resume}->{db} ) {
|
||||
PTDEBUG && _d('At resume db', $db);
|
||||
if ( !$self->{resume}->{after}->{db} ) {
|
||||
PTDEBUG && _d('Resuming from db', $db);
|
||||
delete $self->{resume}->{db};
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
PTDEBUG && _d('Resuming after db', $db);
|
||||
delete $self->{resume}->{db};
|
||||
delete $self->{resume}->{tbl};
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3326,7 +3344,7 @@ sub _resume_from_table {
|
||||
return 1 unless $self->{resume}->{tbl};
|
||||
|
||||
if ( $tbl eq $self->{resume}->{tbl} ) {
|
||||
if ( !$self->{resume}->{after} ) {
|
||||
if ( !$self->{resume}->{after}->{tbl} ) {
|
||||
PTDEBUG && _d('Resuming from table', $tbl);
|
||||
delete $self->{resume}->{tbl};
|
||||
return 1;
|
||||
|
@@ -1942,6 +1942,9 @@ sub parse_timestamp {
|
||||
. (defined $f ? '%09.6f' : '%02d'),
|
||||
$y + 2000, $m, $d, $h, $i, (defined $f ? $s + $f : $s);
|
||||
}
|
||||
elsif ( $val =~ m/^$proper_ts$/ ) {
|
||||
return $val;
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
@@ -3609,7 +3612,8 @@ sub get_fk_error {
|
||||
# Quick check if text even has a foreign key error.
|
||||
return unless $text =~ m/LATEST FOREIGN KEY ERROR/;
|
||||
|
||||
my $idb_ts = qr/(\d{6} .\d:\d\d:\d\d)/; # InnoDB timestamp
|
||||
# InnoDB timestamp
|
||||
my $idb_ts = qr/((?:\d{6}|\d{4}-\d\d-\d\d) .\d:\d\d:\d\d)/;
|
||||
|
||||
my ($ts, $fke) = $text =~ m/LATEST FOREIGN KEY ERROR.+?$idb_ts\s*(.+?)---/ms;
|
||||
chomp $fke if $fke;
|
||||
|
@@ -3844,11 +3844,16 @@ sub next {
|
||||
|
||||
if ( !$self->{initialized} ) {
|
||||
$self->{initialized} = 1;
|
||||
if ( $self->{resume}->{tbl}
|
||||
&& !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
|
||||
if ( $self->{resume}->{tbl} ) {
|
||||
if ( !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
|
||||
PTDEBUG && _d('Will resume after',
|
||||
join('.', @{$self->{resume}}{qw(db tbl)}));
|
||||
$self->{resume}->{after} = 1;
|
||||
$self->{resume}->{after}->{tbl} = 1;
|
||||
}
|
||||
if ( !$self->database_is_allowed($self->{resume}->{db}) ) {
|
||||
PTDEBUG && _d('Will resume after', $self->{resume}->{db});
|
||||
$self->{resume}->{after}->{db} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3946,16 +3951,17 @@ sub _iterate_dbh {
|
||||
if ( !defined $self->{dbs} ) {
|
||||
my $sql = 'SHOW DATABASES';
|
||||
PTDEBUG && _d($sql);
|
||||
my @dbs = grep { $self->database_is_allowed($_) }
|
||||
@{$dbh->selectcol_arrayref($sql)};
|
||||
my @dbs = grep {
|
||||
$self->_resume_from_database($_)
|
||||
&&
|
||||
$self->database_is_allowed($_)
|
||||
} @{$dbh->selectcol_arrayref($sql)};
|
||||
PTDEBUG && _d('Found', scalar @dbs, 'databases');
|
||||
$self->{dbs} = \@dbs;
|
||||
}
|
||||
|
||||
if ( !$self->{db} ) {
|
||||
do {
|
||||
$self->{db} = shift @{$self->{dbs}};
|
||||
} until $self->_resume_from_database($self->{db});
|
||||
PTDEBUG && _d('Next database:', $self->{db});
|
||||
return unless $self->{db};
|
||||
}
|
||||
@@ -4057,9 +4063,15 @@ sub table_is_allowed {
|
||||
|
||||
my $filter = $self->{filters};
|
||||
|
||||
if ( $db eq 'mysql' && ($tbl eq 'general_log' || $tbl eq 'slow_log') ) {
|
||||
return 0;
|
||||
}
|
||||
return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
|
||||
general_log
|
||||
|slow_log
|
||||
|innodb_index_stats
|
||||
|innodb_table_stats
|
||||
|slave_master_info
|
||||
|slave_relay_log_info
|
||||
|slave_worker_info
|
||||
)$/x;
|
||||
|
||||
if ( $filter->{'ignore-tables'}->{$tbl}
|
||||
&& ($filter->{'ignore-tables'}->{$tbl} eq '*'
|
||||
@@ -4128,12 +4140,18 @@ sub _resume_from_database {
|
||||
my ($self, $db) = @_;
|
||||
|
||||
return 1 unless $self->{resume}->{db};
|
||||
|
||||
if ( $db eq $self->{resume}->{db} ) {
|
||||
PTDEBUG && _d('At resume db', $db);
|
||||
if ( !$self->{resume}->{after}->{db} ) {
|
||||
PTDEBUG && _d('Resuming from db', $db);
|
||||
delete $self->{resume}->{db};
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
PTDEBUG && _d('Resuming after db', $db);
|
||||
delete $self->{resume}->{db};
|
||||
delete $self->{resume}->{tbl};
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -4144,7 +4162,7 @@ sub _resume_from_table {
|
||||
return 1 unless $self->{resume}->{tbl};
|
||||
|
||||
if ( $tbl eq $self->{resume}->{tbl} ) {
|
||||
if ( !$self->{resume}->{after} ) {
|
||||
if ( !$self->{resume}->{after}->{tbl} ) {
|
||||
PTDEBUG && _d('Resuming from table', $tbl);
|
||||
delete $self->{resume}->{tbl};
|
||||
return 1;
|
||||
|
@@ -2332,8 +2332,10 @@ report_mysql_summary () {
|
||||
|
||||
TOOL="pt-mysql-summary"
|
||||
|
||||
CMD_MYSQL="$(_which mysql)"
|
||||
CMD_MYSQLDUMP="$( _which mysqldump )"
|
||||
# These vars are declared earlier in the collect_mysql_info package,
|
||||
# but if they're still undefined here, try to find them in PATH.
|
||||
[ "$CMD_MYSQL" ] || CMD_MYSQL="$(_which mysql)"
|
||||
[ "$CMD_MYSQLDUMP" ] || CMD_MYSQLDUMP="$( _which mysqldump )"
|
||||
|
||||
check_mysql () {
|
||||
# Check that mysql and mysqldump are in PATH. If not, we're
|
||||
|
@@ -6986,9 +6986,15 @@ sub table_is_allowed {
|
||||
|
||||
my $filter = $self->{filters};
|
||||
|
||||
if ( $db eq 'mysql' && ($tbl eq 'general_log' || $tbl eq 'slow_log') ) {
|
||||
return 0;
|
||||
}
|
||||
return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
|
||||
general_log
|
||||
|slow_log
|
||||
|innodb_index_stats
|
||||
|innodb_table_stats
|
||||
|slave_master_info
|
||||
|slave_relay_log_info
|
||||
|slave_worker_info
|
||||
)$/x;
|
||||
|
||||
if ( $filter->{'ignore-tables'}->{$tbl}
|
||||
&& ($filter->{'ignore-tables'}->{$tbl} eq '*'
|
||||
@@ -10123,9 +10129,9 @@ sub check_repl_table {
|
||||
}
|
||||
}
|
||||
else {
|
||||
warn $EVAL_ERROR;
|
||||
die "--replicate database $db does not exist and it cannot be "
|
||||
. "created automatically. You need to create the database. "
|
||||
. $EVAL_ERROR;
|
||||
. "created automatically. You need to create the database.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10193,9 +10199,9 @@ sub check_repl_table {
|
||||
}
|
||||
}
|
||||
else {
|
||||
warn $EVAL_ERROR;
|
||||
die "--replicate table $tbl does not exist and it cannot be "
|
||||
. "created automatically. You need to create the table. "
|
||||
. $EVAL_ERROR;
|
||||
. "created automatically. You need to create the table.\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7521,11 +7521,16 @@ sub next {
|
||||
|
||||
if ( !$self->{initialized} ) {
|
||||
$self->{initialized} = 1;
|
||||
if ( $self->{resume}->{tbl}
|
||||
&& !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
|
||||
if ( $self->{resume}->{tbl} ) {
|
||||
if ( !$self->table_is_allowed(@{$self->{resume}}{qw(db tbl)}) ) {
|
||||
PTDEBUG && _d('Will resume after',
|
||||
join('.', @{$self->{resume}}{qw(db tbl)}));
|
||||
$self->{resume}->{after} = 1;
|
||||
$self->{resume}->{after}->{tbl} = 1;
|
||||
}
|
||||
if ( !$self->database_is_allowed($self->{resume}->{db}) ) {
|
||||
PTDEBUG && _d('Will resume after', $self->{resume}->{db});
|
||||
$self->{resume}->{after}->{db} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7623,16 +7628,17 @@ sub _iterate_dbh {
|
||||
if ( !defined $self->{dbs} ) {
|
||||
my $sql = 'SHOW DATABASES';
|
||||
PTDEBUG && _d($sql);
|
||||
my @dbs = grep { $self->database_is_allowed($_) }
|
||||
@{$dbh->selectcol_arrayref($sql)};
|
||||
my @dbs = grep {
|
||||
$self->_resume_from_database($_)
|
||||
&&
|
||||
$self->database_is_allowed($_)
|
||||
} @{$dbh->selectcol_arrayref($sql)};
|
||||
PTDEBUG && _d('Found', scalar @dbs, 'databases');
|
||||
$self->{dbs} = \@dbs;
|
||||
}
|
||||
|
||||
if ( !$self->{db} ) {
|
||||
do {
|
||||
$self->{db} = shift @{$self->{dbs}};
|
||||
} until $self->_resume_from_database($self->{db});
|
||||
PTDEBUG && _d('Next database:', $self->{db});
|
||||
return unless $self->{db};
|
||||
}
|
||||
@@ -7734,9 +7740,15 @@ sub table_is_allowed {
|
||||
|
||||
my $filter = $self->{filters};
|
||||
|
||||
if ( $db eq 'mysql' && ($tbl eq 'general_log' || $tbl eq 'slow_log') ) {
|
||||
return 0;
|
||||
}
|
||||
return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
|
||||
general_log
|
||||
|slow_log
|
||||
|innodb_index_stats
|
||||
|innodb_table_stats
|
||||
|slave_master_info
|
||||
|slave_relay_log_info
|
||||
|slave_worker_info
|
||||
)$/x;
|
||||
|
||||
if ( $filter->{'ignore-tables'}->{$tbl}
|
||||
&& ($filter->{'ignore-tables'}->{$tbl} eq '*'
|
||||
@@ -7805,12 +7817,18 @@ sub _resume_from_database {
|
||||
my ($self, $db) = @_;
|
||||
|
||||
return 1 unless $self->{resume}->{db};
|
||||
|
||||
if ( $db eq $self->{resume}->{db} ) {
|
||||
PTDEBUG && _d('At resume db', $db);
|
||||
if ( !$self->{resume}->{after}->{db} ) {
|
||||
PTDEBUG && _d('Resuming from db', $db);
|
||||
delete $self->{resume}->{db};
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
PTDEBUG && _d('Resuming after db', $db);
|
||||
delete $self->{resume}->{db};
|
||||
delete $self->{resume}->{tbl};
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -7821,7 +7839,7 @@ sub _resume_from_table {
|
||||
return 1 unless $self->{resume}->{tbl};
|
||||
|
||||
if ( $tbl eq $self->{resume}->{tbl} ) {
|
||||
if ( !$self->{resume}->{after} ) {
|
||||
if ( !$self->{resume}->{after}->{tbl} ) {
|
||||
PTDEBUG && _d('Resuming from table', $tbl);
|
||||
delete $self->{resume}->{tbl};
|
||||
return 1;
|
||||
|
@@ -212,7 +212,8 @@ sub get_cxn_params {
|
||||
. join(';', map { "$opts{$_}->{dsn}=$info->{$_}" }
|
||||
grep { defined $info->{$_} }
|
||||
qw(F h P S A))
|
||||
. ';mysql_read_default_group=client';
|
||||
. ';mysql_read_default_group=client'
|
||||
. ($info->{L} ? ';mysql_local_infile=1' : '');
|
||||
}
|
||||
PTDEBUG && _d($dsn);
|
||||
return ($dsn, $info->{u}, $info->{p});
|
||||
@@ -241,6 +242,9 @@ sub get_dbh {
|
||||
mysql_enable_utf8 => ($cxn_string =~ m/charset=utf8/i ? 1 : 0),
|
||||
};
|
||||
@{$defaults}{ keys %$opts } = values %$opts;
|
||||
if (delete $defaults->{L}) { # L for LOAD DATA LOCAL INFILE, our own extension
|
||||
$defaults->{mysql_local_infile} = 1;
|
||||
}
|
||||
|
||||
if ( $opts->{mysql_use_result} ) {
|
||||
$defaults->{mysql_use_result} = 1;
|
||||
|
@@ -11980,13 +11980,23 @@ sub main {
|
||||
# ########################################################################
|
||||
# Do the version-check
|
||||
# ########################################################################
|
||||
if ( $o->get('version-check') ne 'off' && (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
if ( $o->get('version-check') ne 'off'
|
||||
&& (!$o->has('quiet') || !$o->get('quiet')) ) {
|
||||
Pingback::version_check(
|
||||
instances => [ map({ +{ dbh => $_->{dbh}, dsn => $_->{dsn} } } @$hosts) ],
|
||||
protocol => $o->get('version-check'),
|
||||
);
|
||||
}
|
||||
|
||||
# ########################################################################
|
||||
# Disable the query cache.
|
||||
# ########################################################################
|
||||
if ( $o->get('disable-query-cache') ) {
|
||||
foreach my $host ( @$hosts ) {
|
||||
disable_query_cache($host);
|
||||
}
|
||||
}
|
||||
|
||||
# ########################################################################
|
||||
# Short version: do it! Long version: this callback does the main work.
|
||||
# The big picture is:
|
||||
@@ -12385,6 +12395,31 @@ sub get_cxn {
|
||||
return $dbh;
|
||||
}
|
||||
|
||||
sub disable_query_cache {
|
||||
my ($host) = @_;
|
||||
die "I need a host argument" unless $host;
|
||||
my ($dbh, $host_name) = @{$host}{qw(dbh name)};
|
||||
|
||||
my $sql = 'SELECT @@query_cache_type';
|
||||
PTDEBUG && _d($host_name, $sql);
|
||||
my ($query_cache_type) = $dbh->selectrow_array($sql);
|
||||
PTDEBUG && _d($host_name, $query_cache_type);
|
||||
return if ($query_cache_type || '') =~ m/OFF|0/;
|
||||
|
||||
$sql = q/SET SESSION query_cache_type = OFF/;
|
||||
eval {
|
||||
PTDEBUG && _d($host_name, $sql);
|
||||
$dbh->do($sql);
|
||||
};
|
||||
if ( $EVAL_ERROR ) {
|
||||
warn $EVAL_ERROR;
|
||||
die "Failed to $sql on $host_name. Disable the query cache "
|
||||
. "manually, or specify --no-disable-query-cache.\n";
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
# Catches signals so we can exit gracefully.
|
||||
sub sig_int {
|
||||
my ( $signal ) = @_;
|
||||
@@ -12693,6 +12728,12 @@ C<SELECT col FROM tbl WHERE id=1>.
|
||||
Fork to the background and detach from the shell. POSIX
|
||||
operating systems only.
|
||||
|
||||
=item --[no]disable-query-cache
|
||||
|
||||
default: yes
|
||||
|
||||
C<SET SESSION query_cache_type = OFF> to disable the query cache.
|
||||
|
||||
=item --explain-hosts
|
||||
|
||||
Print connection information and exit.
|
||||
@@ -12861,7 +12902,7 @@ interrupt with CTRL-C).
|
||||
|
||||
=item --set-vars
|
||||
|
||||
type: string; default: wait_timeout=10000,query_cache_type=0
|
||||
type: string; default: wait_timeout=10000
|
||||
|
||||
Set these MySQL variables. Immediately after connecting to MySQL, this
|
||||
string will be appended to SET and executed.
|
||||
|
@@ -1900,7 +1900,8 @@ sub get_cxn_params {
|
||||
. join(';', map { "$opts{$_}->{dsn}=$info->{$_}" }
|
||||
grep { defined $info->{$_} }
|
||||
qw(F h P S A))
|
||||
. ';mysql_read_default_group=client';
|
||||
. ';mysql_read_default_group=client'
|
||||
. ($info->{L} ? ';mysql_local_infile=1' : '');
|
||||
}
|
||||
PTDEBUG && _d($dsn);
|
||||
return ($dsn, $info->{u}, $info->{p});
|
||||
@@ -1929,6 +1930,9 @@ sub get_dbh {
|
||||
mysql_enable_utf8 => ($cxn_string =~ m/charset=utf8/i ? 1 : 0),
|
||||
};
|
||||
@{$defaults}{ keys %$opts } = values %$opts;
|
||||
if (delete $defaults->{L}) { # L for LOAD DATA LOCAL INFILE, our own extension
|
||||
$defaults->{mysql_local_infile} = 1;
|
||||
}
|
||||
|
||||
if ( $opts->{mysql_use_result} ) {
|
||||
$defaults->{mysql_use_result} = 1;
|
||||
|
@@ -126,12 +126,13 @@ sub create_dbs {
|
||||
}
|
||||
|
||||
sub get_dbh_for {
|
||||
my ( $self, $server, $cxn_ops ) = @_;
|
||||
my ( $self, $server, $cxn_ops, $user ) = @_;
|
||||
_check_server($server);
|
||||
$cxn_ops ||= { AutoCommit => 1 };
|
||||
$user ||= 'msandbox';
|
||||
PTDEBUG && _d('dbh for', $server, 'on port', $port_for{$server});
|
||||
my $dp = $self->{DSNParser};
|
||||
my $dsn = $dp->parse('h=127.0.0.1,u=msandbox,p=msandbox,P=' . $port_for{$server});
|
||||
my $dsn = $dp->parse("h=127.0.0.1,u=$user,p=msandbox,P=" . $port_for{$server});
|
||||
my $dbh;
|
||||
# This is primarily for the benefit of CompareResults, but it's
|
||||
# also quite convenient when using an affected OS
|
||||
@@ -335,11 +336,11 @@ sub wait_for_slaves {
|
||||
my $master_dbh = $self->get_dbh_for($args{master} || 'master');
|
||||
my $slave2_dbh = $self->get_dbh_for($args{slave} || 'slave2');
|
||||
my ($ping) = $master_dbh->selectrow_array("SELECT MD5(RAND())");
|
||||
$master_dbh->do("UPDATE percona_test.sentinel SET ping='$ping' WHERE id=1");
|
||||
$master_dbh->do("UPDATE percona_test.sentinel SET ping='$ping' WHERE id=1 /* wait_for_slaves */");
|
||||
PerconaTest::wait_until(
|
||||
sub {
|
||||
my ($pong) = $slave2_dbh->selectrow_array(
|
||||
"SELECT ping FROM percona_test.sentinel WHERE id=1");
|
||||
"SELECT ping FROM percona_test.sentinel WHERE id=1 /* wait_for_slaves */");
|
||||
return $ping eq $pong;
|
||||
}, undef, 300
|
||||
);
|
||||
@@ -542,6 +543,23 @@ sub config_file_for {
|
||||
return "/tmp/$port/my.sandbox.cnf"
|
||||
}
|
||||
|
||||
sub do_as_root {
|
||||
my ($self, $server, @queries) = @_;
|
||||
my $dbh = $self->get_dbh_for($server, undef, 'root');
|
||||
my $ok = 1;
|
||||
eval {
|
||||
foreach my $query ( @queries ) {
|
||||
$dbh->do($query);
|
||||
}
|
||||
};
|
||||
if ( $EVAL_ERROR ) {
|
||||
$ok = 0;
|
||||
warn $EVAL_ERROR;
|
||||
}
|
||||
$dbh->disconnect;
|
||||
return $ok;
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
|
@@ -444,9 +444,15 @@ sub table_is_allowed {
|
||||
my $filter = $self->{filters};
|
||||
|
||||
# Always auto-skip these pseudo tables.
|
||||
if ( $db eq 'mysql' && ($tbl eq 'general_log' || $tbl eq 'slow_log') ) {
|
||||
return 0;
|
||||
}
|
||||
return 0 if $db eq 'mysql' && $tbl =~ m/^(?:
|
||||
general_log
|
||||
|slow_log
|
||||
|innodb_index_stats
|
||||
|innodb_table_stats
|
||||
|slave_master_info
|
||||
|slave_relay_log_info
|
||||
|slave_worker_info
|
||||
)$/x;
|
||||
|
||||
if ( $filter->{'ignore-tables'}->{$tbl}
|
||||
&& ($filter->{'ignore-tables'}->{$tbl} eq '*'
|
||||
|
@@ -193,6 +193,10 @@ sub parse_timestamp {
|
||||
. (defined $f ? '%09.6f' : '%02d'),
|
||||
$y + 2000, $m, $d, $h, $i, (defined $f ? $s + $f : $s);
|
||||
}
|
||||
# MySQL 5.6+ uses "proper" timestamps
|
||||
elsif ( $val =~ m/^$proper_ts$/ ) {
|
||||
return $val;
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@@ -34,7 +34,7 @@ make_sandbox() {
|
||||
cp $PERCONA_TOOLKIT_BRANCH/sandbox/servers/$version/my.sandbox.cnf /tmp/$port
|
||||
tar xzf $PERCONA_TOOLKIT_BRANCH/sandbox/servers/$version/data.tar.gz -C /tmp/$port
|
||||
|
||||
for script in `ls $PERCONA_TOOLKIT_BRANCH/sandbox/servers/*`; do
|
||||
for script in "$PERCONA_TOOLKIT_BRANCH/sandbox/servers/"*; do
|
||||
if [ -f $script ]; then
|
||||
cp $script /tmp/$port
|
||||
fi
|
||||
@@ -89,6 +89,9 @@ make_sandbox() {
|
||||
if [ -n "$SKIP_INNODB" ]; then
|
||||
echo "skip-innodb" >> /tmp/$port/my.sandbox.cnf
|
||||
echo "default-storage-engine=myisam" >> /tmp/$port/my.sandbox.cnf
|
||||
if [ "$version" ">" "5.5" ]; then
|
||||
echo "default-tmp-storage-engine=myisam" >> /tmp/$port/my.sandbox.cnf
|
||||
fi
|
||||
fi
|
||||
if [ -n "$MODE_ANSI" ]; then
|
||||
echo "sql_mode=ansi" >> /tmp/$port/my.sandbox.cnf
|
||||
@@ -99,6 +102,10 @@ make_sandbox() {
|
||||
if [ -n "$LOCAL_INFILE" ]; then
|
||||
echo "local-infile=$LOCAL_INFILE" >> /tmp/$port/my.sandbox.cnf
|
||||
fi
|
||||
if [ -n "$QUERY_CACHE_SIZE" ]; then
|
||||
echo "query_cache_type=1" >> /tmp/$port/my.sandbox.cnf
|
||||
echo "query_cache_size=$QUERY_CACHE_SIZE" >> /tmp/$port/my.sandbox.cnf
|
||||
fi
|
||||
|
||||
# If the sandbox is a slave, set it read_only.
|
||||
if [ "$type" = "slave" ]; then
|
||||
@@ -116,6 +123,10 @@ make_sandbox() {
|
||||
debug_sandbox $port
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for sql in "$PERCONA_TOOLKIT_BRANCH/sandbox/servers/$version/"*.sql; do
|
||||
[ -f "$sql" ] && /tmp/$port/use < $sql
|
||||
done
|
||||
fi
|
||||
else
|
||||
echo "Sandbox $type $port failed to start." >&2
|
||||
@@ -123,6 +134,10 @@ make_sandbox() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/tmp/$port/use -e "CREATE DATABASE IF NOT EXISTS percona_test";
|
||||
/tmp/$port/use -e "CREATE TABLE IF NOT EXISTS percona_test.sentinel (id INT PRIMARY KEY, ping VARCHAR(64) NOT NULL DEFAULT '')";
|
||||
/tmp/$port/use -e "REPLACE INTO percona_test.sentinel (id, ping) VALUES (1, '')";
|
||||
|
||||
# If the sandbox is a slave, start the slave.
|
||||
if [ "$type" = "slave" ]; then
|
||||
/tmp/$port/use -e "change master to master_host='127.0.0.1', master_user='msandbox', master_password='msandbox', master_port=$master_port"
|
||||
|
@@ -334,11 +334,10 @@ case $opt in
|
||||
../util/check-load-data
|
||||
|
||||
ping=$(/tmp/12345/use -ss -e "SELECT MD5(RAND())")
|
||||
/tmp/12345/use -e "create table percona_test.sentinel(id int primary key, ping varchar(64) not null default '')"
|
||||
/tmp/12345/use -e "insert into percona_test.sentinel(id, ping) values(1, '$ping')";
|
||||
/tmp/12345/use -e "UPDATE percona_test.sentinel SET ping='$ping' WHERE id=1";
|
||||
echo -n "Waiting for replication to finish..."
|
||||
for i in $(_seq 60); do
|
||||
pong=$(/tmp/12347/use -ss -e 'select ping from percona_test.sentinel where id=1' 2>/dev/null)
|
||||
pong=$(/tmp/12347/use -ss -e 'SELECT ping FROM percona_test.sentinel WHERE id=1' 2>/dev/null)
|
||||
[ "$ping" = "$pong" ] && break
|
||||
echo -n '.'
|
||||
sleep 1
|
||||
|
@@ -31,9 +31,6 @@ my $dbh = $sb->get_dbh_for('master', {no_lc=>1});
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => "Cannot connect to sandbox master";
|
||||
}
|
||||
else {
|
||||
plan tests => 17;
|
||||
}
|
||||
|
||||
$dbh->do('use sakila');
|
||||
|
||||
@@ -60,7 +57,7 @@ is_deeply(
|
||||
key_len => 2,
|
||||
ref => 'const',
|
||||
rows => 1,
|
||||
Extra => '',
|
||||
Extra => $sandbox_version eq '5.6' ? undef : '',
|
||||
},
|
||||
],
|
||||
'Got a simple EXPLAIN result',
|
||||
@@ -81,7 +78,7 @@ is_deeply(
|
||||
key_len => 2,
|
||||
ref => 'const',
|
||||
rows => 1,
|
||||
Extra => '',
|
||||
Extra => $sandbox_version eq '5.6' ? undef : '',
|
||||
},
|
||||
],
|
||||
'Got EXPLAIN result for a DELETE',
|
||||
@@ -575,4 +572,4 @@ is(
|
||||
# Done.
|
||||
# #############################################################################
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
exit;
|
||||
done_testing;
|
||||
|
@@ -713,8 +713,8 @@ cmp_ok(
|
||||
# ############################################################################
|
||||
$ni = make_nibble_iter(
|
||||
db => 'mysql',
|
||||
tbl => 'host',
|
||||
argv => [qw(--tables mysql.host --chunk-size-limit 0)],
|
||||
tbl => 'columns_priv',
|
||||
argv => [qw(--tables mysql.columns_priv --chunk-size-limit 0)],
|
||||
);
|
||||
|
||||
@rows = ();
|
||||
|
@@ -1141,8 +1141,8 @@ SKIP: {
|
||||
);
|
||||
|
||||
my $explain = load_file(
|
||||
$sandbox_version ge '5.1'
|
||||
? "t/lib/samples/QueryReportFormatter/report025.txt"
|
||||
$sandbox_version eq '5.6' ? "t/lib/samples/QueryReportFormatter/report031.txt"
|
||||
: $sandbox_version ge '5.1' ? "t/lib/samples/QueryReportFormatter/report025.txt"
|
||||
: "t/lib/samples/QueryReportFormatter/report026.txt");
|
||||
|
||||
is(
|
||||
@@ -1180,11 +1180,13 @@ SKIP: {
|
||||
# so if it doesn't USE db then the EXPLAIN will fail. Here we reset
|
||||
# the db to something else because we already called explain_report()
|
||||
# above which did USE qrf.
|
||||
#
|
||||
# 5.6 really is that different: ia vs. TF>aI. It's smarter.
|
||||
$dbh->do("USE mysql");
|
||||
my $explain_sparkline = $qrf->explain_sparkline($arg, 'qrf');
|
||||
is(
|
||||
$explain_sparkline,
|
||||
"TF>aI",
|
||||
$sandbox_version eq '5.6' ? "ia" : "TF>aI",
|
||||
"explain_sparkling() uses db"
|
||||
);
|
||||
|
||||
@@ -1206,8 +1208,8 @@ SKIP: {
|
||||
groupby => 'fingerprint',
|
||||
);
|
||||
},
|
||||
($sandbox_version ge '5.1' ?
|
||||
"t/lib/samples/QueryReportFormatter/report027.txt"
|
||||
( $sandbox_version eq '5.6' ? "t/lib/samples/QueryReportFormatter/report032.txt"
|
||||
: $sandbox_version ge '5.1' ? "t/lib/samples/QueryReportFormatter/report027.txt"
|
||||
: "t/lib/samples/QueryReportFormatter/report029.txt"),
|
||||
),
|
||||
"EXPLAIN sparkline (issue 1141)"
|
||||
|
@@ -149,9 +149,7 @@ SKIP: {
|
||||
# Test simple, unfiltered get_db_itr().
|
||||
# ########################################################################
|
||||
test_so(
|
||||
result => $sandbox_version ge '5.5' ? "$out/all-dbs-tbls.txt"
|
||||
: $sandbox_version ge '5.1' ? "$out/all-dbs-tbls-5.1.txt"
|
||||
: "$out/all-dbs-tbls-5.0.txt",
|
||||
result => "$out/all-dbs-tbls-$sandbox_version.txt",
|
||||
test_name => "Iterate all schema objects with dbh",
|
||||
);
|
||||
|
||||
@@ -331,9 +329,7 @@ SKIP: {
|
||||
# ########################################################################
|
||||
test_so(
|
||||
filters => [qw(-t mysql.user)],
|
||||
result => $sandbox_version ge '5.5' ? "$out/mysql-user-ddl-5.5.txt"
|
||||
: $sandbox_version ge '5.1' ? "$out/mysql-user-ddl.txt"
|
||||
: "$out/mysql-user-ddl-5.0.txt",
|
||||
result => "$out/mysql-user-ddl-$sandbox_version.txt",
|
||||
test_name => "Get CREATE TABLE with dbh",
|
||||
);
|
||||
|
||||
|
12
t/lib/samples/QueryReportFormatter/report031.txt
Normal file
12
t/lib/samples/QueryReportFormatter/report031.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
# *************************** 1. row ***************************
|
||||
# id: 1
|
||||
# select_type: SIMPLE
|
||||
# table: t
|
||||
# partitions: NULL
|
||||
# type: const
|
||||
# possible_keys: PRIMARY
|
||||
# key: PRIMARY
|
||||
# key_len: 4
|
||||
# ref: const
|
||||
# rows: 1
|
||||
# Extra: NULL
|
58
t/lib/samples/QueryReportFormatter/report032.txt
Normal file
58
t/lib/samples/QueryReportFormatter/report032.txt
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
# Profile
|
||||
# Rank Query ID Response time Calls R/Call Apdx V/M EXPLAIN Item
|
||||
# ==== ================== ============= ===== ====== ==== ===== ======= =========
|
||||
# 1 0x46F81B022F1AD76B 0.0003 100.0% 1 0.0003 NS 0.00 ia SELECT t
|
||||
# MISC 0xMISC 0.0003 100.0% 1 0.0003 NS 0.0 MISC <1 ITEMS>
|
||||
|
||||
# Query 1: 0 QPS, 0x concurrency, ID 0x46F81B022F1AD76B at byte 0 ________
|
||||
# Scores: Apdex = NS [0.0]*, V/M = 0.00
|
||||
# EXPLAIN sparkline: ia
|
||||
# Query_time sparkline: | ^ |
|
||||
# Time range: all events occurred at 2009-12-08 09:23:49.637394
|
||||
# Attribute pct total min max avg 95% stddev median
|
||||
# ============ === ======= ======= ======= ======= ======= ======= =======
|
||||
# Count 100 1
|
||||
# Exec time 100 286us 286us 286us 286us 286us 0 286us
|
||||
# Query size 100 90 90 90 90 90 0 90
|
||||
# String:
|
||||
# cmd Query
|
||||
# Databases qrf
|
||||
# Query_time distribution
|
||||
# 1us
|
||||
# 10us
|
||||
# 100us ################################################################
|
||||
# 1ms
|
||||
# 10ms
|
||||
# 100ms
|
||||
# 1s
|
||||
# 10s+
|
||||
# Tables
|
||||
# SHOW TABLE STATUS FROM `qrf` LIKE 't'\G
|
||||
# SHOW CREATE TABLE `qrf`.`t`\G
|
||||
# EXPLAIN /*!50100 PARTITIONS*/
|
||||
select t1.i from t as t1 join t as t2 where t1.i < t2.i and t1.v is not null order by t1.i\G
|
||||
# *************************** 1. row ***************************
|
||||
# id: 1
|
||||
# select_type: SIMPLE
|
||||
# table: t1
|
||||
# partitions: NULL
|
||||
# type: index
|
||||
# possible_keys: PRIMARY
|
||||
# key: PRIMARY
|
||||
# key_len: 4
|
||||
# ref: NULL
|
||||
# rows: 4
|
||||
# Extra: Using where
|
||||
# *************************** 2. row ***************************
|
||||
# id: 1
|
||||
# select_type: SIMPLE
|
||||
# table: t2
|
||||
# partitions: NULL
|
||||
# type: ALL
|
||||
# possible_keys: PRIMARY
|
||||
# key: NULL
|
||||
# key_len: NULL
|
||||
# ref: NULL
|
||||
# rows: 4
|
||||
# Extra: Range checked for each record (index map: 0x1)
|
537
t/lib/samples/SchemaIterator/all-dbs-tbls-5.6.txt
Normal file
537
t/lib/samples/SchemaIterator/all-dbs-tbls-5.6.txt
Normal file
@@ -0,0 +1,537 @@
|
||||
mysql.columns_priv
|
||||
CREATE TABLE `columns_priv` (
|
||||
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
|
||||
|
||||
mysql.db
|
||||
CREATE TABLE `db` (
|
||||
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`User` char(16) 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',
|
||||
`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',
|
||||
`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',
|
||||
`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',
|
||||
`Execute_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',
|
||||
PRIMARY KEY (`Host`,`Db`,`User`),
|
||||
KEY `User` (`User`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
|
||||
|
||||
mysql.event
|
||||
CREATE TABLE `event` (
|
||||
`db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`name` char(64) NOT NULL DEFAULT '',
|
||||
`body` longblob NOT NULL,
|
||||
`definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`execute_at` datetime DEFAULT NULL,
|
||||
`interval_value` int(11) DEFAULT NULL,
|
||||
`interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL,
|
||||
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`last_executed` datetime DEFAULT NULL,
|
||||
`starts` datetime DEFAULT NULL,
|
||||
`ends` datetime DEFAULT NULL,
|
||||
`status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED',
|
||||
`on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
|
||||
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
|
||||
`comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`originator` int(10) unsigned NOT NULL,
|
||||
`time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
|
||||
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`body_utf8` longblob,
|
||||
PRIMARY KEY (`db`,`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
|
||||
|
||||
mysql.func
|
||||
CREATE TABLE `func` (
|
||||
`name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`ret` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
|
||||
PRIMARY KEY (`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions'
|
||||
|
||||
mysql.help_category
|
||||
CREATE TABLE `help_category` (
|
||||
`help_category_id` smallint(5) unsigned NOT NULL,
|
||||
`name` char(64) NOT NULL,
|
||||
`parent_category_id` smallint(5) unsigned DEFAULT NULL,
|
||||
`url` char(128) NOT NULL,
|
||||
PRIMARY KEY (`help_category_id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='help categories'
|
||||
|
||||
mysql.help_keyword
|
||||
CREATE TABLE `help_keyword` (
|
||||
`help_keyword_id` int(10) unsigned NOT NULL,
|
||||
`name` char(64) NOT NULL,
|
||||
PRIMARY KEY (`help_keyword_id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='help keywords'
|
||||
|
||||
mysql.help_relation
|
||||
CREATE TABLE `help_relation` (
|
||||
`help_topic_id` int(10) unsigned NOT NULL,
|
||||
`help_keyword_id` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`help_keyword_id`,`help_topic_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='keyword-topic relation'
|
||||
|
||||
mysql.help_topic
|
||||
CREATE TABLE `help_topic` (
|
||||
`help_topic_id` int(10) unsigned NOT NULL,
|
||||
`name` char(64) NOT NULL,
|
||||
`help_category_id` smallint(5) unsigned NOT NULL,
|
||||
`description` text NOT NULL,
|
||||
`example` text NOT NULL,
|
||||
`url` char(128) NOT NULL,
|
||||
PRIMARY KEY (`help_topic_id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='help topics'
|
||||
|
||||
mysql.ndb_binlog_index
|
||||
CREATE TABLE `ndb_binlog_index` (
|
||||
`Position` bigint(20) unsigned NOT NULL,
|
||||
`File` varchar(255) NOT NULL,
|
||||
`epoch` bigint(20) unsigned NOT NULL,
|
||||
`inserts` int(10) unsigned NOT NULL,
|
||||
`updates` int(10) unsigned NOT NULL,
|
||||
`deletes` int(10) unsigned NOT NULL,
|
||||
`schemaops` int(10) unsigned NOT NULL,
|
||||
`orig_server_id` int(10) unsigned NOT NULL,
|
||||
`orig_epoch` bigint(20) unsigned NOT NULL,
|
||||
`gci` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`epoch`,`orig_server_id`,`orig_epoch`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
|
||||
mysql.plugin
|
||||
CREATE TABLE `plugin` (
|
||||
`name` varchar(64) NOT NULL DEFAULT '',
|
||||
`dl` varchar(128) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL plugins'
|
||||
|
||||
mysql.proc
|
||||
CREATE TABLE `proc` (
|
||||
`db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`name` char(64) NOT NULL DEFAULT '',
|
||||
`type` enum('FUNCTION','PROCEDURE') NOT NULL,
|
||||
`specific_name` char(64) NOT NULL DEFAULT '',
|
||||
`language` enum('SQL') NOT NULL DEFAULT 'SQL',
|
||||
`sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL',
|
||||
`is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO',
|
||||
`security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER',
|
||||
`param_list` blob NOT NULL,
|
||||
`returns` longblob NOT NULL,
|
||||
`body` longblob NOT NULL,
|
||||
`definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
|
||||
`comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
|
||||
`character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`body_utf8` longblob,
|
||||
PRIMARY KEY (`db`,`name`,`type`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures'
|
||||
|
||||
mysql.procs_priv
|
||||
CREATE TABLE `procs_priv` (
|
||||
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Routine_name` char(64) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
|
||||
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
|
||||
KEY `Grantor` (`Grantor`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges'
|
||||
|
||||
mysql.proxies_priv
|
||||
CREATE TABLE `proxies_priv` (
|
||||
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Proxied_host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Proxied_user` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`With_grant` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`),
|
||||
KEY `Grantor` (`Grantor`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges'
|
||||
|
||||
mysql.servers
|
||||
CREATE TABLE `servers` (
|
||||
`Server_name` char(64) NOT NULL DEFAULT '',
|
||||
`Host` char(64) NOT NULL DEFAULT '',
|
||||
`Db` char(64) NOT NULL DEFAULT '',
|
||||
`Username` char(64) NOT NULL DEFAULT '',
|
||||
`Password` char(64) NOT NULL DEFAULT '',
|
||||
`Port` int(4) NOT NULL DEFAULT '0',
|
||||
`Socket` char(64) NOT NULL DEFAULT '',
|
||||
`Wrapper` char(64) NOT NULL DEFAULT '',
|
||||
`Owner` char(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`Server_name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table'
|
||||
|
||||
mysql.tables_priv
|
||||
CREATE TABLE `tables_priv` (
|
||||
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
|
||||
KEY `Grantor` (`Grantor`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges'
|
||||
|
||||
mysql.time_zone
|
||||
CREATE TABLE `time_zone` (
|
||||
`Time_zone_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`Use_leap_seconds` enum('Y','N') NOT NULL DEFAULT 'N',
|
||||
PRIMARY KEY (`Time_zone_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zones'
|
||||
|
||||
mysql.time_zone_leap_second
|
||||
CREATE TABLE `time_zone_leap_second` (
|
||||
`Transition_time` bigint(20) NOT NULL,
|
||||
`Correction` int(11) NOT NULL,
|
||||
PRIMARY KEY (`Transition_time`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Leap seconds information for time zones'
|
||||
|
||||
mysql.time_zone_name
|
||||
CREATE TABLE `time_zone_name` (
|
||||
`Name` char(64) NOT NULL,
|
||||
`Time_zone_id` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`Name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone names'
|
||||
|
||||
mysql.time_zone_transition
|
||||
CREATE TABLE `time_zone_transition` (
|
||||
`Time_zone_id` int(10) unsigned NOT NULL,
|
||||
`Transition_time` bigint(20) NOT NULL,
|
||||
`Transition_type_id` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`Time_zone_id`,`Transition_time`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone transitions'
|
||||
|
||||
mysql.time_zone_transition_type
|
||||
CREATE TABLE `time_zone_transition_type` (
|
||||
`Time_zone_id` int(10) unsigned NOT NULL,
|
||||
`Transition_type_id` int(10) unsigned NOT NULL,
|
||||
`Offset` int(11) NOT NULL DEFAULT '0',
|
||||
`Is_DST` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`Abbreviation` char(8) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`Time_zone_id`,`Transition_type_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone transition types'
|
||||
|
||||
mysql.user
|
||||
CREATE TABLE `user` (
|
||||
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Password` char(41) CHARACTER SET latin1 COLLATE latin1_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 DEFAULT '',
|
||||
`authentication_string` text COLLATE utf8_bin,
|
||||
`password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
PRIMARY KEY (`Host`,`User`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
|
||||
|
||||
percona_test.checksums
|
||||
CREATE TABLE `checksums` (
|
||||
`db_tbl` varchar(128) NOT NULL,
|
||||
`checksum` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`db_tbl`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
|
||||
percona_test.load_data
|
||||
CREATE TABLE `load_data` (
|
||||
`i` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
|
||||
percona_test.sentinel
|
||||
CREATE TABLE `sentinel` (
|
||||
`id` int(11) NOT NULL,
|
||||
`ping` varchar(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
|
||||
sakila.actor
|
||||
CREATE TABLE `actor` (
|
||||
`actor_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`first_name` varchar(45) NOT NULL,
|
||||
`last_name` varchar(45) NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`actor_id`),
|
||||
KEY `idx_actor_last_name` (`last_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.address
|
||||
CREATE TABLE `address` (
|
||||
`address_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`address` varchar(50) NOT NULL,
|
||||
`address2` varchar(50) DEFAULT NULL,
|
||||
`district` varchar(20) NOT NULL,
|
||||
`city_id` smallint(5) unsigned NOT NULL,
|
||||
`postal_code` varchar(10) DEFAULT NULL,
|
||||
`phone` varchar(20) NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`address_id`),
|
||||
KEY `idx_fk_city_id` (`city_id`),
|
||||
CONSTRAINT `fk_address_city` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=606 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.category
|
||||
CREATE TABLE `category` (
|
||||
`category_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(25) NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`category_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.city
|
||||
CREATE TABLE `city` (
|
||||
`city_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`city` varchar(50) NOT NULL,
|
||||
`country_id` smallint(5) unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`city_id`),
|
||||
KEY `idx_fk_country_id` (`country_id`),
|
||||
CONSTRAINT `fk_city_country` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=601 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.country
|
||||
CREATE TABLE `country` (
|
||||
`country_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`country` varchar(50) NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`country_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.customer
|
||||
CREATE TABLE `customer` (
|
||||
`customer_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`store_id` tinyint(3) unsigned NOT NULL,
|
||||
`first_name` varchar(45) NOT NULL,
|
||||
`last_name` varchar(45) NOT NULL,
|
||||
`email` varchar(50) DEFAULT NULL,
|
||||
`address_id` smallint(5) unsigned NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`create_date` datetime NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`customer_id`),
|
||||
KEY `idx_fk_store_id` (`store_id`),
|
||||
KEY `idx_fk_address_id` (`address_id`),
|
||||
KEY `idx_last_name` (`last_name`),
|
||||
CONSTRAINT `fk_customer_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_customer_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=600 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.film
|
||||
CREATE TABLE `film` (
|
||||
`film_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`description` text,
|
||||
`release_year` year(4) DEFAULT NULL,
|
||||
`language_id` tinyint(3) unsigned NOT NULL,
|
||||
`original_language_id` tinyint(3) unsigned DEFAULT NULL,
|
||||
`rental_duration` tinyint(3) unsigned NOT NULL DEFAULT '3',
|
||||
`rental_rate` decimal(4,2) NOT NULL DEFAULT '4.99',
|
||||
`length` smallint(5) unsigned DEFAULT NULL,
|
||||
`replacement_cost` decimal(5,2) NOT NULL DEFAULT '19.99',
|
||||
`rating` enum('G','PG','PG-13','R','NC-17') DEFAULT 'G',
|
||||
`special_features` set('Trailers','Commentaries','Deleted Scenes','Behind the Scenes') DEFAULT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`film_id`),
|
||||
KEY `idx_title` (`title`),
|
||||
KEY `idx_fk_language_id` (`language_id`),
|
||||
KEY `idx_fk_original_language_id` (`original_language_id`),
|
||||
CONSTRAINT `fk_film_language` FOREIGN KEY (`language_id`) REFERENCES `language` (`language_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_film_language_original` FOREIGN KEY (`original_language_id`) REFERENCES `language` (`language_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.film_actor
|
||||
CREATE TABLE `film_actor` (
|
||||
`actor_id` smallint(5) unsigned NOT NULL,
|
||||
`film_id` smallint(5) unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`actor_id`,`film_id`),
|
||||
KEY `idx_fk_film_id` (`film_id`),
|
||||
CONSTRAINT `fk_film_actor_actor` FOREIGN KEY (`actor_id`) REFERENCES `actor` (`actor_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_film_actor_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.film_category
|
||||
CREATE TABLE `film_category` (
|
||||
`film_id` smallint(5) unsigned NOT NULL,
|
||||
`category_id` tinyint(3) unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`film_id`,`category_id`),
|
||||
KEY `fk_film_category_category` (`category_id`),
|
||||
CONSTRAINT `fk_film_category_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_film_category_category` FOREIGN KEY (`category_id`) REFERENCES `category` (`category_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.film_text
|
||||
CREATE TABLE `film_text` (
|
||||
`film_id` smallint(6) NOT NULL,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`description` text,
|
||||
PRIMARY KEY (`film_id`),
|
||||
FULLTEXT KEY `idx_title_description` (`title`,`description`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.inventory
|
||||
CREATE TABLE `inventory` (
|
||||
`inventory_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`film_id` smallint(5) unsigned NOT NULL,
|
||||
`store_id` tinyint(3) unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`inventory_id`),
|
||||
KEY `idx_fk_film_id` (`film_id`),
|
||||
KEY `idx_store_id_film_id` (`store_id`,`film_id`),
|
||||
CONSTRAINT `fk_inventory_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_inventory_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4582 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.language
|
||||
CREATE TABLE `language` (
|
||||
`language_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` char(20) NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`language_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.payment
|
||||
CREATE TABLE `payment` (
|
||||
`payment_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`customer_id` smallint(5) unsigned NOT NULL,
|
||||
`staff_id` tinyint(3) unsigned NOT NULL,
|
||||
`rental_id` int(11) DEFAULT NULL,
|
||||
`amount` decimal(5,2) NOT NULL,
|
||||
`payment_date` datetime NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`payment_id`),
|
||||
KEY `idx_fk_staff_id` (`staff_id`),
|
||||
KEY `idx_fk_customer_id` (`customer_id`),
|
||||
KEY `fk_payment_rental` (`rental_id`),
|
||||
CONSTRAINT `fk_payment_rental` FOREIGN KEY (`rental_id`) REFERENCES `rental` (`rental_id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_payment_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_payment_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.rental
|
||||
CREATE TABLE `rental` (
|
||||
`rental_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`rental_date` datetime NOT NULL,
|
||||
`inventory_id` mediumint(8) unsigned NOT NULL,
|
||||
`customer_id` smallint(5) unsigned NOT NULL,
|
||||
`return_date` datetime DEFAULT NULL,
|
||||
`staff_id` tinyint(3) unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`rental_id`),
|
||||
UNIQUE KEY `rental_date` (`rental_date`,`inventory_id`,`customer_id`),
|
||||
KEY `idx_fk_inventory_id` (`inventory_id`),
|
||||
KEY `idx_fk_customer_id` (`customer_id`),
|
||||
KEY `idx_fk_staff_id` (`staff_id`),
|
||||
CONSTRAINT `fk_rental_staff` FOREIGN KEY (`staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_rental_inventory` FOREIGN KEY (`inventory_id`) REFERENCES `inventory` (`inventory_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_rental_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16050 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.staff
|
||||
CREATE TABLE `staff` (
|
||||
`staff_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`first_name` varchar(45) NOT NULL,
|
||||
`last_name` varchar(45) NOT NULL,
|
||||
`address_id` smallint(5) unsigned NOT NULL,
|
||||
`picture` blob,
|
||||
`email` varchar(50) DEFAULT NULL,
|
||||
`store_id` tinyint(3) unsigned NOT NULL,
|
||||
`active` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`username` varchar(16) NOT NULL,
|
||||
`password` varchar(40) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`staff_id`),
|
||||
KEY `idx_fk_store_id` (`store_id`),
|
||||
KEY `idx_fk_address_id` (`address_id`),
|
||||
CONSTRAINT `fk_staff_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_staff_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8
|
||||
|
||||
sakila.store
|
||||
CREATE TABLE `store` (
|
||||
`store_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`manager_staff_id` tinyint(3) unsigned NOT NULL,
|
||||
`address_id` smallint(5) unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`store_id`),
|
||||
UNIQUE KEY `idx_unique_manager` (`manager_staff_id`),
|
||||
KEY `idx_fk_address_id` (`address_id`),
|
||||
CONSTRAINT `fk_store_staff` FOREIGN KEY (`manager_staff_id`) REFERENCES `staff` (`staff_id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_store_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8
|
||||
|
48
t/lib/samples/SchemaIterator/mysql-user-ddl-5.6.txt
Normal file
48
t/lib/samples/SchemaIterator/mysql-user-ddl-5.6.txt
Normal file
@@ -0,0 +1,48 @@
|
||||
mysql.user
|
||||
CREATE TABLE `user` (
|
||||
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Password` char(41) CHARACTER SET latin1 COLLATE latin1_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 DEFAULT '',
|
||||
`authentication_string` text COLLATE utf8_bin,
|
||||
`password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
|
||||
PRIMARY KEY (`Host`,`User`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges'
|
||||
|
30
t/lib/samples/stored-objs.sql
Normal file
30
t/lib/samples/stored-objs.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
DROP DATABASE IF EXISTS pt_find;
|
||||
CREATE DATABASE pt_find;
|
||||
USE pt_find;
|
||||
|
||||
create table t1 (
|
||||
id int not null primary key
|
||||
) engine=innodb;
|
||||
|
||||
create table t2 (
|
||||
id int not null primary key
|
||||
) engine=innodb;
|
||||
|
||||
CREATE FUNCTION hello (s CHAR(20))
|
||||
RETURNS CHAR(50) DETERMINISTIC
|
||||
RETURN CONCAT('Hello, ',s,'!');
|
||||
|
||||
delimiter //
|
||||
|
||||
CREATE PROCEDURE simpleproc (OUT param1 INT)
|
||||
BEGIN
|
||||
SELECT COUNT(*) INTO param1 FROM t;
|
||||
END//
|
||||
|
||||
CREATE TRIGGER ins_trg BEFORE INSERT ON t1
|
||||
FOR EACH ROW BEGIN
|
||||
INSERT INTO t2 VALUES (NEW.id);
|
||||
END;
|
||||
//
|
||||
|
||||
delimiter ;
|
@@ -23,101 +23,127 @@ my $dbh2 = $sb->get_dbh_for('slave1');
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
else {
|
||||
plan tests => 7;
|
||||
elsif ( !$dbh2 ) {
|
||||
plan skip_all => 'Cannot connect to sandbox slave';
|
||||
}
|
||||
|
||||
my $output;
|
||||
my $cnf = "/tmp/12345/my.sandbox.cnf";
|
||||
my $cmd = "$trunk/bin/pt-archiver";
|
||||
my $pid_file = "/tmp/pt-archiver-test.pid.$PID";
|
||||
my $sentinel = "/tmp/pt-archiver-test.sentinel.$PID";
|
||||
|
||||
$sb->create_dbs($dbh, [qw(test)]);
|
||||
|
||||
SKIP: {
|
||||
skip 'Sandbox master does not have the sakila database', 1
|
||||
unless @{$dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")};
|
||||
|
||||
$output = `$cmd --source F=$cnf,h=127.1,D=sakila,t=film --no-check-charset --where "film_id < 100" --purge --dry-run --port 12345 | diff $trunk/t/pt-archiver/samples/issue-248.txt -`;
|
||||
is(
|
||||
$output,
|
||||
'',
|
||||
ok(
|
||||
no_diff(
|
||||
sub {
|
||||
pt_archiver::main('--source', "F=$cnf,h=127.1,D=sakila,t=film",
|
||||
qw(--no-check-charset --purge --dry-run --port 12345),
|
||||
"--where", "film_id < 100")
|
||||
},
|
||||
"t/pt-archiver/samples/issue-248.txt",
|
||||
),
|
||||
'DSNs inherit from standard connection options (issue 248)'
|
||||
);
|
||||
};
|
||||
|
||||
);
|
||||
|
||||
# Test with a sentinel file
|
||||
$sb->load_file('master', 't/pt-archiver/samples/table1.sql');
|
||||
diag(`touch sentinel`);
|
||||
diag(`touch $sentinel`);
|
||||
|
||||
$output = output(
|
||||
sub { pt_archiver::main(qw(--where 1=1 --why-quit --sentinel sentinel), "--source", "D=test,t=table_1,F=$cnf", qw(--purge)) },
|
||||
sub { pt_archiver::main("--source", "D=test,t=table_1,F=$cnf",
|
||||
qw(--where 1=1 --why-quit --purge),
|
||||
"--sentinel", $sentinel)
|
||||
},
|
||||
stderr => 1,
|
||||
);
|
||||
like($output, qr/because sentinel/, 'Exits because of sentinel');
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/because sentinel file $sentinel exists/,
|
||||
'Exits because of sentinel'
|
||||
);
|
||||
|
||||
$output = `/tmp/12345/use -N -e "select count(*) from test.table_1"`;
|
||||
is($output + 0, 4, 'No rows were deleted');
|
||||
`rm sentinel`;
|
||||
is(
|
||||
$output + 0,
|
||||
4,
|
||||
'No rows were deleted'
|
||||
) or diag($output);
|
||||
|
||||
diag(`rm -f $sentinel`);
|
||||
|
||||
# Test --stop, which sets the sentinel
|
||||
$output = output(
|
||||
sub { pt_archiver::main(qw(--sentinel sentinel --stop)) },
|
||||
sub { pt_archiver::main("--sentinel", $sentinel, "--stop") },
|
||||
);
|
||||
like($output, qr/Successfully created file sentinel/, 'Created the sentinel OK');
|
||||
diag(`rm -f sentinel >/dev/null`);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/Successfully created file $sentinel/,
|
||||
'Created the sentinel OK'
|
||||
);
|
||||
|
||||
diag(`rm -f $sentinel`);
|
||||
|
||||
# #############################################################################
|
||||
# Issue 391: Add --pid option to mk-table-sync
|
||||
# #############################################################################
|
||||
`touch /tmp/mk-archiver.pid`;
|
||||
$output = `$cmd --where 1=1 --source F=$cnf,D=test,t=issue_131_src --statistics --dest t=issue_131_dst --pid /tmp/mk-archiver.pid 2>&1`;
|
||||
diag(`touch $pid_file`);
|
||||
|
||||
$output = output(
|
||||
sub { pt_archiver::main('--source', "F=$cnf,D=test,t=issue_131_src",
|
||||
qw(--where 1=1 --statistics --dest t=issue_131_dst),
|
||||
"--pid", $pid_file)
|
||||
},
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr{PID file /tmp/mk-archiver.pid already exists},
|
||||
qr{PID file $pid_file already exists},
|
||||
'Dies if PID file already exists (issue 391)'
|
||||
);
|
||||
|
||||
`rm -rf /tmp/mk-archiver.pid`;
|
||||
diag(`rm -f $pid_file`);
|
||||
|
||||
# #############################################################################
|
||||
# Issue 460: mk-archiver does not inherit DSN as documented
|
||||
# #############################################################################
|
||||
SKIP: {
|
||||
skip 'Cannot connect to sandbox slave1', 1 unless $dbh2;
|
||||
|
||||
# This test will achive rows from dbh:test.table_1 to dbh2:test.table_2.
|
||||
$sb->load_file('master', 't/pt-archiver/samples/tables1-4.sql');
|
||||
# This test will achive rows from dbh:test.table_1 to dbh2:test.table_2.
|
||||
$sb->load_file('master', 't/pt-archiver/samples/tables1-4.sql');
|
||||
|
||||
# Change passwords so defaults files won't work.
|
||||
$dbh->do("SET PASSWORD FOR msandbox = PASSWORD('foo')");
|
||||
$dbh2->do("SET PASSWORD FOR msandbox = PASSWORD('foo')");
|
||||
# Change passwords so defaults files won't work.
|
||||
$sb->do_as_root(
|
||||
'master',
|
||||
q/CREATE USER 'bob'@'%' IDENTIFIED BY 'foo'/,
|
||||
q/GRANT ALL ON *.* TO 'bob'@'%'/,
|
||||
);
|
||||
$dbh2->do('TRUNCATE TABLE test.table_2');
|
||||
$sb->wait_for_slaves;
|
||||
|
||||
$dbh2->do('TRUNCATE TABLE test.table_2');
|
||||
$output = output(
|
||||
sub { pt_archiver::main(
|
||||
'--source', 'h=127.1,P=12345,D=test,t=table_1,u=bob,p=foo',
|
||||
'--dest', 'P=12346,t=table_2',
|
||||
qw(--where 1=1))
|
||||
},
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
$output = `$trunk/bin/pt-archiver --where 1=1 --source h=127.1,P=12345,D=test,t=table_1,u=msandbox,p=foo --dest P=12346,t=table_2 2>&1`;
|
||||
my $r = $dbh2->selectall_arrayref('SELECT * FROM test.table_2');
|
||||
is(
|
||||
my $r = $dbh2->selectall_arrayref('SELECT * FROM test.table_2');
|
||||
is(
|
||||
scalar @$r,
|
||||
4,
|
||||
'--dest inherited from --source'
|
||||
);
|
||||
);
|
||||
|
||||
# Set the passwords back. If this fails we should bail out because
|
||||
# nothing else is going to work.
|
||||
eval {
|
||||
$dbh->do("SET PASSWORD FOR msandbox = PASSWORD('msandbox')");
|
||||
$dbh2->do("SET PASSWORD FOR msandbox = PASSWORD('msandbox')");
|
||||
};
|
||||
if ( $EVAL_ERROR ) {
|
||||
BAIL_OUT('Failed to reset the msandbox password on the master or slave '
|
||||
. 'sandbox. Check the Maatkit test environment with "test-env '
|
||||
. 'status" and restart with "test-env restart". The error was: '
|
||||
. $EVAL_ERROR);
|
||||
}
|
||||
};
|
||||
$sb->do_as_root('master', q/DROP USER 'bob'@'%'/);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($dbh);
|
||||
$sb->wipe_clean($dbh2) if $dbh2;
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
exit;
|
||||
done_testing;
|
||||
|
@@ -22,9 +22,8 @@ my $dbh = $sb->get_dbh_for('master');
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
else {
|
||||
plan tests => 23;
|
||||
}
|
||||
|
||||
$sb->load_file('master', 't/lib/samples/stored-objs.sql');
|
||||
|
||||
my $output;
|
||||
my $cnf = '/tmp/12345/my.sandbox.cnf';
|
||||
@@ -111,6 +110,80 @@ SKIP: {
|
||||
"--view that doesn't match"
|
||||
);
|
||||
|
||||
# Test --procedure.
|
||||
$output = `$cmd pt_find --procedure param1 --print`;
|
||||
is(
|
||||
$output,
|
||||
"`pt_find`.`PROCEDURE simpleproc`\n",
|
||||
'--procedure that matches'
|
||||
);
|
||||
|
||||
$output = `$cmd pt_find --procedure blah --print`;
|
||||
is(
|
||||
$output,
|
||||
'',
|
||||
"--procedure that doesn't match"
|
||||
);
|
||||
|
||||
# Test --function.
|
||||
$output = `$cmd pt_find --function Hello --print`;
|
||||
is(
|
||||
$output,
|
||||
"`pt_find`.`FUNCTION hello`\n",
|
||||
'--function that matches'
|
||||
);
|
||||
|
||||
$output = `$cmd pt_find --function blah --print`;
|
||||
is(
|
||||
$output,
|
||||
'',
|
||||
"--function that doesn't match"
|
||||
);
|
||||
|
||||
# Test --trigger without --trigger-table.
|
||||
$output = `$cmd pt_find --trigger 'INSERT INTO t2' --print`;
|
||||
is(
|
||||
$output,
|
||||
"`pt_find`.`INSERT TRIGGER ins_trg on t1`\n",
|
||||
'--trigger that matches without --trigger-table'
|
||||
);
|
||||
|
||||
$output = `$cmd pt_find --trigger blah --print`;
|
||||
is(
|
||||
$output,
|
||||
'',
|
||||
"--trigger that doesn't match without --trigger-table"
|
||||
);
|
||||
|
||||
# Test --trigger with --trigger-table.
|
||||
$output = `$cmd pt_find --trigger 'INSERT INTO t2' --trigger-table t1 --print`;
|
||||
is(
|
||||
$output,
|
||||
"`pt_find`.`INSERT TRIGGER ins_trg on t1`\n",
|
||||
'--trigger that matches with matching --trigger-table'
|
||||
);
|
||||
|
||||
$output = `$cmd pt_find --trigger blah --trigger-table t1 --print`;
|
||||
is(
|
||||
$output,
|
||||
'',
|
||||
"--trigger that doesn't match with matching --trigger-table"
|
||||
);
|
||||
|
||||
$output = `$cmd pt_find --trigger 'INSERT INTO t2' --trigger-table foo --print`;
|
||||
is(
|
||||
$output,
|
||||
'',
|
||||
'--trigger that matches with non-matching --trigger-table'
|
||||
);
|
||||
|
||||
$output = `$cmd pt_find --trigger blah --trigger-table foo --print`;
|
||||
is(
|
||||
$output,
|
||||
'',
|
||||
"--trigger that doesn't match with non-matching --trigger-table"
|
||||
);
|
||||
|
||||
# Test NULL sizes.
|
||||
$output = `$cmd sakila --datasize NULL`,
|
||||
is(
|
||||
@@ -223,4 +296,5 @@ like(
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
done_testing;
|
||||
exit;
|
||||
|
@@ -84,6 +84,8 @@ sub stop_all_instances {
|
||||
|
||||
start_update_instance( $master_port );
|
||||
|
||||
PerconaTest::wait_for_table($slave1_dbh, 'test.heartbeat', 'server_id=12345');
|
||||
|
||||
my $slave1_dsn = $sb->dsn_for('slave1');
|
||||
# Using full_output here to work around a Perl bug: Only the first explicit
|
||||
# tzset works.
|
||||
|
@@ -35,7 +35,7 @@ my $cmd = "$trunk/bin/pt-kill -F $cnf -h 127.1";
|
||||
|
||||
# Shell out to a sleep(10) query and try to capture the query.
|
||||
# Backticks don't work here.
|
||||
system("/tmp/12345/use -h127.1 -P12345 -umsandbox -pmsandbox -e 'select sleep(5)' >/dev/null &");
|
||||
system("/tmp/12345/use -e 'select sleep(5)' >/dev/null &");
|
||||
|
||||
$output = `$cmd --busy-time 1s --print --run-time 10`;
|
||||
|
||||
@@ -59,7 +59,7 @@ ok(
|
||||
# --iterations was 0, and another bug when --run-time was not respected.
|
||||
# Do it all over again, this time with --iterations 0.
|
||||
# Re issue 1181, --iterations no longer exists, but we'll still keep this test.
|
||||
system("/tmp/12345/use -h127.1 -P12345 -umsandbox -pmsandbox -e 'select sleep(10)' >/dev/null&");
|
||||
system("/tmp/12345/use -e 'select sleep(10)' >/dev/null&");
|
||||
$output = `$cmd --busy-time 1s --print --run-time 11s`;
|
||||
@times = $output =~ m/\(Query (\d+) sec\)/g;
|
||||
ok(
|
||||
|
@@ -35,7 +35,7 @@ my $cnf='/tmp/12345/my.sandbox.cnf';
|
||||
# TODO: These tests need something to match, so we background
|
||||
# a SLEEP(4) query and match that, but this isn't ideal because
|
||||
# it's time-based. Better is to use a specific db and --match-db.
|
||||
my $sys_cmd = "/tmp/12345/use -h127.1 -P12345 -umsandbox -pmsandbox -e 'select sleep(4)' >/dev/null 2>&1 &";
|
||||
my $sys_cmd = "/tmp/12345/use -e 'select sleep(4)' >/dev/null 2>&1 &";
|
||||
|
||||
# #############################################################################
|
||||
# Test that --kill kills the connection.
|
||||
@@ -83,7 +83,7 @@ ok(
|
||||
# Here's how this works. This cmd is going to try 2 queries on the same
|
||||
# connection: sleep5 and sleep3. --kill-query will kill sleep5 causing
|
||||
# sleep3 to start using the same connection id (pid).
|
||||
system("/tmp/12345/use -h127.1 -P12345 -umsandbox -pmsandbox -e 'select sleep(5); select sleep(3)' >/dev/null&");
|
||||
system("/tmp/12345/use -e 'select sleep(5); select sleep(3)' >/dev/null&");
|
||||
sleep 0.5;
|
||||
$rows = $dbh->selectall_hashref('show processlist', 'id');
|
||||
$pid = 0; # reuse, reset
|
||||
|
@@ -19,13 +19,18 @@ use File::Temp qw( tempdir );
|
||||
|
||||
local $ENV{PTDEBUG} = "";
|
||||
|
||||
# mysqldump from earlier versions doesn't seem to work with 5.6,
|
||||
# so use the actual mysqldump from each MySQL bin which should
|
||||
# always be compatible with itself.
|
||||
my $env = qq\CMD_MYSQLDUMP="$ENV{PERCONA_TOOLKIT_SANDBOX}/bin/mysqldump"\;
|
||||
|
||||
#
|
||||
# --save-samples
|
||||
#
|
||||
|
||||
my $dir = tempdir( "percona-testXXXXXXXX", CLEANUP => 1 );
|
||||
|
||||
`$trunk/bin/$tool --sleep 1 --save-samples $dir -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
|
||||
`$env $trunk/bin/$tool --sleep 1 --save-samples $dir -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
|
||||
|
||||
ok(
|
||||
-e $dir,
|
||||
@@ -41,13 +46,13 @@ ok(
|
||||
"And leaves all files in there"
|
||||
) or diag($n_files, `ls -l $dir`);
|
||||
|
||||
undef($dir);
|
||||
undef($dir); # rm the dir because CLEANUP => 1
|
||||
|
||||
#
|
||||
# --databases
|
||||
#
|
||||
|
||||
my $out = `$trunk/bin/$tool --sleep 1 --databases mysql 2>/dev/null -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
|
||||
my $out = `$env $trunk/bin/$tool --sleep 1 --databases mysql 2>/dev/null -- --defaults-file=/tmp/12345/my.sandbox.cnf`;
|
||||
|
||||
like(
|
||||
$out,
|
||||
@@ -61,8 +66,7 @@ for my $i (2..7) {
|
||||
no_diff(
|
||||
sub {
|
||||
local $ENV{_NO_FALSE_NEGATIVES} = 1;
|
||||
my $out = `$trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i -- --defaults-file=/tmp/12345/my.sandbox.cnf | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Skipping schema analysis/'`;
|
||||
print $out;
|
||||
print `$env $trunk/bin/$tool --read-samples $trunk/t/pt-mysql-summary/samples/temp00$i -- --defaults-file=/tmp/12345/my.sandbox.cnf | tail -n+3 | perl -wlnpe 's/Skipping schema analysis.*/Skipping schema analysis/'`
|
||||
},
|
||||
"t/pt-mysql-summary/samples/expected_output_temp00$i.txt",
|
||||
),
|
||||
@@ -82,4 +86,3 @@ is(
|
||||
);
|
||||
|
||||
done_testing;
|
||||
exit;
|
||||
|
@@ -6,5 +6,5 @@ CREATE TABLE `bits` (
|
||||
`val` ENUM('M','E','H') NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
INSERT INTO `bits` VALUES (1, 'M'), (2, 'E'), (3, 'H');
|
||||
ANALYZE TABLE bits;
|
||||
|
@@ -23,9 +23,6 @@ my $dbh = $sb->get_dbh_for('master');
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
else {
|
||||
plan tests => 6;
|
||||
}
|
||||
|
||||
my $sample = "t/pt-query-digest/samples/";
|
||||
|
||||
@@ -90,7 +87,6 @@ ok(
|
||||
'Analysis for slow007 with --explain, failed',
|
||||
);
|
||||
|
||||
|
||||
# #############################################################################
|
||||
# Issue 1196: mk-query-digest --explain is broken
|
||||
# #############################################################################
|
||||
@@ -102,9 +98,9 @@ ok(
|
||||
'--report-format', 'profile,query_report',
|
||||
"$trunk/t/pt-query-digest/samples/issue_1196.log",)
|
||||
},
|
||||
($sandbox_version ge '5.1'
|
||||
? "t/pt-query-digest/samples/issue_1196-output.txt"
|
||||
: "t/pt-query-digest/samples/issue_1196-output-5.0.txt"),
|
||||
( $sandbox_version eq '5.6' ? "$sample/issue_1196-output-5.6.txt"
|
||||
: $sandbox_version ge '5.1' ? "$sample/issue_1196-output.txt"
|
||||
: "$sample/issue_1196-output-5.0.txt"),
|
||||
),
|
||||
"--explain sparkline uses event db and doesn't crash ea (issue 1196"
|
||||
);
|
||||
@@ -114,4 +110,4 @@ ok(
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
exit;
|
||||
done_testing;
|
||||
|
62
t/pt-query-digest/samples/issue_1196-output-5.6.txt
Normal file
62
t/pt-query-digest/samples/issue_1196-output-5.6.txt
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
# Profile
|
||||
# Rank Query ID Response time Calls R/Call Apdx V/M EXPLAIN Item
|
||||
# ==== ================== ============= ===== ====== ==== ===== ======= ========
|
||||
# 1 0xD4B6A5CD2F2F485C 0.2148 100.0% 1 0.2148 1.00 0.00 TF>aa SELECT t
|
||||
|
||||
# Query 1: 0 QPS, 0x concurrency, ID 0xD4B6A5CD2F2F485C at byte 0 ________
|
||||
# This item is included in the report because it matches --limit.
|
||||
# Scores: Apdex = 1.00 [1.0]*, V/M = 0.00
|
||||
# EXPLAIN sparkline: TF>aa
|
||||
# Query_time sparkline: | ^ |
|
||||
# Time range: all events occurred at 2010-12-14 16:12:28
|
||||
# Attribute pct total min max avg 95% stddev median
|
||||
# ============ === ======= ======= ======= ======= ======= ======= =======
|
||||
# Count 100 1
|
||||
# Exec time 100 215ms 215ms 215ms 215ms 215ms 0 215ms
|
||||
# Lock time 99 162us 162us 162us 162us 162us 0 162us
|
||||
# Rows sent 100 10 10 10 10 10 0 10
|
||||
# Rows examine 100 1.96k 1.96k 1.96k 1.96k 1.96k 0 1.96k
|
||||
# Query size 100 82 82 82 82 82 0 82
|
||||
# String:
|
||||
# Databases issue_1196
|
||||
# Hosts localhost
|
||||
# Users root
|
||||
# Query_time distribution
|
||||
# 1us
|
||||
# 10us
|
||||
# 100us
|
||||
# 1ms
|
||||
# 10ms
|
||||
# 100ms ################################################################
|
||||
# 1s
|
||||
# 10s+
|
||||
# Tables
|
||||
# SHOW TABLE STATUS FROM `issue_1196` LIKE 't'\G
|
||||
# SHOW CREATE TABLE `issue_1196`.`t`\G
|
||||
# EXPLAIN /*!50100 PARTITIONS*/
|
||||
select t.a, count(*) from t join t t2 using(a) group by 1 order by 2 desc limit 10\G
|
||||
# *************************** 1. row ***************************
|
||||
# id: 1
|
||||
# select_type: SIMPLE
|
||||
# table: t
|
||||
# partitions: NULL
|
||||
# type: ALL
|
||||
# possible_keys: NULL
|
||||
# key: NULL
|
||||
# key_len: NULL
|
||||
# ref: NULL
|
||||
# rows: 14
|
||||
# Extra: Using temporary; Using filesort
|
||||
# *************************** 2. row ***************************
|
||||
# id: 1
|
||||
# select_type: SIMPLE
|
||||
# table: t2
|
||||
# partitions: NULL
|
||||
# type: ALL
|
||||
# possible_keys: NULL
|
||||
# key: NULL
|
||||
# key_len: NULL
|
||||
# ref: NULL
|
||||
# rows: 14
|
||||
# Extra: Using where; Using join buffer (Block Nested Loop)
|
@@ -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" ? 89
|
||||
: $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.
|
||||
|
@@ -44,7 +44,7 @@ $exit_status = pt_table_checksum::main(@args,
|
||||
my $t = time - $t0;
|
||||
|
||||
ok(
|
||||
$t >= 1.5 && $t <= 2.5,
|
||||
$t >= 1.1 && $t <= 2.5,
|
||||
"Ran in roughly --run-time 1 second"
|
||||
) or diag("Actual run time: $t");
|
||||
|
||||
|
41
t/pt-table-checksum/samples/default-results-5.6.txt
Normal file
41
t/pt-table-checksum/samples/default-results-5.6.txt
Normal file
@@ -0,0 +1,41 @@
|
||||
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.ndb_binlog_index
|
||||
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,41 @@
|
||||
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.ndb_binlog_index
|
||||
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;
|
||||
|
@@ -188,7 +188,7 @@ $output = output(
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/^REPLACE INTO `sakila`.`actor`\(`actor_id`, `first_name`, `last_name`, `last_update`\) VALUES \('30', 'SANDRA', 'PECK', '2006-02-15 04:34:33'\)/,
|
||||
qr/^REPLACE INTO `sakila`.`actor`\(`actor_id`, `first_name`, `last_name`, `last_update`\) VALUES \('30', 'SANDRA', 'PECK', '2006-02-15 11:34:33'\)/,
|
||||
"--replicate with char index col (bug 911996)"
|
||||
);
|
||||
|
||||
|
@@ -15,38 +15,36 @@ use PerconaTest;
|
||||
use Sandbox;
|
||||
require "$trunk/bin/pt-upgrade";
|
||||
|
||||
# This runs immediately if the server is already running, else it starts it.
|
||||
diag(`$trunk/sandbox/start-sandbox master 12348 >/dev/null`);
|
||||
diag(`$trunk/sandbox/stop-sandbox master 12349 >/dev/null`);
|
||||
diag(`QUERY_CACHE_SIZE=1048576 $trunk/sandbox/start-sandbox master 12349 >/dev/null`);
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||
my $dbh1 = $sb->get_dbh_for('master');
|
||||
my $dbh2 = $sb->get_dbh_for('master1');
|
||||
my $dbh2 = $sb->get_dbh_for('master2');
|
||||
|
||||
if ( !$dbh1 ) {
|
||||
diag(`$trunk/sandbox/stop-sandbox master 12348 >/dev/null`);
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
elsif ( !$dbh2 ) {
|
||||
diag(`$trunk/sandbox/stop-sandbox master 12348 >/dev/null`);
|
||||
diag(`$trunk/sandbox/stop-sandbox master 12349 >/dev/null`);
|
||||
plan skip_all => 'Cannot connect to second sandbox master';
|
||||
}
|
||||
|
||||
$sb->load_file('master', 't/pt-upgrade/samples/001/tables.sql');
|
||||
$sb->load_file('master1', 't/pt-upgrade/samples/001/tables.sql');
|
||||
$sb->load_file('master2', 't/pt-upgrade/samples/001/tables.sql');
|
||||
|
||||
my $output;
|
||||
my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox,L=1 P=12348 --compare results,warnings --zero-query-times --compare-results-method rows --limit 10";
|
||||
my $cmd = "$trunk/bin/pt-upgrade h=127.1,P=12345,u=msandbox,p=msandbox,L=1 P=12349 --compare results,warnings --zero-query-times --compare-results-method rows --limit 10";
|
||||
|
||||
# This test really deals with,
|
||||
# http://code.google.com/p/maatkit/issues/detail?id=754
|
||||
# http://bugs.mysql.com/bug.php?id=49634
|
||||
|
||||
$dbh2->do('set global query_cache_size=1000000');
|
||||
|
||||
my $qc = $dbh2->selectrow_arrayref("show variables like 'query_cache_size'")->[1];
|
||||
ok(
|
||||
$qc > 999000,
|
||||
is(
|
||||
$qc,
|
||||
1048576,
|
||||
'Query size'
|
||||
);
|
||||
|
||||
@@ -62,7 +60,7 @@ diag(`$cmd $trunk/t/pt-upgrade/samples/001/one-error.log >/dev/null 2>&1`);
|
||||
$output = `$cmd $trunk/t/pt-upgrade/samples/001/one-error.log`;
|
||||
like(
|
||||
$output,
|
||||
qr/# 3B323396273BC4C7-1 127.1:12348 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
|
||||
qr/# 3B323396273BC4C7-1 127.1:12349 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
|
||||
'--clear-warnings',
|
||||
);
|
||||
|
||||
@@ -78,22 +76,15 @@ like(
|
||||
$output = `$cmd --no-clear-warnings $trunk/t/pt-upgrade/samples/001/one-error.log`;
|
||||
like(
|
||||
$output,
|
||||
qr/# 3B323396273BC4C7-1 127.1:12348 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
|
||||
qr/# 3B323396273BC4C7-1 127.1:12349 Failed to execute query.+Unknown column 'borked' in 'field list' \[for Statement "select borked"\] at .+?\n\n/,
|
||||
'--no-clear-warnings'
|
||||
);
|
||||
|
||||
$dbh2->do('set global query_cache_size=0');
|
||||
$qc = $dbh2->selectrow_arrayref("show variables like 'query_cache_size'")->[1];
|
||||
ok(
|
||||
$qc == 0,
|
||||
'Query size'
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
diag(`$trunk/sandbox/stop-sandbox 12349 >/dev/null`);
|
||||
$sb->wipe_clean($dbh1);
|
||||
diag(`$trunk/sandbox/stop-sandbox master 12348 >/dev/null`);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
done_testing;
|
||||
exit;
|
||||
|
Reference in New Issue
Block a user