Re: Assertion failure when autovacuum drops orphan temp indexes.
Stepan Neretin <sndcppg@gmail.com>
From: Stepan Neretin <sndcppg@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-10-26T19:12:48Z
Lists: pgsql-hackers
> 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.
Yes, I agree! I have found the same solution. I attempted to write Perl
tests to verify the patch fix, but the autovacuum process is not triggered
in my tests. Could you please assist me?
```
use strict;
use warnings;
use threads;
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::RecursiveCopy;
use PostgreSQL::Test::Utils;
use Test::More;
use Data::Dumper;
my $node = PostgreSQL::Test::Cluster->new('main');
# Create a data directory with initdb
$node->init;
$node->append_conf(
'postgresql.conf', qq[
autovacuum = on
track_counts=on
autovacuum_naptime = 1s
autovacuum_max_workers = 1
autovacuum_vacuum_threshold = 1
]);
# Start the PostgreSQL server
$node->start;
my $psql1 = $node->interactive_psql('postgres');
$psql1->query("create temp table test (a int primary key);");
$node->stop('immediate');
$node->start();
sleep(5);
$node->restart();
ok(1);
done_testing();
```
Best Regards, Stepan Neretin!
Commits
-
Ensure we have a snapshot when updating pg_index in index_drop().
- 70b9adb98eab 18.0 landed
-
Ensure we have a snapshot when updating pg_index entries.
- b52adbad4674 18.0 cited