Fix "values are not the same" error in replicate_row when repinfo value is a '0'
authorglynastill <[email protected]>
Thu, 16 Apr 2015 16:24:10 +0000 (17:24 +0100)
committerglyn <[email protected]>
Wed, 1 Jun 2016 15:17:02 +0000 (16:17 +0100)
When check_replicate_row tested for valid values before starting the check, if the actual value returned was 0 it would evaluate to false, resulting in the error:
"Cannot test replication: values are not the same"

This is resolved by simply checking if the value is defined before assigning it's value a blank string instead.

check_postgres.pl

index 77d5326816964ee8760826703de1ede9b235a583..61a1d883d202c720556fa48a511c4477bee6c4b4 100755 (executable)
@@ -6442,11 +6442,11 @@ sub check_replicate_row {
     if (!defined $sourcedb) {
         ndie msg('rep-norow', "$table.$col");
     }
-    my $value1 = $info1->{db}[0]{slurp}[0]{c} || '';
+    my $value1 = (defined($info1->{db}[0]{slurp}[0]{c})?$info1->{db}[0]{slurp}[0]{c}:'');
 
     my $numslaves = @{$info1->{db}} - 1;
     for my $d ( @{$info1->{db}}[1 .. $numslaves] ) {
-        my $value2 = $d->{slurp}[0]{c} || '';
+        my $value2 = (defined($d->{slurp}[0]{c})?$d->{slurp}[0]{c}:'');
         if ($value1 ne $value2) {
             ndie msg('rep-notsame');
         }