Re: Some regression tests for the pg_control_*() functions - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Some regression tests for the pg_control_*() functions
Date
Msg-id Y1nY9AXypTELWi99@paquier.xyz
Whole thread Raw
In response to Re: Some regression tests for the pg_control_*() functions  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
On Wed, Oct 26, 2022 at 01:41:12PM +0530, Bharath Rupireddy wrote:
> We will have bigger problems when a backend corrupts the pg_control
> file, no? The bigger problems could be that the server won't come up
> or it behaves abnormally or some other.

Possibly, yes.

> Can't the CRC check detect any of the above corruptions? Do we have
> any evidence of backend corrupting the pg_control file or any of the
> above variables while running regression tests?

It could be possible that the backend writes an incorrect data
combination though its APIs, where the CRC is correct but the data is
not (say a TLI of 0, as one example).

> If the concern is backend corrupting the pg_control file and CRC check
> can't detect it, then the extra checks (as proposed in the patch) must
> be placed within the core (perhaps before writing/after reading the
> pg_control file), not in regression tests for sure.

Well, that depends on the level of protection you want.  Now there are
things in place already when it comes to recovery or at startup.
Anyway, the recent experience with the 56-bit relfilenode thread is
really that we don't check the execution of these functions at all,
and that's the actual minimal requirement, so I have applied a patch
based on count(*) > 0 for now to cover that.  I am not sure if any of
the checks for the control file fields are valuable, perhaps some
are..
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: confused with name in the pic
Next
From: Michael Paquier
Date:
Subject: Re: GUC values - recommended way to declare the C variables?