Hi,

In warm standby system when we have a filled log segment forwarded to
archiving, there is an inconsistency on standby next value sequences
obtained by a call to nextval() function. e.g.:

* Primary server
- Create sequence seq_a;
- Select nextval ( 'seq_a'); # value 1;
- Log shipping;

* Standby server
- Failover;
- Select nextval ( 'seq_a') on standby # value = currval + 31 (written ahead)

AFAIK this occurs because some fetches (log_cnt) are made in advance
and they are recorded in the log and shipping together.
Does it necessary for some kind of overhead or something like that?

Does it make sense to create a GUC to control the log_cnt amount
rather than SEQ_LOG_VALS approach?

version: 8.3.7

regards,

-Leo

Search Discussions

  • Tom Lane at Aug 5, 2009 at 7:25 pm

    Leonardo Cezar writes:
    In warm standby system when we have a filled log segment forwarded to
    archiving, there is an inconsistency on standby next value sequences
    obtained by a call to nextval() function. e.g.:
    * Primary server
    - Create sequence seq_a;
    - Select nextval ( 'seq_a'); # value 1;
    - Log shipping;
    * Standby server
    - Failover;
    - Select nextval ( 'seq_a') on standby # value = currval + 31 (written ahead)
    AFAIK this occurs because some fetches (log_cnt) are made in advance
    and they are recorded in the log and shipping together.
    Does it necessary for some kind of overhead or something like that?
    Does it make sense to create a GUC to control the log_cnt amount
    rather than SEQ_LOG_VALS approach?
    No. If your application expects the series not to have gaps, your
    application is broken independently of warm standby. The same sort
    of advance would happen if the master crashed and restarted.

    regards, tom lane
  • Robert Haas at Aug 5, 2009 at 10:17 pm

    On Aug 5, 2009, at 3:25 PM, Tom Lane wrote:

    Leonardo Cezar <lhcezar@gmail.com> writes:
    In warm standby system when we have a filled log segment forwarded to
    archiving, there is an inconsistency on standby next value sequences
    obtained by a call to nextval() function. e.g.:
    * Primary server
    - Create sequence seq_a;
    - Select nextval ( 'seq_a'); # value 1;
    - Log shipping;
    * Standby server
    - Failover;
    - Select nextval ( 'seq_a') on standby # value = currval + 31
    (written ahead)
    AFAIK this occurs because some fetches (log_cnt) are made in advance
    and they are recorded in the log and shipping together.
    Does it necessary for some kind of overhead or something like that?
    Does it make sense to create a GUC to control the log_cnt amount
    rather than SEQ_LOG_VALS approach?
    No. If your application expects the series not to have gaps, your
    application is broken independently of warm standby. The same sort
    of advance would happen if the master crashed and restarted.
    Or if you ever roll back a transaction that has done nextval().

    ...Robert

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedAug 5, '09 at 7:00p
activeAug 5, '09 at 10:17p
posts3
users3
websitepostgresql.org...
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase