Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g91HI-0002ho-0x for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Oct 2018 05:06:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g91HG-000530-Ai for pgsql-hackers@arkaria.postgresql.org; Sun, 07 Oct 2018 05:06:50 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g91HF-00052s-Vs for pgsql-hackers@lists.postgresql.org; Sun, 07 Oct 2018 05:06:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g91HD-00072s-8d for pgsql-hackers@postgresql.org; Sun, 07 Oct 2018 05:06:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w9756dZX031311; Sun, 7 Oct 2018 01:06:39 -0400 From: Tom Lane To: Amit Kapila cc: konstantin knizhnik , pgsql-hackers , Robert Haas Subject: Re: now() vs transaction_timestamp() In-reply-to: References: <6406dbd2-5d37-4cb6-6eb2-9c44172c7e7c@postgrespro.ru> <4268.1538747795@sss.pgh.pa.us> <4911.1538774725@sss.pgh.pa.us> <9c78b24f-4ec9-e1dd-bdf6-e09e9b5f0e31@postgrespro.ru> <14825.1538842224@sss.pgh.pa.us> Comments: In-reply-to Amit Kapila message dated "Sun, 07 Oct 2018 10:28:25 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31309.1538888799.1@sss.pgh.pa.us> Date: Sun, 07 Oct 2018 01:06:39 -0400 Message-ID: <31310.1538888799@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Amit Kapila writes: > On Sat, Oct 6, 2018 at 9:40 PM Tom Lane wrote: >> That's a bit too small ;-) ... one demonstrable problem with it is >> that the parallel worker will report the wrong xactStartTimestamp >> to pgstat_report_xact_timestamp(), since you aren't jamming the >> transmitted value in soon enough. Also, I found that ParallelWorkerMain >> executes at least two transactions before it ever gets to the "main" >> transaction that does real work, and I didn't much care for the fact >> that those were running with worker-local values of xactStartTimestamp >> and stmtStartTimestamp. So I rearranged things a bit to ensure that >> parallel workers wouldn't generate their own values for either >> timestamp, and pushed it. > Currently, we serialize the other transaction related stuff via > PARALLEL_KEY_TRANSACTION_STATE. However, this patch has serialized > xact_ts via PARALLEL_KEY_FIXED which appears okay, but I think it > would have been easier for future readers of the code if all the > similar state variables have been serialized by using the same key. That state is restored at least two transactions too late. regards, tom lane