Bug with sequences and WAL ?

Started by Philippe Ferreiraabout 20 years ago4 messagesgeneral
Jump to latest
#1Philippe Ferreira
phil.f@worldonline.fr

Hi,

If a new sequence is created, its creation is propagated via WAL.

However, instead of getting the property 'is_called'=false (the correct
value before its first use),
we get 'is_called'=true after a PITR recovery.

Is it a bug, or a normal behaviour ?
(version of PostgreSQL : 8.0.4)

Thank you,
Philippe Ferreira.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Philippe Ferreira (#1)
Re: Bug with sequences and WAL ?

Philippe Ferreira <phil.f@worldonline.fr> writes:

If a new sequence is created, its creation is propagated via WAL.

However, instead of getting the property 'is_called'=false (the correct
value before its first use),
we get 'is_called'=true after a PITR recovery.

Is it a bug, or a normal behaviour ?

I don't think this is very important, because the normal behavior of
sequences is that after a crash the sequence can be up to 32 (IIRC)
counts beyond the last value actually delivered before the crash.
To get "exact" restart behavior we'd need to emit a separate xlog
record for each nextval() command, which seems like a pretty high
price considering that you cannot assume no holes in the sequence
values anyway.

regards, tom lane

#3Philippe Ferreira
phil.f@worldonline.fr
In reply to: Tom Lane (#2)
Re: Bug with sequences and WAL ?

I don't think this is very important, because the normal behavior of
sequences is that after a crash the sequence can be up to 32 (IIRC)
counts beyond the last value actually delivered before the crash.
To get "exact" restart behavior we'd need to emit a separate xlog
record for each nextval() command, which seems like a pretty high
price considering that you cannot assume no holes in the sequence
values anyway.

Hi,

You are right. I've already seen sequences increase up to 24 or 32 after
a failover with PITR.
However, I'm also using PITR in order to do switchover. In this case, I
think that nothing
should change...
But, I recognize that using PITR for switchover is rather an
"unsupported" functionnality...

Thank you,
Philippe Ferreira.

#4Philippe Ferreira
phil.f@worldonline.fr
In reply to: Tom Lane (#2)
Re: Bug with sequences and WAL ?

To get "exact" restart behavior we'd need to emit a separate xlog
record for each nextval() command, which seems like a pretty high
price considering that you cannot assume no holes in the sequence
values anyway.

Hi,

Why not give the choice at compile-time ?

Philippe.