pgsql: Ensure snapshot is registered within ScanPgRelation().

Поиск
Список
Период
Сортировка
От Andres Freund
Тема pgsql: Ensure snapshot is registered within ScanPgRelation().
Дата
Msg-id E1jIH9U-0002i6-S1@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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-

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/42750b08d946e2a5048454d7b4e127f0e1df3c65

Modified Files
--------------
src/backend/utils/cache/relcache.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Jeff Davis
Дата:
Сообщение: pgsql: Fix costing for disk-based hash aggregation.
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Ensure snapshot is registered within ScanPgRelation().