Re: BUG #18146: Rows reappearing in Tables after Auto-Vacuum Failure in PostgreSQL on Windows

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Alexander Lakhin <exclusion(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, rootcause000(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18146: Rows reappearing in Tables after Auto-Vacuum Failure in PostgreSQL on Windows
Date: 2024-12-24 05:50:57
Message-ID: Z2pLwQGNaKq2_JTk@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Dec 21, 2024 at 12:15:56PM +1300, Thomas Munro wrote:
> Here. Better/tidier ideas welcome.

Indeed, the state of back-branches is incorrect this way. I don't
know of any out-of-core callers of smgrtruncate(), but well, the world
is a wide place.

extern void smgrtruncate(SMgrRelation reln, ForkNumber *forknum, int nforks,
- BlockNumber *old_nblocks,
BlockNumber *nblocks);
+extern void smgrtruncate2(SMgrRelation reln, ForkNumber *forknum, int nforks,
+ BlockNumber *old_nblocks,
+ BlockNumber *nblocks);

Please don't rely on my naming sense, still I'm OK with what you are
using here.

Some inconsistent notes in the code with smgrtruncate2() in place:
src/backend/access/heap/visibilitymap.c:
* otherwise the caller is responsible for calling smgrtruncate()
src/backend/catalog/storage.c:
* Second, the call to smgrtruncate() below will in turn call
src/backend/access/heap/vacuumlazy.c:
* processed the smgr invalidation that smgrtruncate sent out ... but

That's not really critical, so leaving them as they are is equally OK
for me. Looks good to me, otherwise.
--
Michael

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrei Lepikhov 2024-12-24 09:05:38 Re: BUG #18751: Sub-optimal UNION ALL plan
Previous Message 高偉鈞 2024-12-24 05:43:00 Corrupt index lead to skipped autovacuum