Steve Singer ssinger at ca.afilias.info
Fri Jul 26 11:24:13 PDT 2013
On 07/26/2013 04:13 AM, Robert Wysocki wrote:
> Dnia 2013-07-26, pią o godzinie 09:02 +0200, Robert Wysocki pisze:
>> Dnia 2013-07-26, pią o godzinie 07:55 +0200, Robert Wysocki pisze:
>>
>>> This probably is what's causing it - especially that we do not replicate
>>> this particular sequence - but I wander how is it that it worked (and is
>>> still working on prod) with slony<= 2.0.7?
>>
>> I've just confirmed it with slony 2.1.3:
>>
>> scenario:
>> replicated table testseq (id serial, data text), no sequence replication
>>
>> test case #1:
>> psql>  insert into testseq ( data ) values ( 'test' );
>> replicated OK, same id on both ends
>>
>> test case #2:
>> echo "insert into testseq ( data ) values ( 'execute script test' );"
>>> /tmp/testsql
>> slonik_execute_script 1 /tmp/testsql | slonik
>> replication failed, duplicated id error
>>
>> test case #3:
>> sequence testseq_id_seq added to replication set
>> slonik_execute_script 1 /tmp/testsql | slonik
>> replicated OK
>
> And now I confirmed that test case #2 works fine (replication OK without
> the need to include sequence in replication set) with slony 2.0.4
>

Really?
I just tried this with slony 2.0.7 and it does not work (I doubt this 
has changed between 2.0.4 and 2.0.7)


2013-07-26 14:19:03 EDTCONFIG remoteWorkerThread_1: DDL request with 2 
statements
2013-07-26 14:19:03 EDTCONFIG remoteWorkerThread_1: DDL Statement 0: 
[insert into testseq ( data ) values ( 'execute script test' );]
2013-07-26 14:19:03 EDTERROR  DDL Statement failed - PGRES_FATAL_ERROR
2013-07-26 14:19:03 EDTCONFIG slon: child terminated signal: 9; pid: 
13988, current worker pid: 13988



However, each time slon attempts to run the execute script the default 
nextval() on the replica it will advance the current value of the 
sequence on the replica (because sequence operations don't get rolled 
back) so after a couple of attempts the excute script will work on the 
replica.

I suspect this is what your seeing in your test.  Repeat your test case 
#1 on 2.0.4 but instead of inserting 1 row, insert 100 rows with psql 
and let them replicate.  I think you will then find that it takes a lot 
longer for the execute script on the replica to 'appear to work'





> Regards,



More information about the Slony1-general mailing list