Re: Deduplicate code updating ControleFile's DBState.

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Amul Sul <sulamul(at)gmail(dot)com>, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Deduplicate code updating ControleFile's DBState.
Date: 2021-11-29 03:58:23
Message-ID: CALj2ACWL3YR_3Uq+1iVr2+KWwta8vk8mBSVA6R3aTyCpLpHsqg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Nov 28, 2021 at 10:03 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> We want to update the
> control file's timestamp when it is written, before calculating its
> CRC.

Okay.

> > Why do we even need UpdateControlFile which just calls another
> > function? It may be there for usability and readability, but can't the
> > pg backend code just call update_controlfile(DataDir, ControlFile,
> > true); directly so that a function call cost can be avoided?
> > Otherwise, why can't we make UpdateControlFile an inline function? I'm
> > not sure if any of the compilers will ever optimize by inlining it
> > without the "inline" keyword.
>
> I would leave it as-is as UpdateControlFile() is a public API old
> enough to vote (a70e74b0). Anyway, that's a useful wrapper for the
> backend.

In that case, why can't we inline UpdateControlFile to avoid the
function call cost? Do you see any issues with it?

BTW, the v6 patch proposed by Amul at [1], looks good to me.

[1] - https://www.postgresql.org/message-id/CAAJ_b94_s-VQs3Vtn_X-ReYr1DzaEakwPi80D1UYSmV3-f%2B_pw%40mail.gmail.com

Regards,
Bharath Rupireddy.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-11-29 04:09:59 Re: Synchronizing slots from primary to standby
Previous Message Bharath Rupireddy 2021-11-29 03:50:39 Re: How to get started with contribution for GSoc 2022