pgsql: Propagate xactStartTimestamp and stmtStartTimestamp to parallel

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Propagate xactStartTimestamp and stmtStartTimestamp to parallel
Date: 2018-10-06 16:00:35
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Propagate xactStartTimestamp and stmtStartTimestamp to parallel workers.

Previously, a worker process would establish values for these based on
its own start time. In v10 and up, this can trivially be shown to cause
misbehavior of transaction_timestamp(), timestamp_in(), and related
functions which are (perhaps unwisely?) marked parallel-safe. It seems
likely that other behaviors might diverge from what happens in the parent
as well.

It's not as trivial to demonstrate problems in 9.6 or 9.5, but I'm sure
it's still possible, so back-patch to all branches containing parallel
worker infrastructure.

In HEAD only, mark now() and statement_timestamp() as parallel-safe
(other affected functions already were). While in theory we could
still squeeze that change into v11, it doesn't seem important enough
to force a last-minute catversion bump.

Konstantin Knizhnik, whacked around a bit by me

Discussion: https://postgr.es/m/[email protected]

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/bdc2e7a19af7066ba5688fa0e0d3e6c03558c0c0

Modified Files
--------------
src/backend/access/transam/parallel.c | 11 +++++++++++
src/backend/access/transam/xact.c | 36 +++++++++++++++++++++++++++++++----
src/include/access/xact.h | 1 +
3 files changed, 44 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-10-06 17:18:46 pgsql: Don't use is_infinite() where isinf() will do.
Previous Message Dean Rasheed 2018-10-06 10:27:44 pgsql: Improve the accuracy of floating point statistical aggregates.