Re: collect_corrupt_items_vacuum.patch

From: Noah Misch <noah(at)leadboat(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: collect_corrupt_items_vacuum.patch
Date: 2024-06-30 23:18:16
Message-ID: 20240630231816.bf.nmisch@google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 12, 2024 at 02:10:59PM +0200, Alexander Korotkov wrote:
> I'm going to push this if no objections.

Commit e85662d wrote:
> --- a/src/backend/storage/ipc/procarray.c
> +++ b/src/backend/storage/ipc/procarray.c

> @@ -2740,6 +2741,8 @@ GetRunningTransactionData(void)
> */
> for (index = 0; index < arrayP->numProcs; index++)
> {
> + int pgprocno = arrayP->pgprocnos[index];
> + PGPROC *proc = &allProcs[pgprocno];
> TransactionId xid;
>
> /* Fetch xid just once - see GetNewTransactionId */
> @@ -2760,6 +2763,13 @@ GetRunningTransactionData(void)
> if (TransactionIdPrecedes(xid, oldestRunningXid))
> oldestRunningXid = xid;
>
> + /*
> + * Also, update the oldest running xid within the current database.
> + */
> + if (proc->databaseId == MyDatabaseId &&
> + TransactionIdPrecedes(xid, oldestRunningXid))
> + oldestDatabaseRunningXid = xid;

Shouldn't that be s/oldestRunningXid/oldestDatabaseRunningXid/?

While this isn't a hot path, I likely would test TransactionIdPrecedes()
before fetching pgprocno and PGPROC, to reduce wasted cache misses.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2024-06-30 23:34:04 Re: walsender.c comment with no context is hard to understand
Previous Message Jelte Fennema-Nio 2024-06-30 22:38:46 Re: [EXTERNAL] Re: Add non-blocking version of PQcancel