pg_visibility's pg_check_visible() yields false positive when working in parallel with autovacuum

From: Daniel Shelepanov <deniel1495(at)mail(dot)ru>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: pg_visibility's pg_check_visible() yields false positive when working in parallel with autovacuum
Date: 2022-02-17 21:09:48
Message-ID: cfcca574-6967-c5ab-7dc3-2c82b6723b99@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello everyone!

I've been examining a floating bug in pg_visibility. To reproduce it,
you have to:

1) apply a patch to pg_visibility's tests (you can find it attached)

2) run test-icx.sh (attached) from the root of the postgresql's source tree

pg_vis_clean.patch adds one additional test to pg_visibility test suite
and normally it is expected to pass. However, when (I assume so) it
happens to run in parallel with autovacuum, the test is failed.
test-icx.sh runs several parallel installchecks on contrib/pg_visibility
tests and there is a chance that some of them will catch this error.

This is the set-up for a bug reproduction:

*create table vacuum_test as select 42 i;**
**vacuum (disable_page_skipping) vacuum_test;**
*

This is the actual test result:

*diff -U3
/tmp/icx/ic01-1/contrib/pg_visibility/expected/pg_visibility.out
/tmp/icx/ic01-1/contrib/pg_visibility/results/pg_visibility.out**
**--- /tmp/icx/ic01-1/contrib/pg_visibility/expected/pg_visibility.out
2022-02-17 23:46:26.005500630 +0300**
**+++ /tmp/icx/ic01-1/contrib/pg_visibility/results/pg_visibility.out
2022-02-17 23:47:36.066838872 +0300**
**@@ -247,7 +247,7 @@**
** select count(*) > 0 from pg_check_visible('vacuum_test');**
**  ?column?**
** ----------**
**- f**
**+ t**
** (1 row)**
**
** -- cleanup*

The thing is that the underlying file is one page long which should
contain the only all-visible tuple and pg_check_visible should return
nothing. Is this a real bug or do I miss something? Thank you in advance
for the response

P. S.: SELECT version(); result: *PostgreSQL 14.2 on
x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04)
9.3.0, 64-bit*

Attachment Content-Type Size
test-icx.sh application/x-shellscript 15.9 KB
pg_vis_clean.patch text/x-patch 1.5 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tomas Vondra 2022-02-17 22:09:56 Re: Optimizer picking a poor plan for Serializable Transaction Isolation
Previous Message Tyler Rockwood 2022-02-17 18:55:14 Optimizer picking a poor plan for Serializable Transaction Isolation