Re: Assertion failure when autovacuum drops orphan temp indexes.

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-10-26T16:14:38Z
Lists: pgsql-hackers

Attachments

On Sat, Oct 26, 2024 at 12:43:44AM -0700, Masahiko Sawada wrote:
> I got the following assertion failure from an autovaucum worker:
> 
> 2024-10-26 00:32:03.685 PDT [830672] LOG:  autovacuum: dropping orphan
> temp table "postgres.pg_temp_0.hoge"
> TRAP: failed Assert("HaveRegisteredOrActiveSnapshot()"), File:
> "index.c", Line: 2345, PID: 830672

IMHO the best way to handle this is to just unconditionally push a snapshot
in this code path instead of making assumptions about what callers will do.

-- 
nathan

Commits

  1. Ensure we have a snapshot when updating pg_index in index_drop().

  2. Ensure we have a snapshot when updating pg_index entries.