1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-27 07:42:10 +03:00

Separate multixact freezing parameters from xid's

Previously we were piggybacking on transaction ID parameters to freeze
multixacts; but since there isn't necessarily any relationship between
rates of Xid and multixact consumption, this turns out not to be a good
idea.

Therefore, we now have multixact-specific freezing parameters:

vacuum_multixact_freeze_min_age: when to remove multis as we come across
them in vacuum (default to 5 million, i.e. early in comparison to Xid's
default of 50 million)

vacuum_multixact_freeze_table_age: when to force whole-table scans
instead of scanning only the pages marked as not all visible in
visibility map (default to 150 million, same as for Xids).  Whichever of
both which reaches the 150 million mark earlier will cause a whole-table
scan.

autovacuum_multixact_freeze_max_age: when for cause emergency,
uninterruptible whole-table scans (default to 400 million, double as
that for Xids).  This means there shouldn't be more frequent emergency
vacuuming than previously, unless multixacts are being used very
rapidly.

Backpatch to 9.3 where multixacts were made to persist enough to require
freezing.  To avoid an ABI break in 9.3, VacuumStmt has a couple of
fields in an unnatural place, and StdRdOptions is split in two so that
the newly added fields can go at the end.

Patch by me, reviewed by Robert Haas, with additional input from Andres
Freund and Tom Lane.
This commit is contained in:
Alvaro Herrera
2014-02-13 19:30:30 -03:00
parent ca1c171817
commit fb47de2be6
20 changed files with 446 additions and 49 deletions

View File

@@ -187,7 +187,11 @@ typedef struct RelationData
* be applied to relations that use this format or a superset for
* private options data.
*/
/* autovacuum-related reloptions. */
/*
* autovacuum-related reloptions.
*
* Split in two to avoid ABI break.
*/
typedef struct AutoVacOpts
{
bool enabled;
@@ -202,12 +206,26 @@ typedef struct AutoVacOpts
float8 analyze_scale_factor;
} AutoVacOpts;
/*
* The multixact freeze parameters were added after 9.3.2 had been released;
* to preserve ABI compatibility with modules that might have been compiled
* prior to 9.3.3, these are placed in a separate struct so that they can be
* located at the end of the containing struct.
*/
typedef struct AutoVacOpts2
{
int multixact_freeze_min_age;
int multixact_freeze_max_age;
int multixact_freeze_table_age;
} AutoVacOpts2;
typedef struct StdRdOptions
{
int32 vl_len_; /* varlena header (do not touch directly!) */
int fillfactor; /* page fill factor in percent (0..100) */
AutoVacOpts autovacuum; /* autovacuum-related options */
bool security_barrier; /* for views */
AutoVacOpts2 autovacuum2; /* rest of autovacuum options */
} StdRdOptions;
#define HEAP_MIN_FILLFACTOR 10