On Mon, 2024-02-12 at 12:18 -0800, Andres Freund wrote: > + upto = Min(startptr + count, LogwrtResult.Write); > + nbytes = upto - startptr; > > Shouldn't it pretty much be a bug to ever encounter this?
In the current code it's impossible, though Bharath hinted at an extension which could reach that path. What I committed was a bit of a compromise -- earlier versions of the patch supported reading right up to the Insert pointer (which requires a call to WaitXLogInsertionsToFinish()). I wasn't ready to commit that code without seeing a more about how that would be used, but I thought it was reasonable to have some simple code in there to allow reading up to the Write pointer. It seems closer to the structure that we will ultimately need to replicate unflushed data, right? Regards, Jeff Davis [1] https://www.postgresql.org/message-id/calj2acw65mqn6ukv57sqdtmzajgd1n_adqtdgy+gmdqu6v6...@mail.gmail.com