diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 40aaa422..354947d6 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -2987,6 +2987,7 @@ sub new { dbh_set => 0, OptionParser => $o, DSNParser => $dp, + is_cluster_node => undef, }; return bless $self, $class; @@ -3056,6 +3057,19 @@ sub name { return $self->{hostname} || $self->{dsn_name} || 'unknown host'; } +sub is_cluster_node { + my ($self) = @_; + return $self->{is_cluster_node} if defined $self->{is_cluster_node}; + + my $sql = "SHOW VARIABLES LIKE 'wsrep_on'"; + PTDEBUG && _d($sql); + my $row = $self->{dbh}->selectrow_arrayref($sql); + PTDEBUG && _d(defined $row ? @$row : 'undef'); + $self->{is_cluster_node} = $row && $row->[0] ? 1 : 0; + + return $self->{is_cluster_node}; +} + sub DESTROY { my ($self) = @_; if ( $self->{dbh} @@ -8533,7 +8547,7 @@ sub main { my $checksum_dml = "REPLACE INTO $repl_table " . "(db, tbl, chunk, chunk_index," . " lower_boundary, upper_boundary, this_cnt, this_crc) " - . "SELECT " + . "SELECT" . ($master_cxn->is_cluster_node() ? '/*!99997*/' : '') . " ?, ?, ?, ?, ?, ?,"; my $past_cols = " COUNT(*), '0'"; @@ -11028,6 +11042,14 @@ replicas do not honor this change. Therefore, checksums will not replicate past any replicas using row-based replication that are masters for further replicas. (L) +=item Percona XtraDB Cluster + +pt-table-checksum works with Percona XtraDB Cluster 5.5.27-23.6 and newer. +The C method for L<"--recursion-method"> must be used to specify cluster +nodes and regular replicas because nodes are not regular replicas so they +cannot be detected automatically. The lag check (see L<"REPLICA CHECKS">) +is not performed for cluster nodes. + =back =head1 BUGS