Re: [HACKERS] Slony-I goes BETA (possible bug) - Mailing list pgsql-advocacy

From Chris Browne
Subject Re: [HACKERS] Slony-I goes BETA (possible bug)
Date
Msg-id 607juj15lv.fsf@dev6.int.libertyrms.info
Whole thread Raw
In response to Slony-I goes BETA  (Jan Wieck <JanWieck@Yahoo.com>)
List pgsql-advocacy
jdavis-pgsql@empires.org (Jeff Davis) writes:
> Backtracking a little, I'm still wondering how exactly a replicated
> sequence is supposed to behave, do you have some comments about
> that? I don't understand exactly why it's useful.

The reason why it is is necessary to have some kind of handling of
sequences is the fact that tables commonly self-populate ID columns
using sequences.

create table important_table (
   id serial unique not null,
   descr text,
   created_on timestamptz default now()
);

That "id" field is populated via a sequence.

If Slony1 is told to shift control of the system to a new master, it
won't be very nice if "test_id_seq" (the sequence that was generated)
is set to 0 on the slaves, when the master has populated hundreds or
thousands of rows and has used thousands of sequence values.

If "test_id_seq" _doesn't_ get set to a nice high value, then if a
slave gets promoted to master, new inserts into important_table will
use low ID values, and, more than likely, conflict sporadically.  Bad
Thing.
--
select 'cbbrowne' || '@' || 'acm.org';
http://www3.sympatico.ca/cbbrowne/wp.html
Signs of a Klingon Programmer - 19.  "My program has just dumped Stova
Core!"

pgsql-advocacy by date:

Previous
From: "Fred Moyer"
Date:
Subject: Looking for data warehousing case studies in tips
Next
From: Jan Wieck
Date:
Subject: Re: [GENERAL] The pgreplication project