Files
neon/pageserver
Christian Schwarz 1684bf36c8 tenant load: make tempfile/tempdir cleanup logic bail out if it fails
Before this patch, when loading a tenant, we'd iterate the timeline directory
to figure out which timelines the tenant has, and also remove temporary
entries in the timelines directory that are created during timeline
creation.

When we would fail to clean up temporary entries, we'd log an error but
continue.
This error-ignoring behavior forces all code that runs later, e.g.,
timeline creation code, to idempotently re-try those cleanups.

It's much cleaner to remove such temp entries once during startup,
then expect them to be absent later.
Why is that? Because
1. it de-clutters the not-startup code
2. we can use O_EXCL when we create the uninit marker, giving
   us extra robustness in depth that we're not creating the same
   timeline concurrently
3. same exclusive-op argument for when we create the initdb dir

This patch refactors the timeline loading code to a fix-point
iteration loop that does the cleanups.

If a cleanup fails, we bail out.

Once we've reached the fixpoint (no temp stuff left), we assume
each remaining entry is a timeline dir, parse it into a TimelineId,
and continue the loading as usual.
2023-06-07 20:02:45 +02:00
..