You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Treat directory open failures as hard errors in ResetUnloggedRelations().
Previously, this code just reported such problems at LOG level and keptgoing. The problem with this approach is that transient failures (e.g.,ENFILE) could prevent us from resetting unlogged relations to empty,yet allow recovery to appear to complete successfully. That seems likea data corruption hazard large enough to treat such problems as reasonsto fail startup.For the same reason, treat unlink failures for unlogged files as harderrors not just LOG messages. It's a little odd that we did it like thatwhen file-level errors in other steps (copy_file, fsync_fname) are ERRORs.The sole case that I left alone is that ENOENT failure on a tablespace(not database) directory is not an error, though it will now be loggedrather than just silently ignored. This is to cover the scenario wherea previous DROP TABLESPACE removed the tablespace directory but failedbefore removing the pg_tblspc symlink. I'm not sure that that's verylikely in practice, but that seems like the only real excuse for theold behavior here, so let's allow for it. (As coded, this will alsoallow ENOENT on $PGDATA/base/. But since we'll fail soon enough ifthat's gone, I don't think we need to complicate this code bydistinguishing that from a true tablespace case.)Discussion:https://postgr.es/m/21040.1512418508@sss.pgh.pa.us