[Bucardo-general] patch request
Grant Maxwell
grant.maxwell at maxan.com.au
Tue Sep 8 08:18:21 UTC 2009
Hi
I have made some minor changes to bucardo.pm to fill the rowinfo array
when dealing with pushdelta sync exceptions. The result is very
efficient exception handling for
duplicate key violations. The changes were made to 4.1.0.
If anyone is interested I could post the custom exception code I'm
using.
Could you please consider adding them to the main code. If you do you
should surely check the code because it works without error for me
but ... well .. you know.
I'm not familiar with using diff for patching so I did a diff of the
two files.
Here is the diff:
4625c4625,4627
< $self->glog("Exception caught: $err");
---
> $err =~ /: "(\d+)\t/;
> $pkval = $1;
> $self->glog("Exception caught for $sync->{sourcedb}:$S.$T:
$pkval: $err");
4643a4646,4669
> ## ELS change start
> $SQL = "SELECT * FROM $S.$T WHERE $g->{qpkey}[0] = ?";
> $sth = $sourcedbh->prepare($SQL);
> $count = $sth->execute($pkval);
> my $sr = $sth->fetchrow_hashref ;
> $sth->finish();
>
>
> ## Prepare information to hand to our exception handler
> %rowinfo = (
> sourcerow => $sr,
> schema => $S,
> table => $T,
> pkeyname => $g->{pkey},
> qpkeyname => $g->{qpkey},
> pkeytype => $g->{pkeytype},
> pkey => $pkval,
> action => 0,
> dbi_error => $err,
> source_error => $sourcedbh->err ? 1 : 0,
> target_error => $targetdbh->err ? 1 : 0,
> );
>
> ## ELS change end
More information about the Bucardo-general
mailing list