postgresql/src/backend
Thomas Munro bb16aba50c Enable parallel query with SERIALIZABLE isolation.
Previously, the SERIALIZABLE isolation level prevented parallel query
from being used.  Allow the two features to be used together by
sharing the leader's SERIALIZABLEXACT with parallel workers.

An extra per-SERIALIZABLEXACT LWLock is introduced to make it safe to
share, and new logic is introduced to coordinate the early release
of the SERIALIZABLEXACT required for the SXACT_FLAG_RO_SAFE
optimization, as follows:

The first backend to observe the SXACT_FLAG_RO_SAFE flag (set by
some other transaction) will 'partially release' the SERIALIZABLEXACT,
meaning that the conflicts and locks it holds are released, but the
SERIALIZABLEXACT itself will remain active because other backends
might still have a pointer to it.

Whenever any backend notices the SXACT_FLAG_RO_SAFE flag, it clears
its own MySerializableXact variable and frees local resources so that
it can skip SSI checks for the rest of the transaction.  In the
special case of the leader process, it transfers the SERIALIZABLEXACT
to a new variable SavedSerializableXact, so that it can be completely
released at the end of the transaction after all workers have exited.

Remove the serializable_okay flag added to CreateParallelContext() by
commit 9da0cc35, because it's now redundant.

Author: Thomas Munro
Reviewed-by: Haribabu Kommi, Robert Haas, Masahiko Sawada, Kevin Grittner
Discussion: https://postgr.es/m/CAEepm=0gXGYhtrVDWOTHS8SQQy_=S9xo+8oCxGLWZAOoeJ=yzQ@mail.gmail.com
2019-03-15 17:47:04 +13:00
..
access Enable parallel query with SERIALIZABLE isolation. 2019-03-15 17:47:04 +13:00
bootstrap tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
catalog Sync commentary in transam.h and bki.sgml. 2019-03-14 00:23:40 -04:00
commands Improve code comment 2019-03-14 22:44:21 +01:00
executor Enable parallel query with SERIALIZABLE isolation. 2019-03-15 17:47:04 +13:00
foreign Update copyright for 2019 2019-01-02 12:44:25 -05:00
jit Renaming for new subscripting mechanism 2019-02-01 12:50:32 -03:00
lib Move hash_any prototype from access/hash.h to utils/hashutils.h 2019-03-11 13:17:50 -03:00
libpq Add new clientcert hba option verify-full 2019-03-09 12:19:47 -08:00
main Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
nodes Refactor ParamListInfo initialization 2019-03-14 13:30:09 +01:00
optimizer Enable parallel query with SERIALIZABLE isolation. 2019-03-15 17:47:04 +13:00
parser Fix the BY {REF,VALUE} clause of XMLEXISTS/XMLTABLE 2019-03-07 11:20:35 -03:00
partitioning Fix some oversights in commit 2455ab488. 2019-03-14 18:36:33 -04:00
po Translation updates 2018-06-25 12:37:18 +02:00
port Add shared_memory_type GUC. 2019-02-03 12:47:26 +01:00
postmaster Use condition variables to wait for checkpoints. 2019-03-14 10:59:33 +13:00
regex Update copyright for 2019 2019-01-02 12:44:25 -05:00
replication Rename pg_verify_checksums to pg_checksums 2019-03-13 10:43:20 +09:00
rewrite tableam: Add and use scan APIs. 2019-03-11 12:46:41 -07:00
snowball Update copyright for 2019 2019-01-02 12:44:25 -05:00
statistics Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
storage Enable parallel query with SERIALIZABLE isolation. 2019-03-15 17:47:04 +13:00
tcop Refactor ParamListInfo initialization 2019-03-14 13:30:09 +01:00
tsearch Move hash_any prototype from access/hash.h to utils/hashutils.h 2019-03-11 13:17:50 -03:00
utils Enable parallel query with SERIALIZABLE isolation. 2019-03-15 17:47:04 +13:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Ensure link commands list *.o files before LDFLAGS. 2019-01-02 13:57:54 -05:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Translation updates 2018-06-25 12:37:18 +02:00