Re: Suppressing useless wakeups in walreceiver

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Suppressing useless wakeups in walreceiver
Date: 2022-10-13 19:09:54
Message-ID: 20221013190954.GA1563962@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 13, 2022 at 12:37:39PM +0200, Alvaro Herrera wrote:
> I think in 0001 we should put more stuff in the state struct --
> specifically these globals:
>
> static int recvFile = -1;
> static TimeLineID recvFileTLI = 0;
> static XLogSegNo recvSegNo = 0;
>
> The main reason is that it seems odd to have startpointTLI in the struct
> used in some places together with a file-global recvFileTLI which isn't.
> The way one is passed as argument and the other as part of a struct
> seemed too distracting. This should reduce the number of moving parts,
> ISTM.

Makes sense. Do you think the struct should be file-global so that it
doesn't need to be provided as an argument to most of the static functions
in this file?

> One thing that confused me for a moment is that we have some state in
> walrcv and some more state in 'state'. The difference is pretty obvious
> once you look at the other, but it suggest to me that a better variable
> name for the latter is 'localstate' to more obviously distinguish them.

Sure, I'll change it to 'localstate'.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2022-10-13 19:10:16 Re: remove redundant memset() call
Previous Message Dean Rasheed 2022-10-13 19:07:08 Re: Exponentiation confusion