[Bucardo-general] How to skip a failing command ?

Kiriakos Tsourapas ktsour at gmail.com
Tue Jul 5 09:26:30 UTC 2011


Hi again,

Without knowing perl, I made the following change :

                                                if ($g->{pkcols} > 1) {
                                                        $list .= sprintf '(%s),' => join ',' => map { s{\\}{\\\\}; qq{$_}; } @$row;
                                                }

instead of 

                                                if ($g->{pkcols} > 1) {
                                                        $list .= sprintf '(%s),' => join ',' => @$row;
                                                }

and it worked fine.

Please let me know if you think I have done something wrong...


Thank you again,

P.S. Please let me know if there is a guide for upgrade from 4.5.0 to 5.0





On Jul 5, 2011, at 12:07, Kiriakos Tsourapas wrote:

> Hi, 
> 
> I patched Bucardo.pm as you suggested.
> 
> Here are the changes :
>                                         ## Build a list of all PK values
>                                         my $pkvals = '';
>                                         for my $row (@$info) {
>                                                 #my $inner = join ',' => map { s/\'/''/go; qq{'$_'}; } @$row;
>                                                 my $inner = join ',' => map { s{\'}{''}go; s{\\}{\\\\}go; qq{'$_'}; } @$row;
>                                                 $pkvals .= $g->{pkcols} > 1 ? "($inner)," : "$inner,";
>                                         }
>                                         chop $pkvals;
> 
> and
> 
>                                                                 my $deletebatch = 10_000;
>                                                                 my $dcount = 0;
>                                                                 my $delcount = 0;
>                                                                 for my $row (@$info) {
>                                                                         #my $inner = join ',' => map { s/\'/''/go; qq{'$_'}; } @$row;
>                                                                         my $inner = join ',' => map { s/\'/''/go; s{\\}{\\\\}; qq{'$_'}; } @$row;
>                                                                         ## Put this group of pks into a temporary array
>                                                                         $delchunks[$delcount] .= $g->{pkcols} > 1 ? "($inner)," : "$inner,";
>                                                                         ## Once we reach out limit, start appending to the next bit of the array
>                                                                         if ($dcount++ >= $deletebatch) {
>                                                                                 $delcount++;
>                                                                                 $dcount = 0;
>                                                                         }
>                                                                 }
> 
> 
> But the error comes from another line :
> syntax error at or near "90360" LINE 1: ... IN (('90360','G[?4??X?('),('90360','???fei7\'),('90360','?x...                                                              ^ at /usr/lib/perl5/site_perl/5.10.0/Bucardo.pm line 5724.  main error: none source error: 7 target error: none States:/4260
> 
> which I quote here :
>                                 while (@srcdelete) {
>                                         $x=0;
>                                         my $list = '';
>                                   LOOP: {
>                                                 my $row = shift @srcdelete;
>                                                 last LOOP if ! defined $row or ! defined $row->[0];
>                                                 if ($g->{pkcols} > 1) {
>                                                         $list .= sprintf '(%s),' => join ',' => @$row;
>                                                 }
>                                                 else {
>                                                         $list .= "$row->[0],";
>                                                 }
>                                                 last LOOP if $x++ >= $config{max_delete_clause};
>                                                 redo LOOP;
>                                         }
>                                         chop $list;
>                                         if (length $list) {
>                                                 $self->glog("Deleting from source: $SQL ($list)");
>                                                 $dmlcount{D}{source}{$S}{$T} += $sourcedbh->do("$SQL ($list)");
>                                         }
>                                 }
> 
> Can you please help me figure out what I need to change to make it work ?
> I am also attaching my Bucardo.pm
> 
> Also, is there anywhere a guide on how to upgrade from 4.5.0 to 5.0 ?
> 
> 
> 
> 
> Thank you very much for your help !!
> 
> 
> 
> On Jul 4, 2011, at 21:16, Greg Sabino Mullane wrote:
> 
>> On Mon, Jul 04, 2011 at 11:15:10AM +0300, Kiriakos Tsourapas wrote:
>>> Hi,
>>> 
>>> I faced a problem that is obviously solved in version 4.4.4
>>> The problem has to do with the fact that bucardo is not escaping the backslash.
>>> 
>>> So, I will upgrade to latest version, but until then, is there a 
>>> way to skip the failing command, so that replication has continue from there on ?
>> 
>> No, there is no way - Bucardo need to delete all the records at once.
>> If you don't want to do a full upgrade, you could simply patch 
>> your current version of Bucardo.pm to escape the backslash.
>> 
>> See:
>> 
>> https://github.com/bucardo/bucardo/commit/9a4d650166606a0e486211431e5c294d2112e5a3
>> https://github.com/bucardo/bucardo/commit/92e228d313b9803e9ef7515fc278300f4876362d
>> 
>> -- 
>> Greg Sabino Mullane greg at endpoint.com
>> End Point Corporation
>> PGP Key: 0x14964AC8
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20110705/a5ef3189/attachment.html 


More information about the Bucardo-general mailing list