Re: collect_corrupt_items_vacuum.patch

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Noah Misch <noah(at)leadboat(dot)com>, 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-08-14 01:51:39
Message-ID: CAPpHfdtDOCab_RrpkH2Uk6y=BdxS_iPMAOg88dGqzoeUgwZF2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 13, 2024 at 10:15 PM Alexander Korotkov
<aekorotkov(at)gmail(dot)com> wrote:
> On Tue, Aug 13, 2024 at 9:39 PM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
> >
> > This causes an assertion failure when executed in a hot standby server:
> >
> > select * from pg_check_visible('pg_database');
> >
> > TRAP: failed Assert("!RecoveryInProgress()"), File:
> > "../src/backend/storage/ipc/procarray.c", Line: 2710, PID: 1142572
> >
> > GetStrictOldestNonRemovableTransactionId does this:
> >
> > > if (rel == NULL || rel->rd_rel->relisshared || RecoveryInProgress())
> > > {
> > > /* Shared relation: take into account all running xids */
> > > runningTransactions = GetRunningTransactionData();
> > > LWLockRelease(ProcArrayLock);
> > > LWLockRelease(XidGenLock);
> > > return runningTransactions->oldestRunningXid;
> > > }
> >
> > And GetRunningTransactionData() has this:
> >
> > > Assert(!RecoveryInProgress());
> >
> > So it's easy to see that you will hit that assertion.
>
> Oh, thank you!
> I'll fix this and add a test for recovery!

Attached patch fixes the problem and adds the corresponding test. I
would appreciate if you take a look at it.

------
Regards,
Alexander Korotkov
Supabase

Attachment Content-Type Size
v1-0001-Fix-GetStrictOldestNonRemovableTransactionId-on-s.patch application/octet-stream 3.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2024-08-14 02:31:10 RE: Conflict detection and logging in logical replication
Previous Message Andreas Karlsson 2024-08-14 01:12:32 Re: libpq minor TOCTOU violation