tests: Make neon_xlogflush() flush all WAL, if you omit the LSN arg (#8215)

This makes it much more convenient to use in the common case that you
want to flush all the WAL. (Passing pg_current_wal_insert_lsn() as the
argument doesn't work for the same reasons as explained in the comments:
we need to be back off to the beginning of a page if the previous record
ended at page boundary.)

I plan to use this to fix the issue that Arseny Sher called out at
https://github.com/neondatabase/neon/pull/7288#discussion_r1660063852
This commit is contained in:
Heikki Linnakangas
2024-07-01 18:55:18 +03:00
committed by GitHub
parent 9c32604aa9
commit 0789160ffa

View File

@@ -469,9 +469,9 @@ neon_xlogflush(PG_FUNCTION_ARGS)
* The LSN returned by GetXLogInsertRecPtr() is the position where the
* next inserted record would begin. If the last record ended just at
* the page boundary, the next record will begin after the page header
* on the next page, and that's what GetXLogInsertRecPtr().returns,
* but the page header has not been written yet. If we tried to flush
* it, XLogFlush() would throw an error:
* on the next page, but the next page's page header has not been
* written yet. If we tried to flush it, XLogFlush() would throw an
* error:
*
* ERROR : xlog flush request %X/%X is not satisfied --- flushed only to %X/%X
*