Hi, On 2023-04-25 11:42:43 -0400, Robert Haas wrote: > On Mon, Apr 24, 2023 at 8:03 PM Andres Freund <and...@anarazel.de> wrote: > > What we've discussed somewhere in the past is to always truncate N+1 when > > creating the first page in N. I.e. if we extend into 23456.1, we truncate > > 23456.2 to 0 blocks. As far as I can tell, that'd solve this issue? > > Yeah, although leaving 23456.2 forever unless and until that happens > doesn't sound amazing.
It isn't - but the alternatives aren't great either. It's not that easy to hit this scenario, so I think something along these lines is more palatable than adding a pass through the entire data directory. I think eventually we'll have to make the WAL logging bulletproof enough against this to avoid the risk of it. I think that is possible. I suspect we would need to prevent checkpoints from happening in the wrong moment, if we were to go down that route. I guess that eventually we'll need to polish the infrastructure for determining restartpointsm so that delayChkptFlags doesn't actually prevent checkpoints, just moves the restart to a safe LSN. Although I guess that truncations aren't frequent enough (compared to transaction commits), for that to be required "now". Greetings, Andres Freund