]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Ensure snapshot is registered within ScanPgRelation().
authorAndres Freund <andres@anarazel.de>
Sat, 28 Mar 2020 18:52:11 +0000 (11:52 -0700)
committerAndres Freund <andres@anarazel.de>
Sat, 28 Mar 2020 19:05:05 +0000 (12:05 -0700)
commit820f21a93f0bb92dde9fee5dbc3c68fd9be06579
treece47a0d093a06839e984e91ec1ceab62a7f93795
parent4bfacc5a441101614744a66322f12f50a0131b65
Ensure snapshot is registered within ScanPgRelation().

In 9.4 I added support to use a historical snapshot in
ScanPgRelation(), while adding logical decoding. Unfortunately a
conflict with the concurrent removal of SnapshotNow was incorrectly
resolved, leading to an unregistered snapshot being used.

It is not correct to use an unregistered (or non-active) snapshot for
anything non-trivial, because catalog invalidations can cause the
snapshot to be invalidated.

Luckily it seems unlikely to actively cause problems in practice, as
ScanPgRelation() requires that we already have a lock on the relation,
we only look for a single row, and we don't appear to rely on the
result's tid to be correct. It however is clearly wrong and potential
negative consequences would likely be hard to find. So it seems worth
backpatching the fix, even without a concrete hazard.

Discussion: https://postgr.es/m/20200229052459.wzhqnbhrriezg4v2@alap3.anarazel.de
Backpatch: 9.5-
src/backend/utils/cache/relcache.c