Re: Switching XLog source from archive to streaming when primary available

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: bharath(dot)rupireddyforpostgres(at)gmail(dot)com
Cc: nathandbossart(at)gmail(dot)com, cary(dot)huang(at)highgo(dot)ca, pgsql-hackers(at)lists(dot)postgresql(dot)org, satyanarlapuram(at)gmail(dot)com
Subject: Re: Switching XLog source from archive to streaming when primary available
Date: 2022-09-09 05:16:17
Message-ID: 20220909.141617.1843398696475923032.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2022-09-09 05:18:20 Re: build remaining Flex files standalone
Previous Message houzj.fnst@fujitsu.com 2022-09-09 05:11:03 When should we bump the logical replication protocol version?