pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Add support for doing late row locking in FDWs.
Date: Tue, 12 May 2015 18:10:33 +0000
Message-ID: <E1YsEdV-0004Xh-AM@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1YsEdV-0004Xh-AM@gemulon.postgresql.org>
Permalink:  ../E1YsEdV-0004Xh-AM@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1YsEdV-0004Xh-AM@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Add support for doing late row locking in FDWs.
  In-Reply-To: <E1YsEdV-0004Xh-AM@gemulon.postgresql.org>
  References: <E1YsEdV-0004Xh-AM@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox