Incremental Update: Paquier Concedes on Callbacks, Refines shared_size Semantics
Michael Paquier responds with a concession on the callback columns and a new technical suggestion about shared_size NULL semantics.
Key Developments
-
Callback columns dropped: Paquier explicitly backs down from his earlier proposal to expose callback existence booleans at the SQL level. He acknowledges there's "currently no internal mechanism" to enforce consistency of built-in stats kinds' flags and callbacks, and says "Perhaps it is not worth bothering at the end." He's fine keeping the published data minimal. This resolves the open design disagreement from the previous round in Partin's favor.
-
Minimum agreed column set: Paquier confirms that
fixed_amount,write_to_file, andaccessed_across_databases"feel like useful additions" — establishing these as the consensus set of metadata columns beyond the original schema. -
New
shared_sizeNULL semantics proposal: Paquier suggests thatshared_sizeshould be NULL (rather than 0) for built-in fixed-sized stats kinds where the size isn't explicitly known at the kind registration level. He draws a distinction: custom fixed-sized stats kinds do setshared_sizeat registration (because extensions must declare their memory needs), but built-in fixed-sized kinds don't — their memory is allocated through a different mechanism (static offsets in the shared stats control structure). Using NULL rather than 0 avoids the misleading implication that these kinds consume no shared memory.
Technical Significance
The shared_size NULL semantics refinement is architecturally meaningful. It reflects the deeper asymmetry between how built-in and custom fixed-sized stats kinds manage memory:
- Built-in fixed-sized kinds: Memory is carved out of the monolithic stats shared memory segment at compile-time-determined offsets (
shared_ctl_off,shared_data_off). ThePgStat_KindInfostruct doesn't need ashared_sizefield because the layout is implicit. - Custom fixed-sized kinds: Must declare
shared_sizeat registration time so the pgstat infrastructure can allocate appropriate shared memory dynamically.
Using NULL for built-in fixed-sized kinds correctly communicates "not applicable through this mechanism" rather than "zero bytes" — a more honest representation of the internal architecture.
Status
The design is converging. Paquier has yielded on the callback columns, confirmed the metadata column additions, and offered one refinement to NULL semantics. A v2 patch from Partin incorporating these decisions is the next expected action.