BUG #18087: pg_visibility: false positives in pg_check_visible

Started by PG Bug reporting formover 2 years ago2 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 18087
Logged by: yajun Hu
Email address: 1026592243@qq.com
PostgreSQL version: 11.21
Operating system: CentOS7 with kernel version 5.10
Description:

hi, community partners.
I found a false positives when use pg_check_visible, I build postgresql
with REL_11_STABLE, run this SQL
select pg_create_logical_replication_slot ('test','pgoutput');
create table t( a int);
insert into t select 1;
insert into t select 1;
insert into t select 1;
vacuum t;
select * from pg_check_visible('t'); -- output ctid, which is false
positives

I analyze this problem, guess in collect_corrupt_items, GetOldestXmin use
rel = NULL
to get alldbs oldestXmin which will influenced by replication slot and other
database
long transaction. But Vacuum get relation's database oldestXmin.

I will put my fix patch behind

Regrads, Yajun Hu

#2huyajun
hu_yajun@qq.com
In reply to: PG Bug reporting form (#1)
Re: BUG #18087: pg_visibility: false positives in pg_check_visible

2023年9月5日 下午9:08,PG Bug reporting form <noreply@postgresql.org> 写道:

The following bug has been logged on the website:

Bug reference: 18087
Logged by: yajun Hu
Email address: 1026592243@qq.com
PostgreSQL version: 11.21
Operating system: CentOS7 with kernel version 5.10
Description:

hi, community partners.
I found a false positives when use pg_check_visible, I build postgresql
with REL_11_STABLE, run this SQL
select pg_create_logical_replication_slot ('test','pgoutput');
create table t( a int);
insert into t select 1;
insert into t select 1;
insert into t select 1;
vacuum t;
select * from pg_check_visible('t'); -- output ctid, which is false
positives

I analyze this problem, guess in collect_corrupt_items, GetOldestXmin use
rel = NULL
to get alldbs oldestXmin which will influenced by replication slot and other
database
long transaction. But Vacuum get relation's database oldestXmin.

I will put my fix patch behind

Regrads, Yajun Hu

Here are my fix patch, thinks.

Attachments:

0001-pg_visibility-Fix-wrong-calculation-of-OldestXmin.patchapplication/octet-stream; name=0001-pg_visibility-Fix-wrong-calculation-of-OldestXmin.patch; x-unix-mode=0644Download+31-5