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

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: "Imseih (AWS), Sami" <simseih(at)amazon(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: False "pg_serial": apparent wraparound” in logs
Date: 2023-09-26 16:29:44
Message-ID: ba09455c-a8ad-1eca-c0cf-cc96fc4aa387@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 @@ SerialSetActiveSerXmin(TransactionId xid)
>
> serialControl->tailXid = xid;
>
> + /*
> + * If the SLRU is being used, set the latest page number to
> + * the current tail xid.
> + */
> + if (serialControl->headPage > 0)
> + SerialSlruCtl->shared->latest_page_number = SerialPage(serialControl->tailXid);
> +
> LWLockRelease(SerialSLRULock);
> }

I don't really understand what exactly the problem is, or how this fixes
it. But this doesn't feel right:

Firstly, isn't headPage == 0 also a valid value? We initialize headPage
to -1 when it's not in use.

Secondly, shouldn't we set it to the page corresponding to headXid
rather than tailXid.

Thirdly, I don't think this code should have any business setting
latest_page_number directly. latest_page_number is set in
SimpleLruZeroPage(). Are we missing a call to SimpleLruZeroPage() somewhere?

--
Heikki Linnakangas
Neon (https://neon.tech)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2023-09-26 16:45:05 Re: Index AmInsert Parameter Confused?
Previous Message Benoit Lobréau 2023-09-26 16:21:04 Re: Questions about the new subscription parameter: password_required