mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
PT-153 Fixed regex, updated tests, merged Kenny's fixes
This commit is contained in:
@@ -10053,7 +10053,7 @@ sub get_unique_index_fields {
|
|||||||
$clean .= $suffix;
|
$clean .= $suffix;
|
||||||
|
|
||||||
my $fields = [];
|
my $fields = [];
|
||||||
my $fields_re = qr/UNIQUE\s*(INDEX|KEY|)\s*(?:.*?)* \((.*?)\)/i;
|
my $fields_re = qr/(?:PRIMARY|UNIQUE)\s*(?:INDEX|KEY)\s*(?:.*?)\s*\((.*?)\)/i;
|
||||||
|
|
||||||
while($clean =~ /$fields_re/g) {
|
while($clean =~ /$fields_re/g) {
|
||||||
push @$fields, [ split /\s*,\s*/, $1 ];
|
push @$fields, [ split /\s*,\s*/, $1 ];
|
||||||
|
@@ -58,14 +58,14 @@ isnt(
|
|||||||
|
|
||||||
like(
|
like(
|
||||||
$output,
|
$output,
|
||||||
qr/You are trying to add an unique key. This is highly discouraged./s,
|
qr/You are trying to add an unique key. This can result in data loss if the data is not unique/s,
|
||||||
"PT-153 Adding unique index warning message.",
|
"PT-153 Adding unique index warning message.",
|
||||||
);
|
);
|
||||||
|
|
||||||
($output, $exit_status) = full_output(
|
($output, $exit_status) = full_output(
|
||||||
sub { pt_online_schema_change::main(@args, "$master_dsn,D=test,t=t1",
|
sub { pt_online_schema_change::main(@args, "$master_dsn,D=test,t=t1",
|
||||||
'--execute',
|
'--execute',
|
||||||
'--alter', "ADD UNIQUE INDEX c1 (f2, f3), CREATE UNIQUE INDEX idx2 ON test.t1 (f3)",
|
'--alter', "ADD UNIQUE INDEX c1 (f2, f3), PRIMARY KEY (f3), UNIQUE KEY k2 (f3)",
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -78,7 +78,7 @@ isnt(
|
|||||||
|
|
||||||
like(
|
like(
|
||||||
$output,
|
$output,
|
||||||
qr/You are trying to add an unique key. This is highly discouraged./s,
|
qr/You are trying to add an unique key. This can result in data loss if the data is not unique/s,
|
||||||
"PT-153 Adding multiple unique indexes warning message.",
|
"PT-153 Adding multiple unique indexes warning message.",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user