Skip to content

PG19: build foundation (source-level compat, scaffold ruleutils_19.c, CI image bump)#8600

Closed
ihalatci wants to merge 6 commits into
pg19-supportfrom
pg19-pr1-build
Closed

PG19: build foundation (source-level compat, scaffold ruleutils_19.c, CI image bump)#8600
ihalatci wants to merge 6 commits into
pg19-supportfrom
pg19-pr1-build

Conversation

@ihalatci
Copy link
Copy Markdown
Contributor

@ihalatci ihalatci commented May 29, 2026

DESCRIPTION: Add PG19 build support; extension compiles and loads.

First PR of the PG19 enablement series tracked in #8597. Achieves
source-level compatibility with PG19 (pg19devel) and a clean
CREATE EXTENSION citus while keeping PG17 and PG18 builds green.
Regression-test correctness and PG19 feature integration are tackled
in follow-up PRs against the pg19-support development branch.

What changed

Source-level PG19 compat

  • configure.ac / configure / pg_version_constants.h: accept PG19,
    add PG_VERSION_19 (and a PG_VERSION_20 placeholder).
  • src/include/pg_version_compat.h: centralised PG19 source-compat
    shims (PageSetChecksumInplace, replorigin_session_origin,
    GetPublicationRelations, pg_plan_query / standard_planner /
    planner signatures, FuncnameGetCandidates, ShmemInitHash 4-arg
    form, ExecInitScanTupleSlot / table_beginscan flags, LWLock
    tranche, NamedLWLockTranche, ClusterStmtRepackStmt
    indirection, standard_conforming_strings helper, bits16 /
    fmStringInfo, RepOriginId / InvalidRepOriginId, query_instr).
  • Distributed/columnar source updates for renamed / retyped APIs:
    PGPROC->links->waitLink, ClusterStmt indirection,
    Instrumentation / NodeInstrumentation split,
    pgstat_report_vacuum PG19 signature, get_relation_info_hook
    gating, columnar PageSetChecksum shim.
  • Header hygiene: add pg_version_compat.h / fmgr.h / storage/fd.h
    / tuplestore.h / lwlock / shmem includes wherever transitive
    includes no longer pull them in under PG19.
  • resource_lock.h: bump PG_MAJORVERSION_NUM static-assert ceiling
    to ≤ 19.

Compiler-warning (-Werror) fixes

  • Source-level fixes across ~76 files to build clean under PG19's
    stricter warnings (old-style foo()(void) prototypes,
    strict-prototype forward declarations, -Wimplicit-fallthrough
    annotations, new switch arms, etc.). No compiler-flag
    demotion
    — the build stays on the same warning/error flags as
    PG17/PG18; warnings are resolved at the source rather than silenced.

Shmem sizing

  • shared_library_init.c: add 128 KB of shmem slack on PG19 to absorb
    the new cache-line alignment overhead now that ShmemInitHash
    allocates all hash elements up-front. Heuristic — sized
    empirically against current Citus shmem consumers; revisit if a
    consumer is added.
  • maintenanced.c: drop a pre-existing double-count of hash size in
    ShmemInitStruct sizing. Only exposed because PG19's new
    ShmemInitHash pre-allocates the buckets. Bundled here because the
    fix is required for the PG19 build to load; called out separately
    so reviewers don't read it as scope creep.

Deparser (scaffold only)

  • ruleutils_19.c: scaffold only in this PR. Per the precedent
    set by PG17 compatibility: ruleutils #7725 (PG17) and Pg18 ruleutils adaptation #8010 (PG18), the deparser file lands in
    its own PR (PR1b). PR1 ships the file as a clone of ruleutils_18.c
    retargeted at the PG19 version guard so the binary links. Running
    the regression suite against PR1 alone produces 18 failures in
    check-multi and many more in check-multi-mx
    — silent
    PG18-on-PG19 deparse corruption. PR1b imports a proper upstream PG19
    ruleutils via 3-way merge and brings the suite to 191/191 + 68/69.
  • .gitattributes: exclude ruleutils_19.c from citus-style
    (-citus-style). The file is an upstream-derived clone (~12k lines)
    and exceeds the CI uncrustify (citus_indent 0.68.1) 10,000-line
    limit, which otherwise aborts the style check.

CI

  • Bump image_suffix in .github/workflows/build_and_test.yml from
    -dev-fa732cb to -dev-e11d99c so CI pulls the test-image set
    that includes PG19 bits. The same change bumps the PG minors to
    16.14 / 17.10 / 18.4.
  • Add pg19_version to the params block and wire it into the build
    matrix. PG19 (19devel) is also wired into the pg-upgrade jobs:
    the test-pg-upgrade matrix gains 18 → 19 and 16 → 19 pairs and
    upgrade_pg_versions becomes 16.14-17.10-18.4-19devel.
  • PG19 is intentionally not added to test-citus,
    test-citus-failure, test-citus-cdc, or the test-citus-upgrade
    job. The regression suite requires the upstream-derived
    ruleutils_19.c that lands in PR1b, and no released Citus supports
    PG19 yet (so Citus-version upgrade testing on PG19 is not meaningful).
    Until PR1b lands, only the build and pg-upgrade paths are meaningful
    on PG19.

Validation

  • PG19devel: build exits 0, CREATE EXTENSION citus succeeds.
  • PG17.10: build exits 0 (regression guard).
  • PG18.4: build exits 0 (regression guard).
  • No regression-suite changes here; correctness work is split into
    subsequent PRs against pg19-support.

Non-goals / follow-ups

  • The real deparser port is PR1b — do not run the regression suite
    or any production workload on PG19 before PR1b lands.
  • multi_explain.c is touched here for the Instrumentation /
    NodeInstrumentation rename only. A separate TupleDescFinalize
    runtime fix lands in PR2.

