[PATCH] BUG FIX: inconsistent page found in BRIN_REGULAR_PAGE

From: Karina Litskevich <litskevichkarina(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: 王海洋 <wanghaiyang(dot)001(at)bytedance(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: [PATCH] BUG FIX: inconsistent page found in BRIN_REGULAR_PAGE
Date: 2022-12-23 13:54:56
Message-ID: a5559c95-52c3-5eea-cd63-9b4f1c70ff96@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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/

Attachment Content-Type Size
v1-0001-prevent-test-from-failing-on-slower-machines.patch text/x-patch 772 bytes
v2-0001-prevent-test-from-failing-on-slower-machines.patch text/x-patch 962 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2022-12-23 16:35:09 Re: [PATCH] BUG FIX: inconsistent page found in BRIN_REGULAR_PAGE
Previous Message Tom Lane 2022-12-23 04:38:15 Re: BUG #17728: When jdbc calls the stored procedure, portal->stmts in FillPortalStore is null, causing a processing