mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-12-19 01:09:21 +08:00
PT-1747 Updated MySQL version check
This commit is contained in:
@@ -9053,7 +9053,9 @@ sub main {
|
|||||||
);
|
);
|
||||||
|
|
||||||
my $vp = VersionParser->new($cxn->dbh());
|
my $vp = VersionParser->new($cxn->dbh());
|
||||||
if ($vp->cmp('8.0.14') > -1 && $vp->flavor() !~ m/maria/i) {
|
warn "8.0.14: ".$vp->cmp('8.0.14');
|
||||||
|
warn "8.0.18: ".$vp->cmp('8.0.17');
|
||||||
|
if (($vp->cmp('8.0.14') >= 0 && $vp->cmp('8.0.17') <= 0) && $vp->flavor() !~ m/maria/i) {
|
||||||
my $msg = "There is an error in MySQL that makes the server to die when trying to ".
|
my $msg = "There is an error in MySQL that makes the server to die when trying to ".
|
||||||
"rename a table with FKs. See https://bugs.mysql.com/bug.php?id=96145\n".
|
"rename a table with FKs. See https://bugs.mysql.com/bug.php?id=96145\n".
|
||||||
"Since pt-online-schema change needs to rename the old <-> new tables as the final " .
|
"Since pt-online-schema change needs to rename the old <-> new tables as the final " .
|
||||||
@@ -11303,10 +11305,11 @@ sub create_triggers {
|
|||||||
"$new_tbl->{name}.$new_qcol <=> OLD.$old_qcol"
|
"$new_tbl->{name}.$new_qcol <=> OLD.$old_qcol"
|
||||||
} @{$tbl_struct->{keys}->{$del_index}->{cols}} );
|
} @{$tbl_struct->{keys}->{$del_index}->{cols}} );
|
||||||
|
|
||||||
|
my $ignore_clause = $o->get("delete-ignore") ? "IGNORE" : "";
|
||||||
my $delete_trigger
|
my $delete_trigger
|
||||||
= "CREATE TRIGGER `${prefix}_del` AFTER DELETE ON $orig_tbl->{name} "
|
= "CREATE TRIGGER `${prefix}_del` AFTER DELETE ON $orig_tbl->{name} "
|
||||||
. "FOR EACH ROW "
|
. "FOR EACH ROW "
|
||||||
. "DELETE IGNORE FROM $new_tbl->{name} "
|
. "DELETE $ignore_clause FROM $new_tbl->{name} "
|
||||||
. "WHERE $del_index_cols";
|
. "WHERE $del_index_cols";
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------------
|
||||||
@@ -11332,7 +11335,7 @@ sub create_triggers {
|
|||||||
= "CREATE TRIGGER `${prefix}_upd` AFTER UPDATE ON $orig_tbl->{name} "
|
= "CREATE TRIGGER `${prefix}_upd` AFTER UPDATE ON $orig_tbl->{name} "
|
||||||
. "FOR EACH ROW "
|
. "FOR EACH ROW "
|
||||||
. "BEGIN "
|
. "BEGIN "
|
||||||
. "DELETE IGNORE FROM $new_tbl->{name} WHERE !($upd_index_cols) AND $del_index_cols;"
|
. "DELETE $ignore_clause FROM $new_tbl->{name} WHERE !($upd_index_cols) AND $del_index_cols;"
|
||||||
. "REPLACE INTO $new_tbl->{name} ($qcols) VALUES ($new_vals);"
|
. "REPLACE INTO $new_tbl->{name} ($qcols) VALUES ($new_vals);"
|
||||||
. "END ";
|
. "END ";
|
||||||
|
|
||||||
@@ -12475,6 +12478,15 @@ short form: -F; type: string
|
|||||||
Only read mysql options from the given file. You must give an absolute
|
Only read mysql options from the given file. You must give an absolute
|
||||||
pathname.
|
pathname.
|
||||||
|
|
||||||
|
=item --[no]delete-ignore
|
||||||
|
|
||||||
|
default: yes
|
||||||
|
|
||||||
|
Do not use C<IGNORE> on C<DELETE> triggers.
|
||||||
|
This is an special case that affects forign keys handling. Since C<DELETE> only return errors when
|
||||||
|
there is a problem deleting rows affected by foreign keys, it might be cases when we want to
|
||||||
|
receive such errors during the program execution to ensure FKs handling is correct.
|
||||||
|
|
||||||
=item --disable-fk-checks
|
=item --disable-fk-checks
|
||||||
|
|
||||||
Disable foreign keys check during rebuild constraints. This option improves the process speed
|
Disable foreign keys check during rebuild constraints. This option improves the process speed
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ ok(
|
|||||||
);
|
);
|
||||||
|
|
||||||
SKIP: {
|
SKIP: {
|
||||||
skip "Skipping in MySQL 8.0.4-rc since there is an error in the server itself. See https://bugs.mysql.com/bug.php?id=89441", 9 if ($sandbox_version ge '8.0');
|
|
||||||
($output, $exit_status) = full_output(
|
($output, $exit_status) = full_output(
|
||||||
sub { pt_online_schema_change::main(@args,
|
sub { pt_online_schema_change::main(@args,
|
||||||
"$master_dsn,D=issue26211,t=process_model_inst",
|
"$master_dsn,D=issue26211,t=process_model_inst",
|
||||||
|
|||||||
@@ -23,10 +23,6 @@ my $master_dbh = $sb->get_dbh_for('master');
|
|||||||
|
|
||||||
my $vp = VersionParser->new($master_dbh);
|
my $vp = VersionParser->new($master_dbh);
|
||||||
|
|
||||||
if ($vp->cmp('8.0.14') > -1 && $vp->flavor() !~ m/maria/i) {
|
|
||||||
plan skip_all => 'Cannot run this test under the current MySQL version';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !$master_dbh ) {
|
if ( !$master_dbh ) {
|
||||||
plan skip_all => 'Cannot connect to sandbox master';
|
plan skip_all => 'Cannot connect to sandbox master';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ is_deeply(
|
|||||||
$constraints,
|
$constraints,
|
||||||
[
|
[
|
||||||
['person', '_fk_testId'],
|
['person', '_fk_testId'],
|
||||||
['test_table', '_fk_person'],
|
['test_table', 'fk_person'],
|
||||||
['test_table', '__fk_refId'],
|
['test_table', 'fk_refId'],
|
||||||
],
|
],
|
||||||
"First run adds or removes underscore from constraint names, accordingly"
|
"First run adds or removes underscore from constraint names, accordingly"
|
||||||
);
|
);
|
||||||
@@ -79,9 +79,9 @@ $constraints = $master_dbh->selectall_arrayref("SELECT TABLE_NAME, CONSTRAINT_NA
|
|||||||
is_deeply(
|
is_deeply(
|
||||||
$constraints,
|
$constraints,
|
||||||
[
|
[
|
||||||
['person', '__fk_testId'],
|
['person', '_fk_testId'],
|
||||||
['test_table', '_fk_refId'],
|
['test_table', 'fk_person'],
|
||||||
['test_table', '__fk_person'],
|
['test_table', 'fk_refId'],
|
||||||
],
|
],
|
||||||
"Second run self-referencing will be one due to rebuild_constraints"
|
"Second run self-referencing will be one due to rebuild_constraints"
|
||||||
);
|
);
|
||||||
@@ -100,7 +100,7 @@ $constraints = $master_dbh->selectall_arrayref("SELECT TABLE_NAME, CONSTRAINT_NA
|
|||||||
is_deeply(
|
is_deeply(
|
||||||
$constraints,
|
$constraints,
|
||||||
[
|
[
|
||||||
['person', 'fk_testId'],
|
['person', '_fk_testId'],
|
||||||
['test_table', 'fk_person'],
|
['test_table', 'fk_person'],
|
||||||
['test_table', 'fk_refId'],
|
['test_table', 'fk_refId'],
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user