Refs: #8597

Phase 1 of PG19 enablement: source-level compatibility for PG19devel.
Achieves a clean build (0 errors) on PG19 while keeping PG17 and PG18
builds green. Regression sanity and new-feature integration are
out of scope for this phase.

Highlights:
- configure.ac / configure / pg_version_constants.h: accept PG19,
  add PG_VERSION_19 (and PG_VERSION_20 placeholder).
- src/include/pg_version_compat.h: centralized PG19 source-compat
  shims (PageSetChecksumInplace, replorigin_session_origin,
  GetPublicationRelations, pg_plan_query/standard_planner/planner
  signatures, FuncnameGetCandidates, ShmemInitHash 4-arg form,
  ExecInitScanTupleSlot/table_beginscan flags, LWLock tranche,
  NamedLWLockTranche, ClusterStmt->RepackStmt typedef and tag,
  standard_conforming_strings helper, bits16/fmStringInfo,
  RepOriginId/InvalidRepOriginId, query_instr).
- Distributed/columnar source updates for renamed/retyped APIs:
  PGPROC->links->waitLink, ClusterStmt->RepackStmt indirection,
  Instrumentation/NodeInstrumentation split, pgstat_report_vacuum
  PG19 signature, get_relation_info_hook gating, columnar
  PageSetChecksum shim.
- shared_library_init.c: 128 KB shmem slack on PG19 to absorb
  cache-line alignment overhead now that ShmemInitHash allocates
  all hash elements upfront.
- maintenanced.c: drop pre-existing double-count of hash size in
  ShmemInitStruct sizing.
- ruleutils_19.c: scaffold copy of ruleutils_18.c with
  func_get_detail call updated for the new int *fgc_flags arg
  (semantic port deferred to Phase 2).
- Header hygiene: add pg_version_compat.h / fmgr.h / storage/fd.h /
  tuplestore.h / lwlock / shmem includes where transitive includes
  no longer pull them in under PG19.
- resource_lock.h: bump PG_MAJORVERSION_NUM static assert to <= 19.

Validated:
- PG19devel: 0 errors, exit=0; CREATE EXTENSION citus succeeds.
- PG17.5 / PG18.3: 0 errors, exit=0 (regression guard).
@ihalatci ihalatci linked an issue May 29, 2026 that may be closed by this pull request
Pulls in the test images built by citusdata/the-process#218:
  - PG16: 16.13 -> 16.14
  - PG17: 17.9  -> 17.10
  - PG18: 18.3  -> 18.4
  - PG19: 19devel (new, source-built in the upstream image)

Bumps image_suffix to -dev-e11d99c, updates sql_snapshot_pg_version
to 18.4, and updates upgrade_pg_versions to 16.14-17.10-18.4.

Adds pg19_version to the build matrix so PG19 source-level build is
exercised by CI. PG19 is intentionally NOT added to test-citus /
test-citus-failure / test-citus-cdc / upgrade jobs in this PR: the
regression suite requires the upstream-derived ruleutils_19.c that
lands in PR1b. Until then, only the build path is meaningful on PG19.
@ihalatci ihalatci marked this pull request as draft May 29, 2026 10:11
Make the full tree build clean under PG19 with CI's -Werror flags, without
demoting any compiler flag. All changes are version-guarded behind
PG_VERSION_NUM >= PG_VERSION_19 so PG17/18 behavior is unchanged:

- old-style function definitions/declarations -> (void)
- -Wimplicit-fallthrough=5: use pg_fallthrough (with PG<19 compat fallback)
- TableAM callback signature changes (columnar_tableam.c, test/fake_am.c)
- Instrumentation vs NodeInstrumentation API split
- planner_hook gains ExplainState*; distributed_planner signature update
- config_enum_lookup_by_value takes const struct config_generic *
- log_min_messages is now a per-backend-type array
- RTE_GRAPH_TABLE / OBJECT_PROPGRAPH new switch cases
- RepOriginId/InvalidRepOriginId renames; guarded compat define
- unused trancheName under no-op LWLockRegisterTranche
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

❌ Patch coverage is 62.58503% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.69%. Comparing base (10c3a8b) to head (9637d6b).

Additional details and impacted files
@@               Coverage Diff                @@
##           pg19-support    #8600      +/-   ##
================================================
- Coverage         88.75%   88.69%   -0.07%     
================================================
  Files               288      288              
  Lines             64289    64350      +61     
  Branches           8090     8091       +1     
================================================
+ Hits              57062    57075      +13     
- Misses             4889     4936      +47     
- Partials           2338     2339       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ihalatci added 3 commits May 29, 2026 10:31
ruleutils_19.c is a near-verbatim copy of PostgreSQL's ruleutils.c, like
ruleutils_16/17/18.c which are all marked -citus-style. At 11943 lines it
also exceeds uncrustify's internal line limit (SetOrigLine too big 10001),
which aborted the Check C Style CI step. Exclude it from formatting to match
its sibling files.
Bump upgrade_pg_versions to 16.14-17.10-18.4-19devel so the pgupgradetester
image includes PG19 binaries (the suffixed image already ships it), and add
18->19 and 16->19 upgrade pairs to the check-pg-upgrade matrix.

citus-upgrade stays on PG16/17 since older Citus releases do not support
PG19.
@ihalatci
Copy link
Copy Markdown
Contributor Author

Superseded by #8601, which restructures the same change set into 5 reviewable commits (ruleutils_19.c isolated into a single commit, -Werror fixes separated from the deparser scaffold, CI collapsed to one commit) and rebases onto the refreshed pg19-support branch. Closed in favour of #8601.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant