| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Andy Chambers <achambers(at)mcna(dot)net> |
| Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Sequence moves forward when failover is triggerred |
| Date: | 2012-07-10 22:48:11 |
| Message-ID: | 8254.1341960491@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Andy Chambers <achambers(at)mcna(dot)net> writes:
> When testing the failover procedure, we noticed that when the new master
> comes up, some sequences have moved forward (by between 30 and 40). I see
> there's a "cache" option when creating the sequence but we're not using
> that.
> Is this to be expected?
Yes. This is an artifact of an optimization that reduces the number of
WAL records generated by nextval() calls --- server processes will write
WAL records that say they've consumed multiple sequence values ahead of
where they actually have.
AFAICS this is not distinguishably different from the case where a
transaction consumes that number of sequence values and then rolls back,
so I don't see much wrong with that optimization.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Filipe Brandão | 2012-07-10 22:56:19 | Python + listen/notify |
| Previous Message | Andy Chambers | 2012-07-10 22:26:05 | Re: Do I need archive_mode = on for hot standby? |