Re: track_commit_timestamp and COMMIT PREPARED - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: track_commit_timestamp and COMMIT PREPARED
Date
Msg-id CAHGQGwHSyLwYDtu72dwMxHnuig6rV2J2vsj4rqGO9Hhi-W6n1Q@mail.gmail.com
Whole thread Raw
In response to Re: track_commit_timestamp and COMMIT PREPARED  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: track_commit_timestamp and COMMIT PREPARED
Re: track_commit_timestamp and COMMIT PREPARED
List pgsql-hackers
On Tue, Sep 29, 2015 at 12:05 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
> Petr Jelinek wrote:
>> On 2015-09-02 16:14, Fujii Masao wrote:
>> >On Wed, Aug 5, 2015 at 2:16 AM, Robert Haas <robertmhaas@gmail.com> wrote:
>> >>On Mon, Aug 3, 2015 at 10:31 AM, Fujii Masao <masao.fujii@gmail.com> wrote:
>> >>>track_commit_timestamp tracks COMMIT PREPARED as expected in standby server,
>> >>>but not in master server. Is this intentional? It should track COMMIT PREPARED
>> >>>even in master? Otherwise, we cannot use commit_timestamp feature to check
>> >>>the replication lag properly while we use 2PC.
>> >>
>> >>That sounds like it must be a bug.  I think you should add it to the
>> >>open items list.
>>
>> Attached fixes this. It includes advancement of replication origin as well.
>> I didn't feel like doing refactor of commit code this late in 9.5 cycle
>> though, so I went with the code duplication + note in xact.c.
>
> Thanks, your proposed behavior looks reasonable.  I didn't like the
> existing coding nor the fact that with your patch we'd have two copies
> of it, so I changed a bit instead to be more understandable.  Hopefully I
> didn't break too many things.  This patch includes the patch for the
> other commitTS open item too.

-#define RecoveryRequiresBoolParameter(param_name, currValue, masterValue) \
-do { \
-    bool _currValue = (currValue); \
-    bool _masterValue = (masterValue); \
-    if (_currValue != _masterValue) \
-        ereport(ERROR, \
-                (errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
-                 errmsg("hot standby is not possible because it
requires \"%s\" to be same on master and standby (master has \"%s\",
standby has \"%s\")", \
-                        param_name, \
-                        _masterValue ? "true" : "false", \
-                        _currValue ? "true" : "false"))); \
-} while(0)

This code should not be deleted because there is still the caller of
the macro function.

@@ -5321,7 +5333,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,    /* Set the transaction commit timestamp and
metadata*/    TransactionTreeSetCommitTsData(xid, parsed->nsubxacts, parsed->subxacts,
commit_time, origin_id,
 
-                                   false);
+                                   false, true);

Why does xact_redo_commit always set replaying_xlog and write_xlog to
false and true, respectively? ISTM that they should be opposite...

Regards,

-- 
Fujii Masao



pgsql-hackers by date:

Previous
From: "Shulgin, Oleksandr"
Date:
Subject: Re: On-demand running query plans using auto_explain and signals
Next
From: Robert Haas
Date:
Subject: Re: Comment update to pathnode.c