Re: Deduplicate code updating ControleFile's DBState.

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
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-28 04:32:53
Message-ID: YaMGdQYgFtUh5NKi@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Nov 28, 2021 at 07:53:13AM +0530, Bharath Rupireddy wrote:
> Isn't it better if we update the ControlFile->time at the end of the
> update_controlfile, after file write/sync?

I don't quite understand your point here. We want to update the
control file's timestamp when it is written, before calculating its
CRC.

> 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.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-11-28 04:34:45 Re: SSL Tests for sslinfo extension
Previous Message Michael Paquier 2021-11-28 04:19:55 Re: pg_waldump stucks with options --follow or -f and --stats or -z