Re: False "pg_serial": apparent wraparound” in logs

2023-10-17 Thread Imseih (AWS), Sami
> So, I've spent more time on that and applied the simplification today, > doing as you have suggested to use the head page rather than the tail > page when the tail XID is ahead of the head XID, but without disabling > the whole. I've simplified a bit the code and the comments, though, > while on

Re: False "pg_serial": apparent wraparound” in logs

2023-10-16 Thread Michael Paquier
On Mon, Oct 16, 2023 at 04:58:31PM +0900, Michael Paquier wrote: > On Sat, Oct 14, 2023 at 07:29:54PM +, Imseih (AWS), Sami wrote: >> After looking at this a bit more, I don't think the previous rev is correct. >> We should not fall through to the " The SLRU is no longer needed." Which >> also

Re: False "pg_serial": apparent wraparound” in logs

2023-10-16 Thread Michael Paquier
On Sat, Oct 14, 2023 at 07:29:54PM +, Imseih (AWS), Sami wrote: >> Anyway, it looks like you're right, we don't really need the SLRU once >> the tail is ahead of the tail because the SLRU has wrapped around due >> to the effect of transactions aging out, so making the truncation a >> bit smarte

Re: False "pg_serial": apparent wraparound” in logs

2023-10-14 Thread Imseih (AWS), Sami
Sorry for the delay in response. > Back then, we were pretty much OK with the amount of space that could > be wasted even in this case. Actually, how much space are we talking > about here when a failed truncation happens? It is a transient waste in space as it will eventually clean up. > As th

Re: False "pg_serial": apparent wraparound” in logs

2023-10-11 Thread Michael Paquier
On Thu, Oct 05, 2023 at 11:28:02PM +, Imseih (AWS), Sami wrote: > I spent sometime studying this and it appears to be a good approach. > > Passing the cutoff page as headPage (SLRU not needed code path ) instead of > the tailPage to > SimpleLruTruncate is already being done when the tailXid

Re: False "pg_serial": apparent wraparound” in logs

2023-10-10 Thread Michael Paquier
On Thu, Oct 05, 2023 at 11:28:02PM +, Imseih (AWS), Sami wrote: > I spent sometime studying this and it appears to be a good approach. > > Passing the cutoff page as headPage (SLRU not needed code path ) instead of > the tailPage to > SimpleLruTruncate is already being done when the tailXid

Re: False "pg_serial": apparent wraparound” in logs

2023-10-05 Thread Imseih (AWS), Sami
Correct a typo in my last message: Instead of: “ I added an additional condition to make sure that the tailPage proceeds the headPage as well. “ It should be: “ I added an additional condition to make sure that the tailPage precedes the headPage as well. ” Regards, Sami > On Oct 5, 2023, a

Re: False "pg_serial": apparent wraparound” in logs

2023-10-05 Thread Imseih (AWS), Sami
> I think the smallest fix here would be to change CheckPointPredicate() > so that if tailPage > headPage, pass headPage to SimpleLruTruncate() > instead of tailPage. Or perhaps it should go into the "The SLRU is no > longer needed" codepath in that case. If tailPage > headPage, the SLRU > isn't ne

Re: False "pg_serial": apparent wraparound” in logs

2023-10-03 Thread Michael Paquier
On Sun, Oct 01, 2023 at 09:43:21PM +0300, Heikki Linnakangas wrote: > I think the smallest fix here would be to change CheckPointPredicate() so > that if tailPage > headPage, pass headPage to SimpleLruTruncate() instead of > tailPage. Or perhaps it should go into the "The SLRU is no longer needed"

Re: False "pg_serial": apparent wraparound” in logs

2023-10-01 Thread Heikki Linnakangas
On 30/09/2023 02:16, Imseih (AWS), Sami wrote: The initial idea was to advance the latest_page_number during SerialSetActiveSerXmin, but the initial approach is obviously wrong. That approach at high level could work, a When SerialSetActiveSerXmin is called for a new active serializable xmin,

Re: False "pg_serial": apparent wraparound” in logs

2023-09-29 Thread Imseih (AWS), Sami
> I don't really understand what exactly the problem is, or how this fixes > it. But this doesn't feel right: As the repro show, false reports of "pg_serial": apparent wraparound” messages are possible. For a very busy system which checkpoints frequently and heavy usage of serializable isolation,

Re: False "pg_serial": apparent wraparound” in logs

2023-09-26 Thread Heikki Linnakangas
On 25/08/2023 07:29, Imseih (AWS), Sami wrote: diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c index 1af41213b4..7e7be3b885 100644 --- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -992,6 +992,13 @@ SerialSetActiveSe

Re: False "pg_serial": apparent wraparound” in logs

2023-08-24 Thread Imseih (AWS), Sami
Attached a patch with a new CF entry: https://commitfest.postgresql.org/44/4516/ Regards, Sami Imseih Amazon Web Services (AWS) 0001-v1-Fix-false-report-of-wraparound-in-pg_serial.patch Description: 0001-v1-Fix-false-report-of-wraparound-in-pg_serial.patch

Re: False "pg_serial": apparent wraparound” in logs

2023-08-23 Thread Imseih (AWS), Sami
Hi, I dug a bit into this and what looks to be happening is the comparison of the page containing the latest cutoff xid could falsely be reported as in the future of the last page number because the latest page number of the Serial slru is only set when the page is initialized [1]. So under the c