Add after nibble hook to pt-online-schema-change (#645)

* Include hook after nibble on copy rows

* Update tests with new hook for pt-online-schema-change
This commit is contained in:
Marcelo HP Ferreira
2023-07-31 15:30:24 +02:00
committed by GitHub
parent b920dc7639
commit 8ece30ff2f
3 changed files with 17 additions and 0 deletions

View File

@@ -10022,6 +10022,11 @@ sub main {
sleep $sleep; sleep $sleep;
} }
# --plugin hook
if ( $plugin && $plugin->can('on_copy_rows_after_nibble') ) {
$plugin->on_copy_rows_after_nibble();
}
return; return;
}, },
done => sub { done => sub {
@@ -13102,6 +13107,7 @@ These hooks, in this order, are called if defined:
before_create_triggers before_create_triggers
after_create_triggers after_create_triggers
before_copy_rows before_copy_rows
on_copy_rows_after_nibble
after_copy_rows after_copy_rows
before_swap_tables before_swap_tables
after_swap_tables after_swap_tables
@@ -13181,6 +13187,11 @@ Here's a plugin file template for all hooks:
print "PLUGIN before_copy_rows\n"; 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 { sub after_copy_rows {
my ($self, %args) = @_; my ($self, %args) = @_;
print "PLUGIN after_copy_rows\n"; print "PLUGIN after_copy_rows\n";

View File

@@ -65,6 +65,7 @@ is_deeply(
'PLUGIN before_create_triggers', 'PLUGIN before_create_triggers',
'PLUGIN after_create_triggers', 'PLUGIN after_create_triggers',
'PLUGIN before_copy_rows', 'PLUGIN before_copy_rows',
'PLUGIN on_copy_rows_after_nibble',
'PLUGIN after_copy_rows', 'PLUGIN after_copy_rows',
'PLUGIN before_swap_tables', 'PLUGIN before_swap_tables',
'PLUGIN after_swap_tables', 'PLUGIN after_swap_tables',

View File

@@ -51,6 +51,11 @@ sub before_copy_rows {
print "PLUGIN before_copy_rows\n"; 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 { sub after_copy_rows {
my ($self, %args) = @_; my ($self, %args) = @_;
print "PLUGIN after_copy_rows\n"; print "PLUGIN after_copy_rows\n";