[Bucardo-general] patch request

Grant Maxwell grant.maxwell at maxan.com.au
Tue Sep 8 08:14:39 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.

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 and  
attached the original and altered program below. Sorry if this is not  
what you need.


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


Attached is the patched and patched versions.




Grant Maxwell
maXan Pty Ltd

Ph: 61 2 80050094
Mob: 61 41 9227165
grant.maxwell at maxan.com.au
> P please consider the environment before printing this e-mail
>
The information in this e-mail is confidential and may be legally  
privileged. It is intended solely for the addressee. Access to this e- 
mail by anyone else is unauthorised. If you have received this  
communication in error, please notify us immediately by return e-mail  
with the subject heading "Received in error" or telephone +61 2  
80050094, then delete the email and destroy any copies of it. If you  
are not the intended recipient, any disclosure, copying, distribution  
or any action taken or omitted to be taken in reliance on it, is  
prohibited and may be unlawful. Opinions, conclusions and other  
information in this e-mail and any attachments that do not relate to  
the business of the maXan are neither given nor endorsed by it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20090908/7a4eff30/attachment-0003.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bucardo.pm.original
Type: application/octet-stream
Size: 198160 bytes
Desc: not available
Url : https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20090908/7a4eff30/attachment-0002.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20090908/7a4eff30/attachment-0004.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bucardo.pm.patched
Type: application/octet-stream
Size: 198980 bytes
Desc: not available
Url : https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20090908/7a4eff30/attachment-0003.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20090908/7a4eff30/attachment-0005.html 


More information about the Bucardo-general mailing list