Re: replay of CREATE TABLESPACE eats data at wal_level=minimal
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Noah Misch <noah@leadboat.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-08-10T13:35:00Z
Lists: pgsql-hackers
On Mon, Aug 9, 2021 at 9:23 PM Noah Misch <noah@leadboat.com> wrote: > > I don't presently have a specific idea about how to fix this. > > Can't recovery just not delete the directory, create it if doesn't exist, and > be happy if it does exist? Like the attached WIP. If we think it's possible > for a crash during mkdir to leave a directory having the wrong permissions, > adding a chmod would be in order. Oh, yeah, I think that works, actually. I was imagining a few problems here, but I don't think they really exist. The redo routines for files within the directory can't possibly care about having the old files erased for them, since that wouldn't be something that would normally happen, if there were no recent CREATE TABLESPACE involved. And there's code further down to remove and recreate the symlink, just in case. So I think your proposed patch might be all we need. -- Robert Haas EDB: http://www.enterprisedb.com
Commits
-
Fix data loss in wal_level=minimal crash recovery of CREATE TABLESPACE.
- 978998dbde2a 9.6.24 landed
- f11c1bb17099 10.19 landed
- 6ebd2426bda2 11.14 landed
- a494f1023264 12.9 landed
- b18669f5e652 13.5 landed
- 5513c09c8999 14.0 landed
- 97ddda8a82ac 15.0 landed
-
Skip WAL for new relfilenodes, under wal_level=minimal.
- c6b92041d385 13.0 cited
-
Properly replay CREATE TABLESPACE during crash recovery by deleting
- c86f467d18aa 9.1.0 cited