pgsql: Avoid transient bogus page contents when creating a sequence.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid transient bogus page contents when creating a sequence.
Date: 2014-04-22 07:53:28
Message-ID: E1WcVWC-0008VM-7x@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid transient bogus page contents when creating a sequence.

Don't use simple_heap_insert to insert the tuple to a sequence relation.
simple_heap_insert creates a heap insertion WAL record, and replaying that
will create a regular heap page without the special area containing the
sequence magic constant, which is wrong for a sequence. That was not a bug
because we always created a sequence WAL record after that, and replaying
that overwrote the bogus heap page, and the transient state could never be
seen by another backend because it was only done when creating a new
sequence relation. But it's simpler and cleaner to avoid that in the first
place.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/8d34f6862853b4b67e29b368dfedf7d4c28d694b

Modified Files
--------------
src/backend/commands/sequence.c | 55 ++++++++++++---------------------------
1 file changed, 16 insertions(+), 39 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-04-22 10:03:32 pgsql: Fix rm_desc routine of b-tree page delete records.
Previous Message Tom Lane 2014-04-21 17:28:30 pgsql: pg_stat_statements forgot to let previous occupant of hook get c