Re: pg_control contents - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_control contents
Date
Msg-id 23147.1017081334@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_control contents  (Thomas Lockhart <thomas@fourpalms.org>)
List pgsql-hackers
Thomas Lockhart <thomas@fourpalms.org> writes:
> If LOCALE_NAME_BUFLEN changes size between writing and reading the
> control file, the CRC *could* still be calculated correctly.

There might be some value to storing sizeof(ControlFileData) explicitly,
so that that CRC calculation could be made.  But I still see none in
storing LOCALE_NAME_BUFLEN explicitly.  There is *no* difference between
"I changed LOCALE_NAME_BUFLEN at random" and "I added or reordered
fields in the struct at random".  In either case the file has to be
treated as completely useless, because we don't really know what's in
there at what offset.  And making either sort of change without bumping
PG_CONTROL_VERSION is simply a mistake that we cannot afford to make.
There are plenty of places in PG where ill-considered hacking will have
undesirable consequences; pg_control is just one more.

The value of storing sizeof(ControlFileData) explicitly would not be
that we could hope to extract data safely, but only that we could
distinguish "corrupt data" from "good data in an incompatible format"
with marginally more reliability than now.  But both of these are and
must be failure cases, so it's really not that interesting to
distinguish between them.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: pg_control contents
Next
From: Bruce Momjian
Date:
Subject: Re: views on temp tables