mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 05:29:30 +00:00
Changes from Daniel's review.
Some wording changes, also fatalized two warnings, and some test changes.
This commit is contained in:
@@ -8147,7 +8147,7 @@ sub check_repl_table {
|
|||||||
my @db_exists = $dbh->selectrow_array($sql);
|
my @db_exists = $dbh->selectrow_array($sql);
|
||||||
if ( !@db_exists && !$o->get('create-replicate-table') ) {
|
if ( !@db_exists && !$o->get('create-replicate-table') ) {
|
||||||
die "--replicate database $db does not exist and "
|
die "--replicate database $db does not exist and "
|
||||||
. "--no-create-replicate-table was passed in. You need "
|
. "--no-create-replicate-table was specified. You need "
|
||||||
. "to create the database.\n";
|
. "to create the database.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8162,9 +8162,12 @@ sub check_repl_table {
|
|||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( $EVAL_ERROR ) {
|
||||||
if ( @db_exists ) {
|
if ( @db_exists ) {
|
||||||
print STDERR "CREATE DATABASE IF NOT EXISTS $db failed, but the "
|
die "Error executing $sql: $EVAL_ERROR\n"
|
||||||
. "db already exists. This is harmless unless the "
|
. "The database exists on the master, but replication will "
|
||||||
. "slaves don't have the database. $EVAL_ERROR"; # kb link?
|
. "break if it does not also exist on all replicas. If the "
|
||||||
|
. "--replicate database and table already exist on the master "
|
||||||
|
. "and all replicas, or if you created them manually, then "
|
||||||
|
. "specify --no-create-replicate-table to avoid this error."
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
die "--replicate database $db does not exist and it cannot be "
|
die "--replicate database $db does not exist and it cannot be "
|
||||||
@@ -8188,7 +8191,7 @@ sub check_repl_table {
|
|||||||
# was passed in; see https://bugs.launchpad.net/percona-toolkit/+bug/950294
|
# was passed in; see https://bugs.launchpad.net/percona-toolkit/+bug/950294
|
||||||
if ( !$tbl_exists && !$o->get('create-replicate-table') ) {
|
if ( !$tbl_exists && !$o->get('create-replicate-table') ) {
|
||||||
die "--replicate table $repl_table does not exist and "
|
die "--replicate table $repl_table does not exist and "
|
||||||
. "--no-create-replicate-table was passed in. "
|
. "--no-create-replicate-table was specified. "
|
||||||
. "You need to create the table.\n";
|
. "You need to create the table.\n";
|
||||||
}
|
}
|
||||||
if ( $o->get('create-replicate-table') ) {
|
if ( $o->get('create-replicate-table') ) {
|
||||||
@@ -8198,13 +8201,17 @@ sub check_repl_table {
|
|||||||
};
|
};
|
||||||
if ( $EVAL_ERROR ) {
|
if ( $EVAL_ERROR ) {
|
||||||
if ( $tbl_exists ) {
|
if ( $tbl_exists ) {
|
||||||
print STDERR "CREATE TABLE IF NOT EXISTS $args{repl_table} "
|
die "Error executing $sql: $EVAL_ERROR\n"
|
||||||
. "failed, but the table already exists. This "
|
. "The table exists on the master, but replication will "
|
||||||
. "is harmless unless the slaves don't have the "
|
. "break if it does not also exist on all replicas. If the "
|
||||||
. "table. $EVAL_ERROR";
|
. "--replicate database and table already exist on the master "
|
||||||
|
. "and all replicas, or if you created them manually, then "
|
||||||
|
. "specify --no-create-replicate-table to avoid this error."
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
die $EVAL_ERROR;
|
die "--replicate table $tbl does not exist and it cannot be "
|
||||||
|
. "created automatically. You need to create the table. "
|
||||||
|
. $EVAL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,11 @@ PerconaTest::wait_for_table($slave1_dbh, "mysql.tables_priv", "user='ro_checksum
|
|||||||
) },
|
) },
|
||||||
);
|
);
|
||||||
|
|
||||||
isnt($exit_status, 0, "");
|
ok(
|
||||||
|
$exit_status,
|
||||||
|
"Dies with an error status if it can't create the db/table"
|
||||||
|
);
|
||||||
|
|
||||||
like($output,
|
like($output,
|
||||||
qr/\Q--replicate database percona does not exist and it cannot be created automatically/,
|
qr/\Q--replicate database percona does not exist and it cannot be created automatically/,
|
||||||
"fails if the percona db doesn't exist and the user can't create it",
|
"fails if the percona db doesn't exist and the user can't create it",
|
||||||
@@ -113,7 +117,7 @@ $output = output(
|
|||||||
# Comment out this line and the tests fail because ro_checksum_user
|
# Comment out this line and the tests fail because ro_checksum_user
|
||||||
# doesn't have privs to SHOW SLAVE HOSTS. This proves that
|
# doesn't have privs to SHOW SLAVE HOSTS. This proves that
|
||||||
# --recursion-method none is working.
|
# --recursion-method none is working.
|
||||||
qw(--recursion-method none)
|
qw(--recursion-method none --no-create-replicate-table)
|
||||||
) },
|
) },
|
||||||
stderr => 1,
|
stderr => 1,
|
||||||
);
|
);
|
||||||
@@ -130,6 +134,18 @@ like(
|
|||||||
"Read-only user (bug 987694): checksummed rows"
|
"Read-only user (bug 987694): checksummed rows"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
($output) = full_output(
|
||||||
|
sub { $exit_status = pt_table_checksum::main(@args,
|
||||||
|
"$master_dsn,u=ro_checksum_user,p=msandbox",
|
||||||
|
qw(--recursion-method none)
|
||||||
|
) }
|
||||||
|
);
|
||||||
|
|
||||||
|
like($output,
|
||||||
|
qr/\QThe database exists on the master, but replication will break/,
|
||||||
|
"dies if the db exists on the master but it can't CREATE DATABASE and --no-create-replicate-table was not specified",
|
||||||
|
);
|
||||||
|
|
||||||
diag(qx{/tmp/12345/use -u root -e 'DROP TABLE `percona`.`checksums`'});
|
diag(qx{/tmp/12345/use -u root -e 'DROP TABLE `percona`.`checksums`'});
|
||||||
|
|
||||||
($output, $exit_status) = full_output(
|
($output, $exit_status) = full_output(
|
||||||
|
|||||||
Reference in New Issue
Block a user