Closed mconst closed 4 days ago
Okay, I think this is ready. Sorry for the delay! The first two commits are fixes for preexisting region-tracker bugs I ran into; the last one is the main change.
Ah nice, ya I like this! I think this conflicted with your other PR that I just merged. Can you rebase and I'll merge this one too?
Oh yeah, sorry about that! Here's the rebased version.
When writing the allocator state table, it's better not to include the region tracker page as one of the allocated pages. Instead, we should allocate the region tracker page during quick-repair after loading the rest of the allocator state, exactly like we do for full repair.
This avoids an unlikely corruption that could happen for databases larger than 4 TB, if we crash on shutdown after writing out a new region tracker page number but before clearing the recovery_required bit. It also means that in the future, when we drop support for the old allocator state format, we'll be able to get rid of the region tracker page entirely instead of having to keep around some of the allocation code for compatibility.