Re: collect_corrupt_items_vacuum.patch
Alexander Korotkov <aekorotkov@gmail.com>
From: Alexander Korotkov <aekorotkov@gmail.com>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Noah Misch <noah@leadboat.com>, Dmitry Koval <d.koval@postgrespro.ru>, pgsql-hackers@lists.postgresql.org
Date: 2024-08-14T01:51:39Z
Lists: pgsql-hackers
Attachments
- v1-0001-Fix-GetStrictOldestNonRemovableTransactionId-on-s.patch (application/octet-stream) patch v1-0001
On Tue, Aug 13, 2024 at 10:15 PM Alexander Korotkov
<aekorotkov@gmail.com> wrote:
> On Tue, Aug 13, 2024 at 9:39 PM Heikki Linnakangas <hlinnaka@iki.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
Commits
-
Fix GetStrictOldestNonRemovableTransactionId() on standby
- e2ed7e32271a 18.0 landed
-
Fix typo in GetRunningTransactionData()
- 619f76cce11d 17.0 landed
- 6c1af5482e69 18.0 landed
-
Optimize memory access in GetRunningTransactionData()
- 6897f0ec0245 18.0 landed
-
Fix false reports in pg_visibility
- e85662df44ff 17.0 landed
-
Fix indentation
- 4d0cf0b05def 17.0 cited