pgsql: Fix FOR UPDATE NOWAIT on updated tuple chains

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема pgsql: Fix FOR UPDATE NOWAIT on updated tuple chains
Дата
Msg-id E1XMmSU-00072u-VJ@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix FOR UPDATE NOWAIT on updated tuple chains

If SELECT FOR UPDATE NOWAIT tries to lock a tuple that is concurrently
being updated, it might fail to honor its NOWAIT specification and block
instead of raising an error.

Fix by adding a no-wait flag to EvalPlanQualFetch which it can pass down
to heap_lock_tuple; also use it in EvalPlanQualFetch itself to avoid
blocking while waiting for a concurrent transaction.

Authors: Craig Ringer and Thomas Munro, tweaked by Álvaro
http://www.postgresql.org/message-id/51FB6703.9090801@2ndquadrant.com

Per Thomas Munro in the course of his SKIP LOCKED feature submission,
who also provided one of the isolation test specs.

Backpatch to 9.4, because that's as far back as it applies without
conflicts (although the bug goes all the way back).  To that branch also
backpatch Thomas Munro's new NOWAIT test cases, committed in master by
Heikki as commit 9ee16b49f0aac819bd4823d9b94485ef608b34e8 .

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/1c9701cfe58267cf5d79543a42ee4f0967cc73ab

Modified Files
--------------
src/backend/executor/execMain.c            |   24 ++++++++----
src/backend/executor/nodeLockRows.c        |    2 +-
src/include/executor/executor.h            |    2 +-
src/test/isolation/expected/nowait-4.out   |   19 ++++++++++
src/test/isolation/expected/nowait-4_1.out |   19 ++++++++++
src/test/isolation/expected/nowait-5.out   |   37 ++++++++++++++++++
src/test/isolation/isolation_schedule      |    8 ++--
src/test/isolation/specs/nowait-4.spec     |   30 +++++++++++++++
src/test/isolation/specs/nowait-5.spec     |   57 ++++++++++++++++++++++++++++
9 files changed, 186 insertions(+), 12 deletions(-)


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

Предыдущее
От: Fujii Masao
Дата:
Сообщение: pgsql: Add header comments to receivelog.h and streamutil.h.
Следующее
От: Alvaro Herrera
Дата:
Сообщение: pgsql: Fix FOR UPDATE NOWAIT on updated tuple chains