Jan Wieck JanWieck
Tue Oct 26 17:55:56 PDT 2004
On 10/26/2004 12:02 PM, J?r?mie LOPEZ wrote:
> Thanks Darcy,
> 
> but does this mean that if I execute a SETVAL or NEXTVAL for a sequence on
> the master, wait for the replication to be done and execute a CURRVAL for
> this sequence on the master and on a slave, I should see the same value?
> (because I don't obtain this result... :-S)

You will never be able to call currval() without a prior nextval() in 
the same session. You probably mean "select last_value from seq".

Sequences replicated by Slony do not follow exactly the same semantics 
as tables. Each time a SYNC event is generated on the origin of data, 
the current values of all sequences is recorded. because of the 
difference in concurrency and visibility of changes between tables and 
sequences, these recorded values might include changes to the sequence 
that are not yet visible (committed) and therefore the corresponding 
table data changes will not yet get replicated with that SYNC event. 
Since sequences in PostgreSQL are not guaranteed to be gap free and 
don't roll back, this is acceptable. The do get correctly adjusted on 
switchover and they might be more advanced due to lost transactions in 
the case of a failover. So they follow exactly the PostgreSQL sequence 
semantics.

Calling nextval() or setval() on the origin alone will not trigger any 
Slony replication activity by itself. To do so, you would have to call 
nextval() on the sl_action_seq also.


Jan

> 
> 
>> -----Message d'origine-----
>> De : Darcy Buskermolen [mailto:darcy at wavefire.com] 
>> Envoy? : mardi 26 octobre 2004 17:43
>> ? : slony1-general at gborg.postgresql.org
>> Objet : Re: [Slony1-general] does slony currently do support 
>> sequences?
>> 
>> On October 26, 2004 05:18 am, J?r?mie LOPEZ wrote:
>> > Well, all is said in the subject, but I can clear the 
>> question by the 
>> > fact that when I first heard of slony, I was told it didn't support 
>> > sequences (i.e. the current value of a sequence isn't updated on 
>> > slaves, so you have to update it manually before making a 
>> master from 
>> > a slave) ; now that I have tried slony (which is a real 
>> cool project 
>> > btw :)) and want to get deeper in its possibilities, I find some 
>> > interesting slonik commands like SET ADD SEQUENCE.
>> > So its seems that sequences should be supported (even if there is a 
>> > workaround - with MERGE SET - to use to add sequences to a 
>> > already-subscribed set) ; but after having done some tests, I can't 
>> > succeed in replicating the current value of a sequence.
>> >
>> > So? Are the SET * SEQUENCE commands some kind of 'coming soon' 
>> > commands? Or am I wrong somewhere?
>> 
>> Yes sequences are fully supported, and have been since the 
>> first official release.
>> 
>> 
>> >
>> >
>> > TIA,
>> >
>> > J?r?mie.
>> 
>> -- 
>> Darcy Buskermolen
>> Wavefire Technologies Corp.
>> ph: 250.717.0200
>> fx:  250.763.1759
>> http://www.wavefire.com
>> _______________________________________________
>> Slony1-general mailing list
>> Slony1-general at gborg.postgresql.org
>> http://gborg.postgresql.org/mailman/listinfo/slony1-general
>> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Slony1-general mailing list
> Slony1-general at gborg.postgresql.org
> http://gborg.postgresql.org/mailman/listinfo/slony1-general


-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck at Yahoo.com #


More information about the Slony1-general mailing list