mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-16 16:23:30 +00:00
PT-91 WIP
This commit is contained in:
@@ -8300,27 +8300,10 @@ sub main {
|
|||||||
die $msg;
|
die $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !$o->get('drop-old-table') && $o->get('preserve-triggers') ) {
|
|
||||||
my $msg = "Cannot use --no-drop-old-table and --preserve-triggers together.\n"
|
|
||||||
. "--preserve-triggers implies that the old table and triggers "
|
|
||||||
. " should be deleted and recreated into the new table.\n"
|
|
||||||
. "Please read the documentation for --preserve-triggers";
|
|
||||||
die $msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !$o->get('swap-tables') && $o->get('preserve-triggers') ) {
|
|
||||||
my $msg = "Canot use --no-swap-tables with --preserve-triggers since trigger names "
|
|
||||||
. "cannot be duplicated so, the old table and triggers should be deleted "
|
|
||||||
. "and recreated into the new table.\n"
|
|
||||||
. "Please read the documentation for --preserve-triggers";
|
|
||||||
die $msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $o->get('preserve-triggers') ) {
|
if ( $o->get('preserve-triggers') ) {
|
||||||
$o->set('drop-triggers', 1);
|
$o->set('drop-triggers', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( !$o->get('help') ) {
|
if ( !$o->get('help') ) {
|
||||||
if ( @ARGV ) {
|
if ( @ARGV ) {
|
||||||
$o->save_error('Specify only one DSN on the command line');
|
$o->save_error('Specify only one DSN on the command line');
|
||||||
|
@@ -847,7 +847,7 @@ SKIP: {
|
|||||||
skip 'Sandbox MySQL version should be >= 5.7' unless $sandbox_version ge '5.7';
|
skip 'Sandbox MySQL version should be >= 5.7' unless $sandbox_version ge '5.7';
|
||||||
|
|
||||||
test_alter_table(
|
test_alter_table(
|
||||||
name => "Basic --preserve-triggers #1",
|
name => 'Basic --preserve-triggers #1',
|
||||||
table => "pt_osc.account",
|
table => "pt_osc.account",
|
||||||
pk_col => "id",
|
pk_col => "id",
|
||||||
file => "triggers.sql",
|
file => "triggers.sql",
|
||||||
@@ -896,26 +896,28 @@ SKIP: {
|
|||||||
|
|
||||||
($output, $exit) = full_output(
|
($output, $exit) = full_output(
|
||||||
sub { pt_online_schema_change::main(@args,
|
sub { pt_online_schema_change::main(@args,
|
||||||
"$dsn,D=pt_osc,t=t",
|
"$dsn,D=test,t=t1",
|
||||||
qw(--execute --no-swap-tables --preserve-triggers), '--alter', 'ADD COLUMN foo INT')
|
qw(--execute --no-swap-tables --preserve-triggers), '--alter', 'ADD COLUMN foo INT')
|
||||||
},
|
},
|
||||||
stderr => 1,
|
stderr => 1,
|
||||||
);
|
);
|
||||||
|
diag($output);
|
||||||
|
|
||||||
isnt(
|
is(
|
||||||
$exit,
|
$exit,
|
||||||
0,
|
0,
|
||||||
"--preserve-triggers --no-swap-tables",
|
"--preserve-triggers --no-swap-tables",
|
||||||
);
|
);
|
||||||
|
|
||||||
($output, $exit) = full_output(
|
($output, $exit) = full_output(
|
||||||
sub { pt_online_schema_change::main(@args,
|
sub { pt_online_schema_change::main(@args,
|
||||||
"$dsn,D=pt_osc,t=t",
|
"$dsn,D=test,t=t1",
|
||||||
qw(--execute --no-drop-old-table --preserve-triggers), '--alter', 'ADD COLUMN foo INT')
|
qw(--execute --no-drop-old-table --preserve-triggers), '--alter', 'ADD COLUMN foo INT')
|
||||||
},
|
},
|
||||||
stderr => 1,
|
stderr => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
diag($output);
|
||||||
isnt(
|
isnt(
|
||||||
$exit,
|
$exit,
|
||||||
0,
|
0,
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user