Merge lp:~percona-toolkit-dev/percona-toolkit/pt-osc-asks-for-confirmation-when-alter-foreign-key-method-none-1329422 into lp:~percona-toolkit-dev/percona-toolkit/release-2.2.9

Proposed by Frank Cizmich
Status: Merged
Merged at revision: 612
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/pt-osc-asks-for-confirmation-when-alter-foreign-key-method-none-1329422
Merge into: lp:~percona-toolkit-dev/percona-toolkit/release-2.2.9
Diff against target: 43 lines (+15/-1)
2 files modified
bin/pt-online-schema-change (+14/-0)
t/pt-online-schema-change/basics.t (+1/-1)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/pt-osc-asks-for-confirmation-when-alter-foreign-key-method-none-1329422
Reviewer Review Type Date Requested Status
Percona Toolkit developers Pending
Review via email: mp+225058@code.launchpad.net

Description of the change

Issues a warning and asks for confirmation when alter-foreign-key-method = none
Can be overriden with --force

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/pt-online-schema-change'
--- bin/pt-online-schema-change 2014-06-05 07:24:48 +0000
+++ bin/pt-online-schema-change 2014-06-30 17:03:42 +0000
@@ -7860,6 +7860,16 @@
7860 $o->save_error("Invalid --alter-foreign-keys-method value: $alter_fk_method");7860 $o->save_error("Invalid --alter-foreign-keys-method value: $alter_fk_method");
7861 }7861 }
78627862
7863 # Issue a strong warning if alter-foreign-keys-method = none
7864 if ( $alter_fk_method eq 'none' && !$o->get('force') ) {
7865 print STDERR "WARNING! Using alter-foreign-keys-method = \"none\". This will typically cause foreign key violations!\nThis method of handling foreign key constraints is only provided so that the database administrator can disable the tool’s built-in functionality if desired.\n\nContinue anyway? (y/N)";
7866 my $response;
7867 chomp($response = <STDIN>);
7868 if ($response !~ /y|(yes)/i) {
7869 exit 1;
7870 }
7871 }
7872
7863 if ( $alter_fk_method eq 'drop_swap' && !$o->get('drop-new-table') ) {7873 if ( $alter_fk_method eq 'drop_swap' && !$o->get('drop-new-table') ) {
7864 $o->save_error("--alter-foreign-keys-method=drop_swap does not work with --no-drop-new-table.");7874 $o->save_error("--alter-foreign-keys-method=drop_swap does not work with --no-drop-new-table.");
7865 }7875 }
@@ -11025,6 +11035,10 @@
11025documentation and understand how to use this tool. If you have not read the11035documentation and understand how to use this tool. If you have not read the
11026documentation, then do not specify this option.11036documentation, then do not specify this option.
1102711037
11038=item --force
11039
11040This options bypasses confirmation in case of using alter-foreign-keys-method = none , which might break foreign key constraints.
11041
11028=item --help11042=item --help
1102911043
11030Show help and exit.11044Show help and exit.
1103111045
=== modified file 't/pt-online-schema-change/basics.t'
--- t/pt-online-schema-change/basics.t 2013-11-27 00:27:49 +0000
+++ t/pt-online-schema-change/basics.t 2014-06-30 17:03:42 +0000
@@ -591,7 +591,7 @@
591 test_type => "new_engine",591 test_type => "new_engine",
592 new_engine => "innodb",592 new_engine => "innodb",
593 cmds => [593 cmds => [
594 qw(--execute --alter-foreign-keys-method none --alter ENGINE=INNODB)594 qw(--execute --alter-foreign-keys-method none --force --alter ENGINE=INNODB)
595 ],595 ],
596);596);
597597

Subscribers

People subscribed via source and target branches

to all changes: