postgresql/contrib
Robert Haas ae9bfc5d65 postgres_fdw: Allow cancellation of transaction control commands.
Commit f039eaac71, later back-patched
with commit 1b812afb0e, allowed many of
the queries issued by postgres_fdw to fetch remote data to respond to
cancel interrupts in a timely fashion.  However, it didn't do anything
about the transaction control commands, which remained
noninterruptible.

Improve the situation by changing do_sql_command() to retrieve query
results using pgfdw_get_result(), which uses the asynchronous
interface to libpq so that it can check for interrupts every time
libpq returns control.  Since this might result in a situation
where we can no longer be sure that the remote transaction state
matches the local transaction state, add a facility to force all
levels of the local transaction to abort if we've lost track of
the remote state; without this, an apparently-successful commit of
the local transaction might fail to commit changes made on the
remote side.  Also, add a 60-second timeout for queries issue during
transaction abort; if that expires, give up and mark the state of
the connection as unknown.  Drop all such connections when we exit
the local transaction.  Together, these changes mean that if we're
aborting the local toplevel transaction anyway, we can just drop the
remote connection in lieu of waiting (possibly for a very long time)
for it to complete an abort.

This still leaves quite a bit of room for improvement.  PQcancel()
has no asynchronous interface, so if we get stuck sending the cancel
request we'll still hang.  Also, PQsetnonblocking() is not used, which
means we could block uninterruptibly when sending a query.  There
might be some other optimizations possible as well.  Nonetheless,
this allows us to escape a wait for an unresponsive remote server
quickly in many more cases than previously.

Report by Suraj Kharage.  Patch by me and Rafia Sabih.  Review
and testing by Amit Kapila and Tushar Ahuja.

Discussion: http://postgr.es/m/CAF1DzPU8Kx+fMXEbFoP289xtm3bz3t+ZfxhmKavr98Bh-C0TqQ@mail.gmail.com
2017-06-07 15:14:55 -04:00
..
adminpack Use wrappers of PG_DETOAST_DATUM_PACKED() more. 2017-03-12 19:35:34 -04:00
amcheck amcheck: Harden tests against concurrent autovacuums. 2017-03-14 13:07:38 -07:00
auth_delay Consistently declare timestamp variables as TimestampTz. 2017-02-23 15:57:08 -05:00
auto_explain Allow for parallel execution whenever ExecutorRun() is done only once. 2017-03-23 13:14:36 -04:00
bloom Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
btree_gin Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
btree_gist Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
chkpass Further cleanup from the strong-random patch. 2016-12-12 11:55:32 +02:00
citext Optimize joins when the inner relation can be proven unique. 2017-04-07 22:20:13 -04:00
cube Fix typos in comments. 2017-02-06 11:33:58 +02:00
dblink Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
dict_int Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
dict_xsyn Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
earthdistance Remove support for version-0 calling conventions. 2017-03-30 06:25:46 -07:00
file_fdw Reset API of clause_selectivity() 2017-04-06 19:10:51 -04:00
fuzzystrmatch Use wrappers of PG_DETOAST_DATUM_PACKED() more. 2017-03-12 19:35:34 -04:00
hstore Assume deconstruct_array() outputs are untoasted. 2017-03-12 19:35:31 -04:00
hstore_plperl Suppress indentation from Data::Dumper in regression tests 2017-05-14 01:10:18 -04:00
hstore_plpython Drop support for Python 2.3 2017-02-21 09:49:22 -05:00
intagg Schema-qualify some references to regprocedure. 2016-06-10 10:41:58 -04:00
intarray Post-PG 10 beta1 pgperltidy run 2017-05-17 19:01:23 -04:00
isn Fix wording in amvalidate error messages 2017-05-30 15:45:42 -04:00
lo Move atooid() definition to a central place 2017-03-01 11:55:28 -05:00
ltree Spelling fixes 2017-03-14 12:58:39 -04:00
ltree_plpython Code review for avoidance of direct cross-module links. 2017-02-02 11:21:16 -05:00
oid2name Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
pageinspect Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
passwordcheck Remove support for password_encryption='off' / 'plain'. 2017-05-08 11:26:07 +03:00
pg_buffercache Default monitoring roles 2017-03-30 14:18:53 -04:00
pg_freespacemap Default monitoring roles 2017-03-30 14:18:53 -04:00
pg_prewarm Use wrappers of PG_DETOAST_DATUM_PACKED() more. 2017-03-12 19:35:34 -04:00
pg_standby Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
pg_stat_statements Improve castNode notation by introducing list-extraction-specific variants. 2017-04-10 13:51:53 -04:00
pg_trgm Further fix pg_trgm's extraction of trigrams from regular expressions. 2017-04-14 14:52:21 -04:00
pg_visibility Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
pgcrypto Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
pgrowlocks Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
pgstattuple Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
postgres_fdw postgres_fdw: Allow cancellation of transaction control commands. 2017-06-07 15:14:55 -04:00
seg Move contrib/seg to only use V1 calling conventions. 2017-03-30 06:25:46 -07:00
sepgsql Replace over-optimistic Assert in partitioning code with a runtime test. 2017-06-04 16:20:03 -04:00
spi Spelling fixes in code comments 2017-03-14 12:58:39 -04:00
sslinfo Use wrappers of PG_DETOAST_DATUM_PACKED() more. 2017-03-12 19:35:34 -04:00
start-scripts Fix typos in comments. 2017-02-06 11:33:58 +02:00
tablefunc Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
tcn Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
test_decoding Fix race condition leading to hanging logical slot creation. 2017-05-13 14:21:00 -07:00
tsm_system_rows Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
tsm_system_time Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
unaccent Use wrappers of PG_DETOAST_DATUM_PACKED() more. 2017-03-12 19:35:34 -04:00
uuid-ossp Use wrappers of PG_DETOAST_DATUM_PACKED() more. 2017-03-12 19:35:34 -04:00
vacuumlo Fix hard-coded relkind constants in assorted other files. 2017-03-09 23:36:52 -05:00
xml2 Use wrappers of PG_DETOAST_DATUM_PACKED() more. 2017-03-12 19:35:34 -04:00
Makefile Add amcheck extension to contrib. 2017-03-09 16:33:02 -08:00
README Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00
contrib-global.mk Respect TEMP_CONFIG when pg_regress_check and friends are called 2016-02-27 12:28:21 -05:00

README

The PostgreSQL contrib tree
---------------------------

This subtree contains porting tools, analysis utilities, and plug-in
features that are not part of the core PostgreSQL system, mainly
because they address a limited audience or are too experimental to be
part of the main source tree.  This does not preclude their
usefulness.

User documentation for each module appears in the main SGML
documentation.

When building from the source distribution, these modules are not
built automatically, unless you build the "world" target.  You can
also build and install them all by running "make all" and "make
install" in this directory; or to build and install just one selected
module, do the same in that module's subdirectory.

Some directories supply new user-defined functions, operators, or
types.  To make use of one of these modules, after you have installed
the code you need to register the new SQL objects in the database
system by executing a CREATE EXTENSION command.  In a fresh database,
you can simply do

    CREATE EXTENSION module_name;

See the PostgreSQL documentation for more information about this
procedure.