pgsql: Add support for doing late row locking in FDWs.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Add support for doing late row locking in FDWs.
Date: 2015-05-12 18:10:33
Message-ID: E1YsEdV-0004Xh-AM@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add support for doing late row locking in FDWs.

Previously, FDWs could only do "early row locking", that is lock a row as
soon as it's fetched, even though local restriction/join conditions might
discard the row later. This patch adds callbacks that allow FDWs to do
late locking in the same way that it's done for regular tables.

To make use of this feature, an FDW must support the "ctid" column as a
unique row identifier. Currently, since ctid has to be of type TID,
the feature is of limited use, though in principle it could be used by
postgres_fdw. We may eventually allow FDWs to specify another data type
for ctid, which would make it possible for more FDWs to use this feature.

This commit does not modify postgres_fdw to use late locking. We've
tested some prototype code for that, but it's not in committable shape,
and besides it's quite unclear whether it actually makes sense to do late
locking against a remote server. The extra round trips required are likely
to outweigh any benefit from improved concurrency.

Etsuro Fujita, reviewed by Ashutosh Bapat, and hacked up a lot by me

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/afb9249d06f47d7a6d4a89fea0c3625fe43c5a5d

Modified Files
--------------
doc/src/sgml/fdwhandler.sgml | 232 +++++++++++++++++++++++++++++---
src/backend/executor/execMain.c | 79 ++++++++---
src/backend/executor/execUtils.c | 17 +--
src/backend/executor/nodeLockRows.c | 133 ++++++++++++------
src/backend/executor/nodeModifyTable.c | 2 +-
src/backend/optimizer/plan/planner.c | 8 +-
src/include/executor/executor.h | 2 +-
src/include/foreign/fdwapi.h | 12 ++
src/include/nodes/execnodes.h | 12 +-
src/include/nodes/plannodes.h | 31 +++--
10 files changed, 415 insertions(+), 113 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2015-05-12 19:55:51 pgsql: Additional functions and operators for jsonb
Previous Message Amit Kapila 2015-05-12 17:30:51 Re: pgsql: Map basebackup tablespaces using a tablespace_map file