pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Karina Litskevich <litskevichkarina@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: 王海洋 <wanghaiyang.001@bytedance.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: [PATCH] BUG FIX: inconsistent page found in BRIN_REGULAR_PAGE
Date: Fri, 23 Dec 2022 16:54:56 +0300
Message-ID: <a5559c95-52c3-5eea-cd63-9b4f1c70ff96@gmail.com> (raw)
In-Reply-To: <20220805131731.jhtscj2tonbglxz6@alvherre.pgsql>

Hi Alvaro!

Is there any special reason to read WAL records until the last inserted 
record?

+my $end_lsn = $whiskey->lsn('insert');
+
+my ($ret, $out, $err) = $whiskey->psql(
+    'postgres', qq{
+    select count(*) from pg_get_wal_records_info('$start_lsn', '$end_lsn')
+    where resource_manager = 'BRIN' AND
+    record_type ILIKE '%revmap%'
+    });
+cmp_ok($out, '>=', 1);

It seems that in some rare situations on slower machines this test can 
fail. If
any background process inserts a WAL record before lsn('insert') and 
this record
isn't flushed before pg_get_wal_records_info('$start_lsn', '$end_lsn'),
pg_get_wal_records_info('$start_lsn', '$end_lsn') ends with ERROR 
"cannot accept
future end LSN" as it works only if record with end LSN is inserted.

I attached two patches with two ways of fixing this minor issue.

Best regards,
Karina Litskevich
Postgres Professional: http://postgrespro.com/

Attachments: download all (2 files, .tar.gz)

v1-0001-prevent-test-from-failing-on-slower-machines.patch (text/x-patch, 772B) download From 75a56e7bd5bc718481099bda3668855f9c200e98 Mon Sep 17 00:00:00 2001 From: Karina Litskevich <litskevichkarina@gmail.com> Date: Fri, 23 Dec 2022 16:35:23 +0300 Subject: [PATCH v1] prevent test from failing on slower machines --- src/test/modules/brin/t/02_wal_consistency.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/modules/brin/t/02_wal_consistency.pl b/src/test/modules/brin/t/02_wal_consistency.pl index f7dbb0d014..cbc269b1df 100644 --- a/src/test/modules/brin/t/02_wal_consistency.pl +++ b/src/test/modules/brin/t/02_wal_consistency.pl @@ -60,7 +60,7 @@ begin end $$; }); -my $end_lsn = $whiskey->lsn('insert'); +my $end_lsn = $whiskey->lsn('flush'); my ($ret, $out, $err) = $whiskey->psql( 'postgres', qq{ -- 2.25.1
v2-0001-prevent-test-from-failing-on-slower-machines.patch (text/x-patch, 962B) download From e4aff210c95ed548f4c54f9314c4b58580663a74 Mon Sep 17 00:00:00 2001 From: Karina Litskevich <litskevichkarina@gmail.com> Date: Fri, 23 Dec 2022 16:41:48 +0300 Subject: [PATCH v2] prevent test from failing on slower machines --- src/test/modules/brin/t/02_wal_consistency.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/modules/brin/t/02_wal_consistency.pl b/src/test/modules/brin/t/02_wal_consistency.pl index f7dbb0d014..a7aeadf4bb 100644 --- a/src/test/modules/brin/t/02_wal_consistency.pl +++ b/src/test/modules/brin/t/02_wal_consistency.pl @@ -60,11 +60,10 @@ begin end $$; }); -my $end_lsn = $whiskey->lsn('insert'); my ($ret, $out, $err) = $whiskey->psql( 'postgres', qq{ - select count(*) from pg_get_wal_records_info('$start_lsn', '$end_lsn') + select count(*) from pg_get_wal_records_info_till_end_of_wal('$start_lsn') where resource_manager = 'BRIN' AND record_type ILIKE '%revmap%' }); -- 2.25.1

view thread (10+ messages)  latest in thread

Message-ID: <a5559c95-52c3-5eea-cd63-9b4f1c70ff96@gmail.com>
Permalink:  ../a5559c95-52c3-5eea-cd63-9b4f1c70ff96@gmail.com/
Also on:    postgresql.org/message-id/a5559c95-52c3-5eea-cd63-9b4f1c70ff96@gmail.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: litskevichkarina@gmail.com, alvherre@alvh.no-ip.org, wanghaiyang.001@bytedance.com, horikyota.ntt@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: [PATCH] BUG FIX: inconsistent page found in BRIN_REGULAR_PAGE
  In-Reply-To: <a5559c95-52c3-5eea-cd63-9b4f1c70ff96@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox