Re: pg14b1 stuck in lazy_scan_prune/heap_page_prune of pg_statistic
Masahiko Sawada <sawada.mshk@gmail.com>
From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>,
Justin Pryzby <pryzby@telsasoft.com>, Peter Geoghegan <pg@bowt.ie>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2021-06-09T02:26:12Z
Lists: pgsql-hackers
On Wed, Jun 9, 2021 at 2:17 AM Andres Freund <andres@anarazel.de> wrote: > > Hi, > > On 2021-06-08 14:27:14 +0200, Matthias van de Meent wrote: > > heap_prune_satisfies_vacuum considers 1 more transaction to be > > unvacuumable, and thus indeed won't vacuum that tuple that > > HeapTupleSatisfiesVacuum does want to be vacuumed. > > > > The new open question is now: Why is > > GlobalVisCatalogRels->maybe_needed < OldestXmin? IIRC > > GLobalVisCatalogRels->maybe_needed is constructed from the same > > ComputeXidHorizonsResult->catalog_oldest_nonremovable which later is > > returned to be used in vacrel->OldestXmin. > > The horizon used by pruning is only updated once per transaction (well, > approximately). What presumably is happening is that the retry loop is > retrying, without updating the horizon, therefore the same thing is > happening over and over again? When we calculated vacrel->OldestXmin in vacuum_set_xid_limits(), vacrel->OldestXmin and GlogalVisCatalogRels->maybe_needed must have been the same value. That is, those were 926025113. After that, vacrel->OldestXmin is not changed throughout lazy vacuum whereas GlobalVisCatalogRels->maybe_needed could be updated (right?). Is there any chance that GlobalVisCatalogRels->maybe_needed goes backward? For example, a case like where when re-calculating catalog_oldest_nonremovable (i.g. updating GlobalVisCatalogRels->maybe_needed) we take a process into account who has an old XID but was ignored last time for some reason (e.g., its statusFlag). Regards, -- Masahiko Sawada EDB: https://www.enterprisedb.com/
Commits
-
Deduplicate choice of horizon for a relation procarray.c.
- 3d0a4636aa4c 14.0 landed
- d9d8aa9bb9aa 15.0 landed
-
Use correct horizon when vacuuming catalog relations.
- 5a1e1d83022b 14.0 landed
-
Truncate line pointer array during VACUUM.
- 3c3b8a4b2689 14.0 cited
-
Remove tupgone special case from vacuumlazy.c.
- 8523492d4e34 14.0 cited
-
Refactor lazy_scan_heap() loop.
- 7ab96cf6b312 14.0 cited
-
snapshot scalability: Don't compute global horizons while building snapshots.
- dc7420c2c927 14.0 cited