aboutsummaryrefslogtreecommitdiff
path: root/src/tutorial/funcs.c
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2024-02-01 13:44:19 -0800
committerNoah Misch <noah@leadboat.com>2024-02-01 13:44:22 -0800
commit6d423e9ff95ac2e62655faa97633155d08dfdd64 (patch)
treef681a52c9638712a677716c1d3433fc1e141e82c /src/tutorial/funcs.c
parentb4fb76fb5283dcd76de0e5b9ef8c4588ef8ee619 (diff)
downloadpostgresql-6d423e9ff95ac2e62655faa97633155d08dfdd64.tar.gz
postgresql-6d423e9ff95ac2e62655faa97633155d08dfdd64.zip
Handle interleavings between CREATE DATABASE steps and base backup.
Restoring a base backup taken in the middle of CreateDirAndVersionFile() or write_relmap_file() would lose the function's effects. The symptom was absence of the database directory, PG_VERSION file, or pg_filenode.map. If missing the directory, recovery would fail. Either missing file would not fail recovery but would render the new database unusable. Fix CreateDirAndVersionFile() with the transam/README "action first and then write a WAL entry" strategy. That has a side benefit of moving filesystem mutations out of a critical section, reducing the ways to PANIC. Fix the write_relmap_file() call with a lock acquisition, so it interacts with checkpoints like non-CREATE DATABASE calls do. Back-patch to v15, where commit 9c08aea6a3090a396be334cc58c511edab05776a introduced STRATEGY=WAL_LOG and made it the default. Discussion: https://postgr.es/m/20240130195003.0a.nmisch@google.com
Diffstat (limited to 'src/tutorial/funcs.c')
0 files changed, 0 insertions, 0 deletions