mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-20 09:40:38 +00:00
Updated the 'table has problems in replica' error and other tidbits, per Daniel's review
This commit is contained in:
@@ -3627,6 +3627,7 @@ sub check_table_against_slaves {
|
|||||||
|
|
||||||
my ($tbl_struct, $db, $tbl, $slaves) = @args{@required_args};
|
my ($tbl_struct, $db, $tbl, $slaves) = @args{@required_args};
|
||||||
|
|
||||||
|
my $errors;
|
||||||
for my $slave_cxn (@$slaves) {
|
for my $slave_cxn (@$slaves) {
|
||||||
my $slave_has_table = $self->check_table(
|
my $slave_has_table = $self->check_table(
|
||||||
dbh => $slave_cxn->dbh(),
|
dbh => $slave_cxn->dbh(),
|
||||||
@@ -3638,13 +3639,20 @@ sub check_table_against_slaves {
|
|||||||
|
|
||||||
my $ddl = $self->get_create_table( $slave_cxn->dbh, $db, $tbl );
|
my $ddl = $self->get_create_table( $slave_cxn->dbh, $db, $tbl );
|
||||||
my $slave_tbl = $self->parse( $ddl );
|
my $slave_tbl = $self->parse( $ddl );
|
||||||
|
local $EVAL_ERROR;
|
||||||
|
eval {
|
||||||
$self->check_table_against_slave(
|
$self->check_table_against_slave(
|
||||||
tbl_name => "$db.$tbl",
|
tbl_name => "$db.$tbl",
|
||||||
master_tbl => $tbl_struct,
|
master_tbl => $tbl_struct,
|
||||||
slave_tbl => $slave_tbl,
|
slave_tbl => $slave_tbl,
|
||||||
slave_name => $slave_cxn->name(),
|
slave_name => $slave_cxn->name(),
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
if ( $EVAL_ERROR ) {
|
||||||
|
$errors .= $EVAL_ERROR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
die $errors if $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_engine {
|
sub get_engine {
|
||||||
@@ -8872,13 +8880,13 @@ sub main {
|
|||||||
: $o->get('chunk-size');
|
: $o->get('chunk-size');
|
||||||
$tbl->{chunk_size} = $chunk_size;
|
$tbl->{chunk_size} = $chunk_size;
|
||||||
|
|
||||||
if ( $o->get('check-replicate-table-columns') ) {
|
if ( $o->get('check-replicate-table-columns') && $slaves && @$slaves ) {
|
||||||
$tp->check_table_against_slaves(
|
$tp->check_table_against_slaves(
|
||||||
tbl_struct => $tbl->{tbl_struct},
|
tbl_struct => $tbl->{tbl_struct},
|
||||||
db => $tbl->{db},
|
db => $tbl->{db},
|
||||||
table => $tbl->{tbl},
|
table => $tbl->{tbl},
|
||||||
slaves => $slaves,
|
slaves => $slaves,
|
||||||
) if $slaves;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make a nibble iterator for this table. This should only fail
|
# Make a nibble iterator for this table. This should only fail
|
||||||
@@ -9352,12 +9360,15 @@ sub check_repl_table {
|
|||||||
slaves => $slaves,
|
slaves => $slaves,
|
||||||
) if $slaves;
|
) if $slaves;
|
||||||
};
|
};
|
||||||
die "Error executing $sql: $e\n"
|
if ( $EVAL_ERROR ) {
|
||||||
|
die "--create-replicate-table $tbl failed: $e\nThe table "
|
||||||
|
. "already exists on the master, but has problems "
|
||||||
|
. "on these replicas:\n"
|
||||||
. $EVAL_ERROR
|
. $EVAL_ERROR
|
||||||
. "\nThis can cause replication to fail. "
|
. "\nSpecifying --no-create-replicate table disables this "
|
||||||
. "If you understand the risks, you can specify "
|
. "check, but it could also break replication. See "
|
||||||
. "--no-create-replicate-table to avoid this error."
|
. "<http://kb link> for more information.";
|
||||||
if $EVAL_ERROR;
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
die "--replicate table $tbl does not exist and it cannot be "
|
die "--replicate table $tbl does not exist and it cannot be "
|
||||||
|
@@ -765,8 +765,8 @@ sub full_output {
|
|||||||
close $_ or die "Cannot close $_: $OS_ERROR" for qw(STDOUT STDERR);
|
close $_ or die "Cannot close $_: $OS_ERROR" for qw(STDOUT STDERR);
|
||||||
my $output = slurp_file($file) . slurp_file($file2);
|
my $output = slurp_file($file) . slurp_file($file2);
|
||||||
|
|
||||||
1 while unlink $file;
|
unlink $file;
|
||||||
1 while unlink $file2;
|
unlink $file2;
|
||||||
|
|
||||||
return ($output, $status);
|
return ($output, $status);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user