[Bucardo-general] Patch: Broken "Latest" Conflict Resolution
Benjamin Allen
bsa at lanl.gov
Fri Mar 13 04:31:53 UTC 2009
The code in Bucardo.pm that does "latest" conflict resolution is
broken by calling the execute method on $sth{sc_latest_src} and
$sth{sc_latest_tgt} which are unblessed objects. The proper objects to
use are $sth{sc_latest_src}{$g->{pkcols}} and $sth{sc_latest_tgt}{$g-
>{pkcols}} respectively as those are what the earlier DBI prepares
are set to.
Original Error:
Can't call method "execute" on unblessed reference at /usr/local/lib/
perl5/site_perl/5.8.9/Bucardo.pm line 4678.
diff --git a/Bucardo.pm b/Bucardo.pm
index 87fcce9..7162343 100644
--- a/Bucardo.pm
+++ b/Bucardo.pm
@@ -4675,19 +4675,19 @@ sub start_kid {
$sth{sc_latest_tgt}{$g->{pkcols}} = $targetdbh->prepare($SQL);
}
if ($g-
>{pkcols} > 1) {
-
$sth{sc_latest_src}->execute($g->{oid},@{$info1->{$pkval}
{BUCARDO_PKVALS}});
+
$sth{sc_latest_src}{$g->{pkcols}}->execute($g->{oid},@{$info1->{$pkval}
{BUCARDO_PKVALS}});
}
else {
-
$sth{sc_latest_src}->execute($g->{oid},$pkval);
+
$sth{sc_latest_src}{$g->{pkcols}}->execute($g->{oid},$pkval);
}
- my $srctime =
$sth{sc_latest_src}->fetchall_arrayref()->[0][0];
+ my $srctime =
$sth{sc_latest_src}{$g->{pkcols}}->fetchall_arrayref()->[0][0];
if ($g-
>{pkcols} > 1) {
-
$sth{sc_latest_tgt}->execute($toid,@{$info2->{$pkval}{BUCARDO_PKVALS}});
+
$sth{sc_latest_tgt}{$g->{pkcols}}->execute($toid,@{$info2->{$pkval}
{BUCARDO_PKVALS}});
}
else {
-
$sth{sc_latest_tgt}->execute($toid,$pkval);
+
$sth{sc_latest_tgt}{$g->{pkcols}}->execute($toid,$pkval);
}
- my $tgttime =
$sth{sc_latest_tgt}->fetchall_arrayref()->[0][0];
+ my $tgttime =
$sth{sc_latest_tgt}{$g->{pkcols}}->fetchall_arrayref()->[0][0];
$self-
>glog(qq{Delta source time: $srctime Target time: $tgttime});
$info1-
>{$pkval}{BUCARDO_ACTION} = $srctime >= $tgttime ? 1 : 2;
} ## end 'latest'
Side note, I think as Greg mentioned before, a bug tracker website
would be useful for this project now that community involvement has
grown significantly.
Regards,
Ben Allen
More information about the Bucardo-general
mailing list