Skip to content

PG19: dispatch REPACK/CLUSTER (T_RepackStmt) + GetDistributeObjectOps #8613

@ihalatci

Description

@ihalatci

Part of the PG19 support umbrella: #8597.

Surfaced by review of #8602 (the ruleutils_19.c port). The Phase-1
build only provides a type shim; the command-dispatch behaviour is
deferred to this issue.

Background

PG19 replaced ClusterStmt with the unified RepackStmt, which also
subsumes VACUUM FULL. The parse-node tag T_ClusterStmt no longer
exists; T_RepackStmt is its successor, and the member layout differs
(relation is now a VacuumRelation * rather than a RangeVar *, plus
new repack options).

For the Phase-1 build foundation we added a minimal source-level shim in
src/include/pg_version_compat.h:

typedef struct RepackStmt ClusterStmt;
#define T_ClusterStmt T_RepackStmt

This makes the type names and node-tag references compile, but it is
not correct command behaviour:

  1. T_ClusterStmt now aliases T_RepackStmt, so castNode(ClusterStmt, ...)
    and any switch on the node tag that means "this is CLUSTER" will
    also fire for REPACK and VACUUM FULL-via-REPACK. These are
    distinct operations on a distributed table and must be told apart.
  2. Member access to clusterStmt->relation / ->indexname is laid out
    differently on RepackStmt and is currently only guarded at the
    RangeVarGetRelid call in cluster.c, not adapted everywhere.
  3. GetDistributeObjectOps() dispatch keys off the original
    T_ClusterStmt tag; on PG19 it needs to recognise T_RepackStmt and
    route REPACK / CLUSTER / VACUUM FULL to the right distributed-object
    operations.

Scope

  • Discriminate REPACK vs CLUSTER vs VACUUM FULL on PG19 at the utility
    dispatch boundary (commands/utility_hook.c and the
    GetDistributeObjectOps() switch).
  • Adapt cluster.c / relay_event_utility.c member access for the
    RepackStmt layout (version-guarded).
  • Decide and document Citus' propagation semantics for the new REPACK
    command on distributed/reference/local tables.

Validation

Cross-version gate (required before commit): build under -Werror and
run the relevant regress schedule on PG17.10, PG18.4, and PG19beta1 —
all three green, PG17/PG18 regression-neutral.

  • PG19: CLUSTER, REPACK, and VACUUM FULL on distributed tables
    dispatch and propagate correctly.
  • PG17/18: regression neutral (the RepackStmt typedef/macro shim is
    compiled out; behaviour unchanged).

Plan detail: pg19-pr-plan/11-repack-cluster-command.md (PR11).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions