Re: New IndexAM API controlling index vacuum strategies
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Andres Freund <andres@anarazel.de>, PostgreSQL-development <pgsql-hackers@postgresql.org>,
Noah Misch <noah@leadboat.com>, Matthias van de Meent <boekewurm+postgres@gmail.com>
Date: 2021-04-05T22:39:10Z
Lists: pgsql-hackers
On Mon, Apr 5, 2021 at 4:30 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > Did you try the change around parallel_process_one_index() that I > suggested in the previous reply[1]? If we don't change the logic, we > need to update the above comment. Previously, we update stats[idx] in > vacuum_one_index() (renamed to parallel_process_one_index()) but with > your patch, where we update it is its caller. I don't know how I missed it the first time. I agree that it is a lot better that way. I did it that way in the version of the patch that I pushed just now. Thanks! Do you think that it's okay that we rely on the propagation of global state to parallel workers on Postgres 13? Don't we need something like my fixup commit 49f49def on Postgres 13 as well? At least for the EXEC_BACKEND case, I think. > We removed two Assert(!IsParallelWorker()) at two places. It seems to > me that those assertions are still valid. Do we really need to remove > them? I have restored the assertions in what became the final version. > 0004 patch: > > src/backend/access/heap/heapam.c:638: trailing whitespace. Will fix. > --- > 0005 patch: > > + * Caller is expected to call here before and after vacuuming each index in > + * the case of two-pass VACUUM, or every BYPASS_EMERGENCY_MIN_PAGES blocks in > + * the case of no-indexes/one-pass VACUUM. > > I think it should be "every VACUUM_FSM_EVERY_PAGES blocks" instead of > "every BYPASS_EMERGENCY_MIN_PAGES blocks". Will fix. > +#define BYPASS_EMERGENCY_MIN_PAGES \ > + ((BlockNumber) (((uint64) 4 * 1024 * 1024 * 1024) / BLCKSZ)) > + > > I think we need a description for BYPASS_EMERGENCY_MIN_PAGES. I agree - will fix. > allindexes can be false even if we process all indexes, which is fine > with me because setting allindexes = false disables the subsequent > heap vacuuming. I think it's appropriate behavior in emergency cases. > In that sense, can we do should_speedup_failsafe() check also after > parallel index vacuuming? And we can also check it at the beginning of > lazy vacuum. Those both seem like good ideas. Especially the one about checking right at the start. Now that the patch makes the emergency mechanism not apply a delay (not just skip index vacuuming), having a precheck at the very start makes a lot of sense. This also makes VACUUM hurry in the case where there was a dangerously slow VACUUM that happened to not be aggressive. Such a VACUUM will use the emergency mechanism but won't advance relfrozenxid, because we have to rely on the autovacuum launcher launching an anti-wraparound/aggressive autovacuum immediately afterwards. We want that second anti-wraparound VACUUM to hurry from the very start of lazy_scan_heap(). -- Peter Geoghegan
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Don't truncate heap when VACUUM's failsafe is in effect.
- 60f1f09ff443 14.0 landed
-
Teach VACUUM to bypass unnecessary index vacuuming.
- 5100010ee4d5 14.0 landed
-
Add wraparound failsafe to VACUUM.
- 1e55e7d1755c 14.0 landed
-
Truncate line pointer array during VACUUM.
- 3c3b8a4b2689 14.0 landed
-
Remove tupgone special case from vacuumlazy.c.
- 8523492d4e34 14.0 landed
-
Refactor lazy_scan_heap() loop.
- 7ab96cf6b312 14.0 landed
-
Propagate parallel VACUUM's buffer access strategy.
- 49f49defe7c0 14.0 cited
-
Simplify state managed by VACUUM.
- b4af70cb2103 14.0 landed
-
Notice that heap page has dead items during VACUUM.
- 0ea71c93a06d 14.0 landed
-
Adjust lazy_scan_heap() accounting comments.
- 7cde6b13a9b6 14.0 cited
-
Use full 64-bit XID for checking if a deleted GiST page is old enough.
- 6655a7299d83 13.0 cited
-
Fix some problems with VACUUM (INDEX_CLEANUP FALSE).
- dd6959798885 12.0 cited