Re: [PATCH] Btree BackwardScan race condition on Standby during VACUUM

Michail Nikolaev <michail.nikolaev@gmail.com>

From: Michail Nikolaev <michail.nikolaev@gmail.com>
To: "Andrey M. Borodin" <x4mmm@yandex-team.ru>
Cc: Peter Geoghegan <pg@bowt.ie>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2020-03-27T15:58:38Z
Lists: pgsql-hackers
Hello.

>  Probably, patch in this thread should fix this in btree_xlog_split() too?

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 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.

Thanks,
Michail.



Commits

  1. Fix replica backward scan race condition.

  2. Justify nbtree page split locking in code comment.

  3. Remove unneeded "pin scan" nbtree VACUUM code.

  4. Compute XID horizon for page level index vacuum on primary.

  5. Make heap TID a tiebreaker nbtree index column.