From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
---|---|
To: | Michail Nikolaev <michail(dot)nikolaev(at)gmail(dot)com> |
Cc: | "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM |
Date: | 2020-03-28 01:45:18 |
Message-ID: | CAH2-WzmqK24dgm16kS+f_udFcZoxA7gUuibGm8u=_c50rrU95Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Mar 27, 2020 at 8:58 AM Michail Nikolaev
<michail(dot)nikolaev(at)gmail(dot)com> wrote:
> I have spent some time trying to find any possible race condition
> between btree_xlog_split and _bt_walk_left… But I can’t find any.
> Also, I have tried to cause any issue by putting pg_sleep put into
> btree_xlog_split (between releasing and taking of locks) but without
> any luck.
I pushed a commit that tries to clear up some of the details around
how locking works during page splits. See commit 9945ad6e.
> I agree it is better to keep the same locking logic for primary and
> standby in general. But it is a possible scope of another patch.
It seems useful, but only up to a point. We don't need to hold locks
across related atomic operations (i.e. across each phase of a page
split or page deletion). In particular, the lock coupling across page
levels that we perform on the primary when ascending the tree
following a page split doesn't need to occur on standbys. I added
something about this to the nbtree README in commit 9f83468b353.
I'm not surprised that you didn't find any problems in
btree_xlog_split(). It is already conservative about locking the
sibling/child pages. It could hardly be more conservative (though see
the code and comments at the end of btree_xlog_split(), which mention
locking and backwards scans directly).
--
Peter Geoghegan
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2020-03-28 01:52:26 | Re: pgbench - refactor init functions with buffers |
Previous Message | James Coleman | 2020-03-28 01:36:55 | Re: [PATCH] Incremental sort (was: PoC: Partial sort) |