Re: Amcheck: do rightlink verification with lock coupling

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Amcheck: do rightlink verification with lock coupling
Date: 2020-08-06 16:38:56
Message-ID: CAH2-Wzm3=SLwu5=z8qG6UBpCemZW3dUNXWbX-cpXCgb=y3OhZw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 5, 2020 at 9:50 PM Andrey M. Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
> Sounds great! Thanks!

I'm afraid that there is another problem, this time with
btree_xlog_split(). It's possible to get false positives when running
the new test continually on a standby. You can see this by running
verification on a standby continually, while the primary runs with a
workload that gets many page splits.

It's easy to see if you apply this patch:

--- a/src/backend/access/nbtree/nbtxlog.c
+++ b/src/backend/access/nbtree/nbtxlog.c
@@ -435,6 +435,9 @@ btree_xlog_split(bool newitemonleft,
XLogReaderState *record)
UnlockReleaseBuffer(lbuf);
UnlockReleaseBuffer(rbuf);

+ /* trick */
+ pg_usleep(10 * 1000L);
+

The only thing that we can do is adjust the locking in
btree_xlog_split() to match the primary (kind of like commit 9a9db08a,
except with page splits instead of page deletion). Attached is a
revised version of the patch, along with the changes that we'd need to
REDO to make the amcheck patch really work.

I'm not sure if this change to the REDO routine is worth the overhead
or trouble, though. I have to think about it some more.

BTW, the first patch in the series now has a new check for page
deletion -- that was missing from v4.

--
Peter Geoghegan

Attachment Content-Type Size
v5-0002-Adjust-btree_xlog_split-locking.patch application/octet-stream 1.6 KB
v5-0001-Add-amcheck-sibling-link-checks.patch application/octet-stream 7.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2020-08-06 16:43:17 Re: new heapcheck contrib module
Previous Message Andy Fan 2020-08-06 15:57:08 Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)