Re: Switching XLog source from archive to streaming when primary available - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: Switching XLog source from archive to streaming when primary available
Date
Msg-id 20220909.141617.1843398696475923032.horikyota.ntt@gmail.com
Whole thread Raw
In response to Re: Switching XLog source from archive to streaming when primary available  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
Being late for the party.

It seems to me that the function is getting too long.  I think we
might want to move the core part of the patch into another function.

I think it might be better if intentionalSourceSwitch doesn't need
lastSourceFailed set. It would look like this:

>  if (lastSourceFailed || switchSource)
>  {
>     if (nonblocking && lastSourceFailed)
>        return XLREAD_WOULDBLOCK;


+                    if (first_time)
+                        last_switch_time = curr_time;
..
+                    if (!first_time &&
+                        TimestampDifferenceExceeds(last_switch_time, curr_time,
..
+                    /* We're not here for the first time any more */
+                    if (first_time)
+                        first_time = false;

I don't think the flag first_time is needed.


regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: "houzj.fnst@fujitsu.com"
Date:
Subject: When should we bump the logical replication protocol version?
Next
From: John Naylor
Date:
Subject: Re: build remaining Flex files standalone