Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch failed for latest pt-online-schema-change #57

Open
Dhanasekar93 opened this issue Jan 11, 2019 · 0 comments
Open

Patch failed for latest pt-online-schema-change #57

Dhanasekar93 opened this issue Jan 11, 2019 · 0 comments

Comments

@Dhanasekar93
Copy link

Patch command is getting failed while applying the patch file for the latest percona toolkit (3.0.13).

Logs:

root@localhost:/opt/shift/files# patch 3.0 ptosc-patch/0001-ptosc-square-changes.patch 
patching file 3.0
Hunk #1 succeeded at 28 (offset 1 line).
Hunk #2 succeeded at 3701 (offset 157 lines).
Hunk #3 succeeded at 3787 (offset 157 lines).
Hunk #4 succeeded at 5728 (offset 346 lines).
Hunk #5 succeeded at 5743 (offset 346 lines).
Hunk #6 succeeded at 5864 (offset 365 lines).
Hunk #7 succeeded at 6089 (offset 372 lines).
Hunk #8 succeeded at 6101 (offset 372 lines).
Hunk #9 succeeded at 8358 with fuzz 1 (offset 253 lines).
Hunk #10 succeeded at 8956 (offset 365 lines).
Hunk #11 succeeded at 9191 (offset 371 lines).
Hunk #12 succeeded at 9223 (offset 371 lines).
Hunk #13 succeeded at 9257 (offset 371 lines).
Hunk #14 succeeded at 9349 (offset 371 lines).
Hunk #15 succeeded at 9471 (offset 371 lines).
Hunk #16 succeeded at 9513 (offset 371 lines).
Hunk #17 succeeded at 9538 (offset 371 lines).
Hunk #18 succeeded at 9560 (offset 371 lines).
Hunk #19 succeeded at 9578 (offset 371 lines).
Hunk #20 succeeded at 9770 (offset 371 lines).
Hunk #21 succeeded at 9806 (offset 371 lines).
Hunk #22 succeeded at 9912 (offset 381 lines).
Hunk #23 succeeded at 9940 (offset 381 lines).
Hunk #24 succeeded at 9962 (offset 381 lines).
Hunk #25 succeeded at 10006 (offset 381 lines).
Hunk #26 succeeded at 10195 (offset 424 lines).
Hunk #27 succeeded at 10236 (offset 424 lines).
Hunk #28 succeeded at 10251 (offset 424 lines).
Hunk #29 succeeded at 10641 (offset 505 lines).
Hunk #30 succeeded at 10656 (offset 505 lines).
Hunk #31 FAILED at 10256.
Hunk #32 succeeded at 10860 (offset 568 lines).
Hunk #33 succeeded at 10882 (offset 566 lines).
Hunk #34 succeeded at 10911 (offset 566 lines).
Hunk #35 FAILED at 10359.
Hunk #36 succeeded at 11255 (offset 612 lines).
Hunk #37 FAILED at 10709.
Hunk #38 succeeded at 11684 (offset 773 lines).
Hunk #39 succeeded at 12460 (offset 842 lines).
Hunk #40 succeeded at 12537 (offset 879 lines).
Hunk #41 succeeded at 12569 with fuzz 2 (offset 891 lines).
Hunk #42 succeeded at 12691 with fuzz 2 (offset 944 lines).
Hunk #43 succeeded at 12843 with fuzz 2 (offset 993 lines).
Hunk #44 succeeded at 12914 with fuzz 2 (offset 1015 lines).
Hunk #45 succeeded at 12986 (offset 1016 lines).
3 out of 45 hunks FAILED -- saving rejects to file 3.0.rej

3.0.rej file:

--- pt-online-schema-change       2017-07-17 09:46:31.000000000 -0700
+++ pt-online-schema-change       2017-07-17 09:46:31.000000000 -0700
@@ -10256,6 +10583,16 @@
    elsif ( $o->get('execute') ) {
       print ts("Swapping tables...\n");
 
+      if ( $o->get('swap-table-name') ) {
+         $table_name = $o->get('swap-table-name');
+         $table_name =~  s/%T/$orig_tbl->{name}/g;
+         use POSIX 'strftime';
+         my $timestamp = strftime("%Y%m%d%H%M%S", localtime(time()));
+         $table_name =~  s/%D/$timestamp/g;
+      } else {
+         $table_name = $prefix . $table_name;
+      }
+
       while ( $name_tries-- ) {
          $table_name = $prefix . $table_name;
 
@@ -10359,7 +10720,10 @@
            . ' LIKE ' . $q->literal_like($orig_tbl->{tbl});
    PTDEBUG && _d($sql);
    my $triggers = $dbh->selectall_arrayref($sql);
-   if ( $triggers && @$triggers ) {
+   # Don't quit on existing triggers if running from a saved state. The triggers
+   # are expected to be present.
+   if ( $triggers && @$triggers &&
+         (!defined $loaded_step || (defined $loaded_step && !grep { $_ eq $loaded_step } qw(triggers copy rename)))) {
       die "The table $orig_tbl->{name} has triggers.  This tool "
          . "needs to create its own triggers, so the table cannot "
          . "already have triggers.\n";
@@ -10709,8 +11074,11 @@
    @drop_trigger_sqls = ();
    foreach my $trg ( @triggers ) {
       my ($name, $sql) = @$trg;
-      print $sql, "\n" if $o->get('print');
-      if ( $o->get('execute') ) {
+      print "$name trigger: $sql\n";
+      # Don't create triggers if running from a saved state. They should already
+      # be there.
+      if ( $o->get('execute') &&
+         (!defined $loaded_step || (defined $loaded_step && !grep { $_ eq $loaded_step } qw(triggers copy rename)))) {
          osc_retry(
             Cxn     => $cxn,
             Retry   => $retry,

Please let me know how to patch it without getting failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant