pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Dmitry Koval <d.koval@postgrespro.ru>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: collect_corrupt_items_vacuum.patch
Date: Sun, 30 Jun 2024 16:18:16 -0700
Message-ID: <20240630231816.bf.nmisch@google.com> (raw)
In-Reply-To: <CAPpHfdvN1wsFsPkA8O_DuY3=cOWw0F9nBPi4biyC1+juYQpqdw@mail.gmail.com>
References: <add210d6-0278-d00e-ebe5-4e5e42e08ecc@gmail.com>
	<CAPpHfdsVVAdaGAJgoOBAJ+6EGaCdsUi=wbgQAc3+8X_qtUr=Qg@mail.gmail.com>
	<8e6bd629-fa69-371c-966d-aaf071aafeb8@gmail.com>
	<CAPpHfdt8Rj_LtG8aWKNzeRejutrN-zt6fKQGuXYyAE7-zNVHbg@mail.gmail.com>
	<918b9dc0-9af0-a62a-19cc-cb858b163299@gmail.com>
	<dc247df2-34ee-4d19-8294-86d1f391b57f@postgrespro.ru>
	<CAPpHfdt635ay8KpZ_drMRHSFs=a17RYEh3uqx2BnW-p8S6oMQQ@mail.gmail.com>
	<ed7d3fd8-a5c4-400f-be31-4a8da8f0780e@postgrespro.ru>
	<CAPpHfdviiR1oG9Y7O4i1d8cY2gj8o1g-zM+Y8pR+Y=LVNvcqXw@mail.gmail.com>
	<CAPpHfdvN1wsFsPkA8O_DuY3=cOWw0F9nBPi4biyC1+juYQpqdw@mail.gmail.com>

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.





view thread (27+ messages)  latest in thread

Message-ID: <20240630231816.bf.nmisch@google.com>
Permalink:  ../20240630231816.bf.nmisch@google.com/
Also on:    postgresql.org/message-id/20240630231816.bf.nmisch@google.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: noah@leadboat.com, aekorotkov@gmail.com, d.koval@postgrespro.ru
  Subject: Re: collect_corrupt_items_vacuum.patch
  In-Reply-To: <20240630231816.bf.nmisch@google.com>
  References: <add210d6-0278-d00e-ebe5-4e5e42e08ecc@gmail.com> <CAPpHfdsVVAdaGAJgoOBAJ+6EGaCdsUi=wbgQAc3+8X_qtUr=Qg@mail.gmail.com> <8e6bd629-fa69-371c-966d-aaf071aafeb8@gmail.com> <CAPpHfdt8Rj_LtG8aWKNzeRejutrN-zt6fKQGuXYyAE7-zNVHbg@mail.gmail.com> <918b9dc0-9af0-a62a-19cc-cb858b163299@gmail.com> <dc247df2-34ee-4d19-8294-86d1f391b57f@postgrespro.ru> <CAPpHfdt635ay8KpZ_drMRHSFs=a17RYEh3uqx2BnW-p8S6oMQQ@mail.gmail.com> <ed7d3fd8-a5c4-400f-be31-4a8da8f0780e@postgrespro.ru> <CAPpHfdviiR1oG9Y7O4i1d8cY2gj8o1g-zM+Y8pR+Y=LVNvcqXw@mail.gmail.com> <CAPpHfdvN1wsFsPkA8O_DuY3=cOWw0F9nBPi4biyC1+juYQpqdw@mail.gmail.com> <20240630231816.bf.nmisch@google.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox