Re: pg14b1 stuck in lazy_scan_prune/heap_page_prune of pg_statistic

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Matthias van de Meent <boekewurm+postgres@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, Andres Freund <andres@anarazel.de>, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2021-06-09T00:18:18Z
Lists: pgsql-hackers
On Tue, Jun 08, 2021 at 02:38:37PM -0700, Peter Geoghegan wrote:
> On Tue, Jun 8, 2021 at 2:23 PM Justin Pryzby <pryzby@telsasoft.com> wrote:
> > I'm not sure what you're suggesting ?  Maybe I should add some NOTICES there.
> 
> Here is one approach that might work: Can you check if the assertion
> added by the attached patch fails very quickly with your test case?

I reproduced the issue on a new/fresh cluster like this:

./postgres -D data -c autovacuum_naptime=1 -c autovacuum_analyze_scale_factor=0.005 -c log_autovacuum_min_duration=-1
psql -h /tmp postgres -c "CREATE TABLE t(i int); INSERT INTO t SELECT generate_series(1,99999); CREATE INDEX ON t(i);"
time while psql -h /tmp postgres -qc 'REINDEX (CONCURRENTLY) INDEX t_i_idx'; do :; done&
time while psql -h /tmp postgres -qc 'ANALYZE pg_attribute'; do :; done&

TRAP: FailedAssertion("restarts == 0", File: "vacuumlazy.c", Line: 1803, PID: 10367)
postgres: autovacuum worker postgres(ExceptionalCondition+0x99)[0x5633f3ad6b09]
postgres: autovacuum worker postgres(+0x1c0a37)[0x5633f36cca37]
postgres: autovacuum worker postgres(heap_vacuum_rel+0xfca)[0x5633f36cf75a]
postgres: autovacuum worker postgres(+0x305fed)[0x5633f3811fed]
postgres: autovacuum worker postgres(vacuum+0x61a)[0x5633f38137ea]
postgres: autovacuum worker postgres(+0x409dd3)[0x5633f3915dd3]
postgres: autovacuum worker postgres(+0x40ae46)[0x5633f3916e46]
postgres: autovacuum worker postgres(AutoVacuumUpdateDelay+0x0)[0x5633f3916f50]
postgres: autovacuum worker postgres(+0x41985b)[0x5633f392585b]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f085c591890]
/lib/x86_64-linux-gnu/libc.so.6(__select+0x17)[0x7f085bafaff7]
postgres: autovacuum worker postgres(+0x419d06)[0x5633f3925d06]
postgres: autovacuum worker postgres(PostmasterMain+0xcbb)[0x5633f39277bb]
postgres: autovacuum worker postgres(main+0x4d4)[0x5633f3660a14]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f085ba05b97]
postgres: autovacuum worker postgres(_start+0x2a)[0x5633f3660aba]
2021-06-08 19:10:36.875 CDT postmaster[13483] LOG:  server process (PID 10367) was terminated by signal 6: Aborted
2021-06-08 19:10:36.875 CDT postmaster[13483] DETAIL:  Failed process was running: autovacuum: VACUUM pg_toast.pg_toast_2619
2021-06-08 19:10:36.875 CDT postmaster[13483] LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
connection to server was lost

real    0m14.477s



Commits

  1. Deduplicate choice of horizon for a relation procarray.c.

  2. Use correct horizon when vacuuming catalog relations.

  3. Truncate line pointer array during VACUUM.

  4. Remove tupgone special case from vacuumlazy.c.

  5. Refactor lazy_scan_heap() loop.

  6. snapshot scalability: Don't compute global horizons while building snapshots.