Re: fix_PGSTAT_NUM_TABENTRIES_macro patch - Mailing list pgsql-hackers

From Tom Lane
Subject Re: fix_PGSTAT_NUM_TABENTRIES_macro patch
Date
Msg-id 19756.1388705888@sss.pgh.pa.us
Whole thread Raw
In response to Re: fix_PGSTAT_NUM_TABENTRIES_macro patch  (Mark Dilger <markdilger@yahoo.com>)
Responses Re: fix_PGSTAT_NUM_TABENTRIES_macro patch
List pgsql-hackers
Mark Dilger <markdilger@yahoo.com> writes:
> I still don't understand why this case in src/include/pgstat.h
> is different from cases elsewhere in the code.

The reason why I'm exercised about it is that (a) somebody actually made a
mistake of this type, and (b) it wasn't caught by any automated testing.

The catalog and WAL-related examples you cite would probably crash
and burn in fairly obvious ways if somebody broke them --- for instance,
the most likely way to break SizeOfHeapHeader would be by adding another
field after t_hoff, but we'd notice that before long because said field
would be corrupted on arrival at a replication slave.

In contrast, messing up the pgstats message sizes would have no
consequences worse than a hard-to-detect, and probably platform-specific,
performance penalty for stats transmission.  So unless we think that's
of absolutely zero concern, adding a mechanism to make such bugs more
apparent seems useful.

I'm not against adding more assertions elsewhere, but it's a bit hard to
see what those asserts should test.  I don't see any practical way to
assert that field X is the last one in its struct, for instance.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: fix_PGSTAT_NUM_TABENTRIES_macro patch
Next
From: Mark Dilger
Date:
Subject: Re: fix_PGSTAT_NUM_TABENTRIES_macro patch