Re: [GENERAL] Hot-Standby and sequences

2011-02-02 Thread Wouter D'Haeseleer
OKay Tom,

Thanks for this clarification



Re: [GENERAL] Hot-Standby and sequences

2011-02-02 Thread Tom Lane
"Wouter D'Haeseleer"  writes:
> I have a question about sequences in combination with streaming
> replication.
> It seems something strange is happening with sequences which are
> streamed to the slave.

> When updating the sequence the last_value on the slave shifts with 32
> and halts at this value until the master increased the value also with
> 32.
> Is this normal behavior ?

Yes, this is expected because of the hacks that are used to minimize
the number of WAL records emitted during nextval() operations.  The
slave is seeing the state that would prevail on the master, too, if the
master were to crash and restart.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Hot-Standby and sequences

2011-02-02 Thread Wouter D'Haeseleer
Hi All,

I have a question about sequences in combination with streaming
replication.
It seems something strange is happening with sequences which are
streamed to the slave.

When updating the sequence the last_value on the slave shifts with 32
and halts at this value until the master increased the value also with
32.
Is this normal behavior ?

Please see the example below:

Using Setval
--

# psql -t -h master -c "select setval('foo', 10)"
  10

# psql -t -h master  -c "select last_value from foo"
  10

# psql -t -h slave  -c "select last_value from foo"
  10

Using Nextval
--

# psql -t -h master -c "select nextval('foo')"
   11

# psql -t -h master  -c "select last_value from foo"
  11

# psql -t -h slave -c "select last_value from foo"
 43


-- 
Wouter D'Haeseleer
Linux System Engineer

VASCO Data Security
Dellingstraat 28b
2800 Mechelen
Belgium

phone: +32 15 50 44 00
email: w...@vasco.com 
web: www.vasco.com


[GENERAL] Hot-Standby and sequences

2011-02-02 Thread Wouter D'Haeseleer
Hi All,

I have a question about sequences in combination with streaming
replication.
It seems something strange is happening with sequences which are
streamed to the slave.

When updating the sequence the last_value on the slave shifts with 32
and halts at this value until the master increased the value also with
32.
Is this normal behavior ?

Please see the example below:

Using Setval
--

# psql -t -h master -c "select setval('foo', 10)"
  10

# psql -t -h master  -c "select last_value from foo"
  10

# psql -t -h slave  -c "select last_value from foo"
  10

Using Nextval
--

# psql -t -h master -c "select nextval('foo')"
   11

# psql -t -h master  -c "select last_value from foo"
  11

# psql -t -h slave -c "select last_value from foo"
 43


-- 
Wouter D'Haeseleer
Linux System Engineer

VASCO Data Security
Dellingstraat 28b
2800 Mechelen
Belgium

phone: +32 15 50 44 00
email: w...@vasco.com 
web: www.vasco.com