mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 21:51:21 +00:00
Print/save fk errors only if there is one. Fix example --dest table (bug 1075775).
This commit is contained in:
@@ -3534,20 +3534,23 @@ sub main {
|
|||||||
{
|
{
|
||||||
my $text = $dbh->selectrow_hashref("SHOW /*!40100 ENGINE*/ INNODB STATUS")->{Status};
|
my $text = $dbh->selectrow_hashref("SHOW /*!40100 ENGINE*/ INNODB STATUS")->{Status};
|
||||||
my ($ts, $fk_error) = get_fk_error($text);
|
my ($ts, $fk_error) = get_fk_error($text);
|
||||||
|
PTDEBUG && _d('ts:', $ts, 'fk error:', $fk_error);
|
||||||
|
|
||||||
# Save and/or print the foreign key error.
|
if ( $ts && $fk_error ) {
|
||||||
if ( $ins_sth ) {
|
# Save and/or print the foreign key error.
|
||||||
my $fk_ts = parse_timestamp($ts);
|
if ( $ins_sth ) {
|
||||||
PTDEBUG && _d('Saving fk error', $ts, $fk_error);
|
my $fk_ts = parse_timestamp($ts);
|
||||||
eval {
|
PTDEBUG && _d('Saving fk error', $ts, $fk_error);
|
||||||
$ins_sth->execute($fk_ts, $fk_error);
|
eval {
|
||||||
};
|
$ins_sth->execute($fk_ts, $fk_error);
|
||||||
if ( $EVAL_ERROR ) {
|
};
|
||||||
warn $EVAL_ERROR;
|
if ( $EVAL_ERROR ) {
|
||||||
PTDEBUG && _d($EVAL_ERROR);
|
warn $EVAL_ERROR;
|
||||||
|
PTDEBUG && _d($EVAL_ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
print "$ts $fk_error\n\n" if $o->get('print') || !$o->got('dest');
|
||||||
}
|
}
|
||||||
print "$ts $fk_error\n\n" if $o->get('print') || !$o->got('dest');
|
|
||||||
|
|
||||||
# If there's an --interval argument, run forever or till specified.
|
# If there's an --interval argument, run forever or till specified.
|
||||||
# Otherwise just run once.
|
# Otherwise just run once.
|
||||||
@@ -3727,7 +3730,7 @@ The following table is suggested:
|
|||||||
CREATE TABLE foreign_key_errors (
|
CREATE TABLE foreign_key_errors (
|
||||||
ts datetime NOT NULL,
|
ts datetime NOT NULL,
|
||||||
error text NOT NULL,
|
error text NOT NULL,
|
||||||
PRIMARY KEY (ts),
|
PRIMARY KEY (ts)
|
||||||
)
|
)
|
||||||
|
|
||||||
The only information saved is the timestamp and the foreign key error text.
|
The only information saved is the timestamp and the foreign key error text.
|
||||||
|
@@ -136,7 +136,7 @@ $output = output(
|
|||||||
is(
|
is(
|
||||||
$output,
|
$output,
|
||||||
"",
|
"",
|
||||||
"No foreign key errors, no errors and no output (bug 1075773)"
|
"No foreign key errors, no errors, no output (bug 1075773)"
|
||||||
);
|
);
|
||||||
|
|
||||||
diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
|
diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
|
||||||
|
Reference in New Issue
Block a user