pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7567: Sequences not properly replicated
3+ messages / 3 participants
[nested] [flat]

* BUG #7567: Sequences not properly replicated
@ 2012-09-25 10:13 s.proels@pharmatechnik.de
  2012-09-25 16:08 ` Re: BUG #7567: Sequences not properly replicated Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: s.proels@pharmatechnik.de @ 2012-09-25 10:13 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      7567
Logged by:          Stefan Pröls
Email address:      s.proels@pharmatechnik.de
PostgreSQL version: 9.1.3
Operating system:   OpenSUSE 11.4 32-Bit
Description:        

Scenario:
1 Master, 1 Hot-Standby Slave, asynchronous streaming replication, both
servers PostgreSQL 9.1.3.

===Master:================================================================================================================================
$ CREATE SEQUENCE t_seq;

$ SELECT * FROM t_seq;
 sequence_name | last_value | start_value | increment_by |      max_value   
  | min_value | cache_value | log_cnt | is_cycled | is_called 
---------------+------------+-------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
 t_seq         |          1 |           1 |            1 |
9223372036854775807 |         1 |           1 |       1 | f         | f

===Slave:=================================================================================================================================
$ SELECT * FROM t_seq;
 sequence_name | last_value | start_value | increment_by |      max_value   
  | min_value | cache_value | log_cnt | is_cycled | is_called 
---------------+------------+-------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
 t_seq         |          1 |           1 |            1 |
9223372036854775807 |         1 |           1 |       0 | f         | t

===Master:================================================================================================================================
$ SELECT nextval('t_seq');
 nextval 
---------
       1

$ SELECT * FROM t_seq;
 sequence_name | last_value | start_value | increment_by |      max_value   
  | min_value | cache_value | log_cnt | is_cycled | is_called 
---------------+------------+-------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
 t_seq         |          1 |           1 |            1 |
9223372036854775807 |         1 |           1 |       0 | f         | t

===Slave:=================================================================================================================================
$ SELECT * FROM t_seq;
 sequence_name | last_value | start_value | increment_by |      max_value   
  | min_value | cache_value | log_cnt | is_cycled | is_called 
---------------+------------+-------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
 t_seq         |          1 |           1 |            1 |
9223372036854775807 |         1 |           1 |       0 | f         | t

===Master:================================================================================================================================
$ SELECT nextval('t_seq');
 nextval 
---------
       2

$ SELECT * FROM t_seq;
 sequence_name | last_value | start_value | increment_by |      max_value   
  | min_value | cache_value | log_cnt | is_cycled | is_called 
---------------+------------+-------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
 t_seq         |          2 |           1 |            1 |
9223372036854775807 |         1 |           1 |      32 | f         | t

===Slave:=================================================================================================================================
$ SELECT * FROM t_seq;
 sequence_name | last_value | start_value | increment_by |      max_value   
  | min_value | cache_value | log_cnt | is_cycled | is_called 
---------------+------------+-------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
 t_seq         |         34 |           1 |            1 |
9223372036854775807 |         1 |           1 |       0 | f         | t
 





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #7567: Sequences not properly replicated
  2012-09-25 10:13 BUG #7567: Sequences not properly replicated s.proels@pharmatechnik.de
@ 2012-09-25 16:08 ` Tom Lane <tgl@sss.pgh.pa.us>
  2012-09-26 07:23   ` Re: BUG #7567: Sequences not properly replicated Stefan Pröls <s.proels@pharmatechnik.de>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2012-09-25 16:08 UTC (permalink / raw)
  To: s.proels@pharmatechnik.de; +Cc: pgsql-bugs

s.proels@pharmatechnik.de writes:
> The following bug has been logged on the website:
> Bug reference:      7567
> Logged by:          Stefan Pröls
> Email address:      s.proels@pharmatechnik.de
> PostgreSQL version: 9.1.3
> Operating system:   OpenSUSE 11.4 32-Bit
> Description:        

> Scenario:
> 1 Master, 1 Hot-Standby Slave, asynchronous streaming replication, both
> servers PostgreSQL 9.1.3.

The fact that the slave sees the last_value as ahead of the master is
not a bug; you'd have the same last_value on the master if it were to
crash and restart.  (This is due to a tradeoff made long ago to reduce
the amount of WAL traffic created by nextval: only one WAL record is
written per 32 nextval's, and that record claims last_value is 32 ahead
of what it previously was.)

There is a known bug, fixed in 9.1.5, associated with sequences that
have been ALTER'd ... but that's not what you're showing here.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #7567: Sequences not properly replicated
  2012-09-25 10:13 BUG #7567: Sequences not properly replicated s.proels@pharmatechnik.de
  2012-09-25 16:08 ` Re: BUG #7567: Sequences not properly replicated Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-09-26 07:23   ` Stefan Pröls <s.proels@pharmatechnik.de>
  0 siblings, 0 replies; 3+ messages in thread

From: Stefan Pröls @ 2012-09-26 07:23 UTC (permalink / raw)
  To: pgsql-bugs

Am 25.09.2012 18:08, schrieb Tom Lane:
> s.proels@pharmatechnik.de writes:
>> The following bug has been logged on the website:
>> Bug reference:      7567
>> Logged by:          Stefan Pröls
>> Email address:      s.proels@pharmatechnik.de
>> PostgreSQL version: 9.1.3
>> Operating system:   OpenSUSE 11.4 32-Bit
>> Description:
>> Scenario:
>> 1 Master, 1 Hot-Standby Slave, asynchronous streaming replication, both
>> servers PostgreSQL 9.1.3.
> The fact that the slave sees the last_value as ahead of the master is
> not a bug; you'd have the same last_value on the master if it were to
> crash and restart.  (This is due to a tradeoff made long ago to reduce
> the amount of WAL traffic created by nextval: only one WAL record is
> written per 32 nextval's, and that record claims last_value is 32 ahead
> of what it previously was.)
>
> There is a known bug, fixed in 9.1.5, associated with sequences that
> have been ALTER'd ... but that's not what you're showing here.
>
>                       regards, tom lane
>

Ah, I see. Thank you for explaining this!


Best regards,
Stefan Pröls


________________________________

PHARMATECHNIK GmbH und Co. KG
Münchner Strasse 15
D-82319 Starnberg

Sitz der Gesellschaft: Starnberg
HRA: 64434, HRB: 66369, Amtsgericht München
Geschäftsführer: Dr. Detlef Graessner, Dr. Mathias Schindl, Stephan Jörgens





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2012-09-26 07:23 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-09-25 10:13 BUG #7567: Sequences not properly replicated s.proels@pharmatechnik.de
2012-09-25 16:08 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-09-26 07:23   ` Stefan Pröls <s.proels@pharmatechnik.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox