diff --git a/bin/pt-online-schema-change b/bin/pt-online-schema-change index aa5c12a7..915b8532 100755 --- a/bin/pt-online-schema-change +++ b/bin/pt-online-schema-change @@ -10022,6 +10022,11 @@ sub main { sleep $sleep; } + # --plugin hook + if ( $plugin && $plugin->can('on_copy_rows_after_nibble') ) { + $plugin->on_copy_rows_after_nibble(); + } + return; }, done => sub { @@ -13102,6 +13107,7 @@ These hooks, in this order, are called if defined: before_create_triggers after_create_triggers before_copy_rows + on_copy_rows_after_nibble after_copy_rows before_swap_tables after_swap_tables @@ -13181,6 +13187,11 @@ Here's a plugin file template for all hooks: print "PLUGIN before_copy_rows\n"; } + sub on_copy_rows_after_nibble { + my ($self, %args) = @_; + print "PLUGIN on_copy_rows_after_nibble\n"; + } + sub after_copy_rows { my ($self, %args) = @_; print "PLUGIN after_copy_rows\n"; diff --git a/t/pt-online-schema-change/plugin.t b/t/pt-online-schema-change/plugin.t index 1f611316..d86b49b0 100644 --- a/t/pt-online-schema-change/plugin.t +++ b/t/pt-online-schema-change/plugin.t @@ -65,6 +65,7 @@ is_deeply( 'PLUGIN before_create_triggers', 'PLUGIN after_create_triggers', 'PLUGIN before_copy_rows', + 'PLUGIN on_copy_rows_after_nibble', 'PLUGIN after_copy_rows', 'PLUGIN before_swap_tables', 'PLUGIN after_swap_tables', diff --git a/t/pt-online-schema-change/samples/plugins/all_hooks.pm b/t/pt-online-schema-change/samples/plugins/all_hooks.pm index 6548adc1..3aa37bd6 100644 --- a/t/pt-online-schema-change/samples/plugins/all_hooks.pm +++ b/t/pt-online-schema-change/samples/plugins/all_hooks.pm @@ -51,6 +51,11 @@ sub before_copy_rows { print "PLUGIN before_copy_rows\n"; } +sub on_copy_rows_after_nibble { + my ($self, %args) = @_; + print "PLUGIN on_copy_rows_after_nibble\n"; +} + sub after_copy_rows { my ($self, %args) = @_; print "PLUGIN after_copy_rows\n";