mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-19 18:34:59 +00:00
PT-193 New test and updated libraries
Added a specific test for this issue and updated all binaries to the latest TableParser version
This commit is contained in:
@@ -1954,7 +1954,7 @@ sub parse {
|
|||||||
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
||||||
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
||||||
|
|
||||||
$ddl =~ s/(`[^`]+`)/\L$1/g;
|
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
|
||||||
|
|
||||||
my $engine = $self->get_engine($ddl);
|
my $engine = $self->get_engine($ddl);
|
||||||
|
|
||||||
@@ -2085,6 +2085,8 @@ sub check_table {
|
|||||||
my $db_tbl = $q->quote($db, $tbl);
|
my $db_tbl = $q->quote($db, $tbl);
|
||||||
PTDEBUG && _d('Checking', $db_tbl);
|
PTDEBUG && _d('Checking', $db_tbl);
|
||||||
|
|
||||||
|
$self->{check_table_error} = undef;
|
||||||
|
|
||||||
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
||||||
. ' LIKE ' . $q->literal_like($tbl);
|
. ' LIKE ' . $q->literal_like($tbl);
|
||||||
PTDEBUG && _d($sql);
|
PTDEBUG && _d($sql);
|
||||||
@@ -2092,8 +2094,9 @@ sub check_table {
|
|||||||
eval {
|
eval {
|
||||||
$row = $dbh->selectrow_arrayref($sql);
|
$row = $dbh->selectrow_arrayref($sql);
|
||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( my $e = $EVAL_ERROR ) {
|
||||||
PTDEBUG && _d($EVAL_ERROR);
|
PTDEBUG && _d($e);
|
||||||
|
$self->{check_table_error} = $e;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
||||||
|
@@ -341,7 +341,7 @@ sub parse {
|
|||||||
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
||||||
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
||||||
|
|
||||||
$ddl =~ s/(`[^`]+`)/\L$1/g;
|
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
|
||||||
|
|
||||||
my $engine = $self->get_engine($ddl);
|
my $engine = $self->get_engine($ddl);
|
||||||
|
|
||||||
@@ -472,6 +472,8 @@ sub check_table {
|
|||||||
my $db_tbl = $q->quote($db, $tbl);
|
my $db_tbl = $q->quote($db, $tbl);
|
||||||
PTDEBUG && _d('Checking', $db_tbl);
|
PTDEBUG && _d('Checking', $db_tbl);
|
||||||
|
|
||||||
|
$self->{check_table_error} = undef;
|
||||||
|
|
||||||
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
||||||
. ' LIKE ' . $q->literal_like($tbl);
|
. ' LIKE ' . $q->literal_like($tbl);
|
||||||
PTDEBUG && _d($sql);
|
PTDEBUG && _d($sql);
|
||||||
@@ -479,8 +481,9 @@ sub check_table {
|
|||||||
eval {
|
eval {
|
||||||
$row = $dbh->selectrow_arrayref($sql);
|
$row = $dbh->selectrow_arrayref($sql);
|
||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( my $e = $EVAL_ERROR ) {
|
||||||
PTDEBUG && _d($EVAL_ERROR);
|
PTDEBUG && _d($e);
|
||||||
|
$self->{check_table_error} = $e;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
||||||
|
@@ -1869,7 +1869,7 @@ sub parse {
|
|||||||
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
||||||
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
||||||
|
|
||||||
$ddl =~ s/(`[^`]+`)/\L$1/g;
|
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
|
||||||
|
|
||||||
my $engine = $self->get_engine($ddl);
|
my $engine = $self->get_engine($ddl);
|
||||||
|
|
||||||
@@ -2000,6 +2000,8 @@ sub check_table {
|
|||||||
my $db_tbl = $q->quote($db, $tbl);
|
my $db_tbl = $q->quote($db, $tbl);
|
||||||
PTDEBUG && _d('Checking', $db_tbl);
|
PTDEBUG && _d('Checking', $db_tbl);
|
||||||
|
|
||||||
|
$self->{check_table_error} = undef;
|
||||||
|
|
||||||
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
||||||
. ' LIKE ' . $q->literal_like($tbl);
|
. ' LIKE ' . $q->literal_like($tbl);
|
||||||
PTDEBUG && _d($sql);
|
PTDEBUG && _d($sql);
|
||||||
@@ -2007,8 +2009,9 @@ sub check_table {
|
|||||||
eval {
|
eval {
|
||||||
$row = $dbh->selectrow_arrayref($sql);
|
$row = $dbh->selectrow_arrayref($sql);
|
||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( my $e = $EVAL_ERROR ) {
|
||||||
PTDEBUG && _d($EVAL_ERROR);
|
PTDEBUG && _d($e);
|
||||||
|
$self->{check_table_error} = $e;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
||||||
|
@@ -3488,7 +3488,7 @@ sub parse {
|
|||||||
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
||||||
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
||||||
|
|
||||||
$ddl =~ s/(`[^`]+`)/\L$1/g;
|
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
|
||||||
|
|
||||||
my $engine = $self->get_engine($ddl);
|
my $engine = $self->get_engine($ddl);
|
||||||
|
|
||||||
@@ -3619,6 +3619,8 @@ sub check_table {
|
|||||||
my $db_tbl = $q->quote($db, $tbl);
|
my $db_tbl = $q->quote($db, $tbl);
|
||||||
PTDEBUG && _d('Checking', $db_tbl);
|
PTDEBUG && _d('Checking', $db_tbl);
|
||||||
|
|
||||||
|
$self->{check_table_error} = undef;
|
||||||
|
|
||||||
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
||||||
. ' LIKE ' . $q->literal_like($tbl);
|
. ' LIKE ' . $q->literal_like($tbl);
|
||||||
PTDEBUG && _d($sql);
|
PTDEBUG && _d($sql);
|
||||||
@@ -3626,8 +3628,9 @@ sub check_table {
|
|||||||
eval {
|
eval {
|
||||||
$row = $dbh->selectrow_arrayref($sql);
|
$row = $dbh->selectrow_arrayref($sql);
|
||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( my $e = $EVAL_ERROR ) {
|
||||||
PTDEBUG && _d($EVAL_ERROR);
|
PTDEBUG && _d($e);
|
||||||
|
$self->{check_table_error} = $e;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
||||||
|
@@ -3108,7 +3108,7 @@ sub parse {
|
|||||||
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
||||||
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
||||||
|
|
||||||
$ddl =~ s/(`[^`]+`)/\L$1/g;
|
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
|
||||||
|
|
||||||
my $engine = $self->get_engine($ddl);
|
my $engine = $self->get_engine($ddl);
|
||||||
|
|
||||||
@@ -3239,6 +3239,8 @@ sub check_table {
|
|||||||
my $db_tbl = $q->quote($db, $tbl);
|
my $db_tbl = $q->quote($db, $tbl);
|
||||||
PTDEBUG && _d('Checking', $db_tbl);
|
PTDEBUG && _d('Checking', $db_tbl);
|
||||||
|
|
||||||
|
$self->{check_table_error} = undef;
|
||||||
|
|
||||||
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
||||||
. ' LIKE ' . $q->literal_like($tbl);
|
. ' LIKE ' . $q->literal_like($tbl);
|
||||||
PTDEBUG && _d($sql);
|
PTDEBUG && _d($sql);
|
||||||
@@ -3246,8 +3248,9 @@ sub check_table {
|
|||||||
eval {
|
eval {
|
||||||
$row = $dbh->selectrow_arrayref($sql);
|
$row = $dbh->selectrow_arrayref($sql);
|
||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( my $e = $EVAL_ERROR ) {
|
||||||
PTDEBUG && _d($EVAL_ERROR);
|
PTDEBUG && _d($e);
|
||||||
|
$self->{check_table_error} = $e;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
||||||
|
@@ -2934,7 +2934,7 @@ sub parse {
|
|||||||
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
||||||
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
||||||
|
|
||||||
$ddl =~ s/(`[^`]+`)/\L$1/g;
|
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
|
||||||
|
|
||||||
my $engine = $self->get_engine($ddl);
|
my $engine = $self->get_engine($ddl);
|
||||||
|
|
||||||
@@ -3065,6 +3065,8 @@ sub check_table {
|
|||||||
my $db_tbl = $q->quote($db, $tbl);
|
my $db_tbl = $q->quote($db, $tbl);
|
||||||
PTDEBUG && _d('Checking', $db_tbl);
|
PTDEBUG && _d('Checking', $db_tbl);
|
||||||
|
|
||||||
|
$self->{check_table_error} = undef;
|
||||||
|
|
||||||
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
||||||
. ' LIKE ' . $q->literal_like($tbl);
|
. ' LIKE ' . $q->literal_like($tbl);
|
||||||
PTDEBUG && _d($sql);
|
PTDEBUG && _d($sql);
|
||||||
@@ -3072,8 +3074,9 @@ sub check_table {
|
|||||||
eval {
|
eval {
|
||||||
$row = $dbh->selectrow_arrayref($sql);
|
$row = $dbh->selectrow_arrayref($sql);
|
||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( my $e = $EVAL_ERROR ) {
|
||||||
PTDEBUG && _d($EVAL_ERROR);
|
PTDEBUG && _d($e);
|
||||||
|
$self->{check_table_error} = $e;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
||||||
|
@@ -3298,7 +3298,7 @@ sub parse {
|
|||||||
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
||||||
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
||||||
|
|
||||||
$ddl =~ s/(`[^`]+`)/\L$1/g;
|
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
|
||||||
|
|
||||||
my $engine = $self->get_engine($ddl);
|
my $engine = $self->get_engine($ddl);
|
||||||
|
|
||||||
|
@@ -8834,7 +8834,7 @@ sub parse {
|
|||||||
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
||||||
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
||||||
|
|
||||||
$ddl =~ s/(`[^`]+`)/\L$1/g;
|
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
|
||||||
|
|
||||||
my $engine = $self->get_engine($ddl);
|
my $engine = $self->get_engine($ddl);
|
||||||
|
|
||||||
@@ -8965,6 +8965,8 @@ sub check_table {
|
|||||||
my $db_tbl = $q->quote($db, $tbl);
|
my $db_tbl = $q->quote($db, $tbl);
|
||||||
PTDEBUG && _d('Checking', $db_tbl);
|
PTDEBUG && _d('Checking', $db_tbl);
|
||||||
|
|
||||||
|
$self->{check_table_error} = undef;
|
||||||
|
|
||||||
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
||||||
. ' LIKE ' . $q->literal_like($tbl);
|
. ' LIKE ' . $q->literal_like($tbl);
|
||||||
PTDEBUG && _d($sql);
|
PTDEBUG && _d($sql);
|
||||||
@@ -8972,8 +8974,9 @@ sub check_table {
|
|||||||
eval {
|
eval {
|
||||||
$row = $dbh->selectrow_arrayref($sql);
|
$row = $dbh->selectrow_arrayref($sql);
|
||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( my $e = $EVAL_ERROR ) {
|
||||||
PTDEBUG && _d($EVAL_ERROR);
|
PTDEBUG && _d($e);
|
||||||
|
$self->{check_table_error} = $e;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
||||||
|
@@ -4435,7 +4435,7 @@ sub parse {
|
|||||||
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
||||||
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
||||||
|
|
||||||
$ddl =~ s/(`[^`]+`)/\L$1/g;
|
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
|
||||||
|
|
||||||
my $engine = $self->get_engine($ddl);
|
my $engine = $self->get_engine($ddl);
|
||||||
|
|
||||||
|
@@ -2853,7 +2853,7 @@ sub parse {
|
|||||||
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
||||||
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
||||||
|
|
||||||
$ddl =~ s/(`[^`]+`)/\L$1/g;
|
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
|
||||||
|
|
||||||
my $engine = $self->get_engine($ddl);
|
my $engine = $self->get_engine($ddl);
|
||||||
|
|
||||||
@@ -2984,6 +2984,8 @@ sub check_table {
|
|||||||
my $db_tbl = $q->quote($db, $tbl);
|
my $db_tbl = $q->quote($db, $tbl);
|
||||||
PTDEBUG && _d('Checking', $db_tbl);
|
PTDEBUG && _d('Checking', $db_tbl);
|
||||||
|
|
||||||
|
$self->{check_table_error} = undef;
|
||||||
|
|
||||||
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
||||||
. ' LIKE ' . $q->literal_like($tbl);
|
. ' LIKE ' . $q->literal_like($tbl);
|
||||||
PTDEBUG && _d($sql);
|
PTDEBUG && _d($sql);
|
||||||
@@ -2991,8 +2993,9 @@ sub check_table {
|
|||||||
eval {
|
eval {
|
||||||
$row = $dbh->selectrow_arrayref($sql);
|
$row = $dbh->selectrow_arrayref($sql);
|
||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( my $e = $EVAL_ERROR ) {
|
||||||
PTDEBUG && _d($EVAL_ERROR);
|
PTDEBUG && _d($e);
|
||||||
|
$self->{check_table_error} = $e;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
||||||
|
@@ -6784,7 +6784,7 @@ sub parse {
|
|||||||
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
my ($name) = $ddl =~ m/CREATE (?:TEMPORARY )?TABLE\s+(`.+?`)/;
|
||||||
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
(undef, $name) = $self->{Quoter}->split_unquote($name) if $name;
|
||||||
|
|
||||||
$ddl =~ s/(`[^`]+`)/\L$1/g;
|
$ddl =~ s/(`[^`\n]+`)/\L$1/gm;
|
||||||
|
|
||||||
my $engine = $self->get_engine($ddl);
|
my $engine = $self->get_engine($ddl);
|
||||||
|
|
||||||
@@ -6915,6 +6915,8 @@ sub check_table {
|
|||||||
my $db_tbl = $q->quote($db, $tbl);
|
my $db_tbl = $q->quote($db, $tbl);
|
||||||
PTDEBUG && _d('Checking', $db_tbl);
|
PTDEBUG && _d('Checking', $db_tbl);
|
||||||
|
|
||||||
|
$self->{check_table_error} = undef;
|
||||||
|
|
||||||
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
my $sql = "SHOW TABLES FROM " . $q->quote($db)
|
||||||
. ' LIKE ' . $q->literal_like($tbl);
|
. ' LIKE ' . $q->literal_like($tbl);
|
||||||
PTDEBUG && _d($sql);
|
PTDEBUG && _d($sql);
|
||||||
@@ -6922,8 +6924,9 @@ sub check_table {
|
|||||||
eval {
|
eval {
|
||||||
$row = $dbh->selectrow_arrayref($sql);
|
$row = $dbh->selectrow_arrayref($sql);
|
||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( my $e = $EVAL_ERROR ) {
|
||||||
PTDEBUG && _d($EVAL_ERROR);
|
PTDEBUG && _d($e);
|
||||||
|
$self->{check_table_error} = $e;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
if ( !$row->[0] || $row->[0] ne $tbl ) {
|
||||||
|
@@ -1,6 +1,11 @@
|
|||||||
Create Table: CREATE TABLE `t3` (
|
DROP DATABASE IF EXISTS test;
|
||||||
|
CREATE DATABASE test;
|
||||||
|
USE test;
|
||||||
|
|
||||||
|
CREATE TABLE `t3` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`f22aBcDe` int(10) unsigned DEFAULT NULL COMMENT 'xxx`XXx',
|
`f22aBcDe` int(10) unsigned DEFAULT NULL COMMENT 'xxx`XXx',
|
||||||
`f23aBc` int(10) unsigned NOT NULL DEFAULT '255' COMMENT "`yyy",
|
`f23aBc` int(10) unsigned NOT NULL DEFAULT '255' COMMENT "`yyy",
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1)
|
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
|
66
t/pt-table-checksum/pt-193.t
Normal file
66
t/pt-table-checksum/pt-193.t
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
|
||||||
|
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
|
||||||
|
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
|
||||||
|
};
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings FATAL => 'all';
|
||||||
|
use English qw(-no_match_vars);
|
||||||
|
use Test::More;
|
||||||
|
|
||||||
|
use PerconaTest;
|
||||||
|
use Sandbox;
|
||||||
|
use SqlModes;
|
||||||
|
require "$trunk/bin/pt-table-checksum";
|
||||||
|
|
||||||
|
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||||
|
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||||
|
my $dbh = $sb->get_dbh_for('master');
|
||||||
|
|
||||||
|
if ( !$dbh ) {
|
||||||
|
plan skip_all => 'Cannot connect to sandbox master';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
plan tests => 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sb->load_file('master', 't/lib/samples/issue_pt-193_backtick_in_col_comments.sql');
|
||||||
|
|
||||||
|
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||||
|
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the tool will die.
|
||||||
|
# And --max-load "" prevents waiting for status variables.
|
||||||
|
my $master_dsn = $sb->dsn_for('master');
|
||||||
|
my @args = ($master_dsn, "--set-vars", "innodb_lock_wait_timeout=50",
|
||||||
|
"--no-check-binlog-format", "--ignore-databases", "mysql",
|
||||||
|
"--nocheck-replication-filters");
|
||||||
|
my $output;
|
||||||
|
my $exit_status;
|
||||||
|
|
||||||
|
# Test #1
|
||||||
|
$output = output(
|
||||||
|
sub { $exit_status = pt_table_checksum::main(@args) },
|
||||||
|
stderr => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
$exit_status,
|
||||||
|
0,
|
||||||
|
"PT-193 use single backtick in comments",
|
||||||
|
);
|
||||||
|
|
||||||
|
like(
|
||||||
|
$output,
|
||||||
|
qr/test\.t3/,
|
||||||
|
"PT-193 table t3 was checksumed",
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
# #############################################################################
|
||||||
|
# Done.
|
||||||
|
# #############################################################################
|
||||||
|
$sb->wipe_clean($dbh);
|
||||||
|
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||||
|
exit;
|
Reference in New Issue
Block a user