pgsql: Rearrange snapshot handling to make rule expansion more consiste

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Rearrange snapshot handling to make rule expansion more consiste
Date: 2011-03-01 04:28:19
Message-ID: E1PuHC7-0004rk-4t@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Rearrange snapshot handling to make rule expansion more consistent.

With this patch, portals, SQL functions, and SPI all agree that there
should be only a CommandCounterIncrement between the queries that are
generated from a single SQL command by rule expansion. Fetching a whole
new snapshot now happens only between original queries. This is equivalent
to the existing behavior of EXPLAIN ANALYZE, and it was judged to be the
best choice since it eliminates one source of concurrency hazards for
rules. The patch should also make things marginally faster by reducing the
number of snapshot push/pop operations.

The patch removes pg_parse_and_rewrite(), which is no longer used anywhere.
There was considerable discussion about more aggressive refactoring of the
query-processing functions exported by postgres.c, but for the moment
nothing more has been done there.

I also took the opportunity to refactor snapmgr.c's API slightly: the
former PushUpdatedSnapshot() has been split into two functions.

Marko Tiikkaja, reviewed by Steve Singer and Tom Lane

Branch
------
master

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

Modified Files
--------------
src/backend/catalog/pg_proc.c | 27 +++-
src/backend/commands/copy.c | 3 +-
src/backend/commands/explain.c | 3 +-
src/backend/executor/functions.c | 348 ++++++++++++++++++++++++++-----------
src/backend/executor/spi.c | 96 ++++++-----
src/backend/tcop/postgres.c | 41 -----
src/backend/tcop/pquery.c | 52 +++++--
src/backend/utils/time/snapmgr.c | 33 +++--
src/include/tcop/tcopprot.h | 2 -
src/include/utils/snapmgr.h | 3 +-
10 files changed, 390 insertions(+), 218 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2011-03-01 16:34:30 pgsql: Avoid excessive Hot Standby feedback messages.
Previous Message Andrew Dunstan 2011-03-01 02:31:57 pgsql: Unbreak vpath builds broken by commit 474a42473adf9b18417242f1fc