Re: Parallel safety of CURRENT_* family

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 5bih4k+4jfl6m39j23k(at)guerrillamail(dot)com, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parallel safety of CURRENT_* family
Date: 2016-12-13 22:04:47
Message-ID: CA+Tgmob4Bs=JQ=TAz=1mEi6_ZAxJsi0r6oxyaXOSjRm+nT3+Bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 1, 2016 at 3:46 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Thu, Dec 1, 2016 at 2:32 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> ... well, they would be if we passed down xactStartTimestamp to parallel
>>> workers, but I can't find any code that does that. In view of the fact that
>>> transaction_timestamp() is marked as parallel-safe, this is a bug in 9.6.
>
>> Yeah. Do you think we should arrange to pass that down, or change the marking?
>
> We can't fix the marking in existing 9.6 installations, so I think we
> have to pass it down. (Which would be a better response anyway.)

I happened across this thread today and took a look at what it would
take to fix this. I quickly ran up against the fact that
SerializeTransactionState() and RestoreTransactionState() are not
exactly brilliantly designed, relying on the notion that each
individual value that we want to serialize will be no wider than a
TransactionId, which won't be true for timestamps. Even apart from
that, the whole design of those functions is pretty lame, and I'm
pretty sure I wrote all of that code myself, so I have nobody to blame
but me. Anyway, here's a proposed patch to refactor that code into
something a little more reasonable. It doesn't fix the actual problem
here, but I think it's a good first step.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
refactor-tstate-serialization.patch text/x-patch 4.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-12-13 22:17:39 Re: exposing wait events for non-backends (was: Tracking wait event for latches)
Previous Message Andres Freund 2016-12-13 21:06:58 Re: Logical Replication WIP