]> granicus.if.org Git - postgresql/commit
Log the creation of an init fork unconditionally.
authorRobert Haas <rhaas@postgresql.org>
Thu, 8 Dec 2016 19:09:09 +0000 (14:09 -0500)
committerRobert Haas <rhaas@postgresql.org>
Thu, 8 Dec 2016 19:14:12 +0000 (14:14 -0500)
commit141ad68964f739c6543dc48143829c2cd0dd0c86
tree5a98088da5da14bd3f9ce246637ad524b51bc447
parent93c78ba19b378b4b54dad5ceb4fdf063bb0998e1
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.
src/backend/access/nbtree/nbtree.c
src/backend/access/spgist/spginsert.c
src/backend/catalog/heap.c