Comment 2 for bug 1730168

Revision history for this message
Jaime Sicam (jssicam) wrote :

Carlos,

Is it feasible to ignore if the table exists on the slave and still check for slave lag? The workaround is recursion-method=none but slave will lag since it's no longer checked.

Based on the code, it looks like if the tool detects if slave(s) exist, it will check if the created table is on the slave:

   if ( $slaves && scalar @$slaves ) {
      foreach my $slave (@$slaves) {
         my ($pr, $pr_first_report);
         if ( $o->get('progress') ) {
            $pr = new Progress(
               jobsize => scalar @$slaves,
               spec => $o->get('progress'),
               name => "Waiting for " . $slave->name(),
            );
            $pr_first_report = sub {
               print "Waiting forever for new table $new_tbl->{name} to replicate "
                  . "to " . $slave->name() . "...\n";
            };
         }
         $pr->start() if $pr;
         my $has_table = 0;
         while ( !$has_table ) {
            $has_table = $tp->check_table(
               dbh => $slave->dbh(),
               db => $new_tbl->{db},
               tbl => $new_tbl->{tbl}
            );
            last if $has_table;
            $pr->update(
               sub { return 0; },
               first_report => $pr_first_report,
            ) if $pr;
            sleep 1;
         }
      }
   }

But when checking for replication lag it only checks "Seconds behind master".

sub get_slave_lag {
   my ( $self, $dbh ) = @_;
   my $stat = $self->get_slave_status($dbh);
   return unless $stat; # server is not a slave
   return $stat->{seconds_behind_master};
}

So, is it possible to just ignore if the table exists on the slave or is this difficult to fix?