pgsql: Log the creation of an init fork unconditionally.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Log the creation of an init fork unconditionally.
Date: 2016-12-08 19:35:33
Message-ID: E1cF4Td-0000US-Cm@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log the creation of an init fork unconditionally.

Previously, it was thought that this only needed to be done for the
benefit of possible standbys, so wal_level = minimal skipped it.
But that's not safe, because during crash recovery we might replay
XLOG_DBASE_CREATE or XLOG_TBLSPC_CREATE record which recursively
removes the directory that contains the new init fork. So log it
always.

The user-visible effect of this bug is that if you create a database
or tablespace, then create an unlogged table, then crash without
checkpointing, then restart, accessing the table will fail, because
the it won't have been properly reset. This commit fixes that.

Michael Paquier, per a report from Konstantin Knizhnik. Wording of
the comments per a suggestion from me.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/a00ac62991fc9cce309e40979ca74ad54bf97b15

Modified Files
--------------
src/backend/access/nbtree/nbtree.c | 13 +++++++++----
src/backend/access/spgist/spginsert.c | 23 +++++++++++++----------
src/backend/catalog/heap.c | 13 +++++++------
3 files changed, 29 insertions(+), 20 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2016-12-08 19:57:58 pgsql: Silence compiler warning.
Previous Message Stephen Frost 2016-12-08 19:11:22 Re: [COMMITTERS] pgsql: Implement table partitioning.