Skip to content

Fix PostgreSQL 19 beta4 compatibility - #8870

Merged
Onur Tirtir (onurctirtir) merged 7 commits into
mainfrom
ihalatci-pg19-beta4-alignment
Sep 25, 2026
Merged

Onur Tirtir (onurctirtir) merged 7 commits into
mainfrom
ihalatci-pg19-beta4-alignment

Conversation

@ihalatci

Copy link
Copy Markdown
Contributor

DESCRIPTION: Align Citus compatibility code with PostgreSQL 19 beta4

Summary

  • use the green PostgreSQL 19 beta4 development images from Update PostgreSQL 19 images to beta 4 the-process#250 (-dev-64e776f)
  • update PG19 CI and nightly cassert matrices from 19beta3 to 19beta4
  • remove property-graph compatibility reverted upstream between REL_19_BETA3 and REL_19_BETA4
  • preserve the remaining PostgreSQL 19 compatibility work already merged on main

Upstream delta

Replayed the applicable parts of PostgreSQL's REL_19_BETA3..REL_19_BETA4 src/backend/utils/adt/ruleutils.c delta onto Citus's curated ruleutils_19.c: removed the five pg_propgraph_* includes, graph-pattern deparse helpers, and RTE_GRAPH_TABLE branches while preserving Citus-specific hooks and shard-aware deparsing.

The Beta 4 build exposed two additional removed upstream symbols. This PR removes only their corresponding compatibility branches:

  • OBJECT_PROPGRAPH in pg_get_object_address_17_18.c
  • RTE_GRAPH_TABLE in citus_nodefuncs.c

Compatibility audit

Removes #8733. Retains #8622, #8624, #8741, #8784, #8785, and #8795 because their underlying PostgreSQL 19 behavior remains in beta4. Pending PG19 feature PRs are unchanged.

Closes #8597.

Validation

  • built PostgreSQL REL_19_BETA4 from source under native Ubuntu-22.04 WSL
  • PG_CONFIG=<beta4-prefix>/bin/pg_config ./configure
  • make -j"$(nproc)"
  • make install -j"$(nproc)"
  • src/test/regress/citus_tests/run_test.py pg19 — all 7 tests passed
  • citus_indent --quiet --check — passed
  • git diff --check — passed in Windows and WSL checkouts
  • repository-wide removed-symbol search — no stale matches

make check-style reaches the existing Python isort gate and reports src/test/regress/citus_tests/test/test_run_test.py, which is unchanged from origin/main. The C formatting check for this diff passes. Full Build & Test CI is required.

@codecov

codecov Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.77%. Comparing base (c267b0b) to head (f4b3e9c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8870      +/-   ##
==========================================
+ Coverage   88.69%   88.77%   +0.08%     
==========================================
  Files         290      290              
  Lines       65155    65102      -53     
  Branches     8219     8220       +1     
==========================================
+ Hits        57787    57795       +8     
+ Misses       4993     4934      -59     
+ Partials     2375     2373       -2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ihalatci-msft and others added 6 commits September 25, 2026 17:19
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@onurctirtir
Onur Tirtir (onurctirtir) merged commit 0cd3fe3 into main Sep 25, 2026
163 checks passed
@onurctirtir
Onur Tirtir (onurctirtir) deleted the ihalatci-pg19-beta4-alignment branch September 25, 2026 16:50
ibrahim halatci (ihalatci) added a commit that referenced this pull request Sep 28, 2026
## Summary
- replace the PostgreSQL 19 Beta 4 development image suffix with the
published immutable suffix `-vc231ab7`
- invalidate cached metadata index OIDs whenever concurrent reindex
replaces one of the 23 indexes stored in `MetadataCache`
- preserve the worker-node cache in WAL senders so logical decoding
never rebuilds it by scanning `pg_dist_node`
- fix the repeatable PG19 vanilla `create_view` failure and the
resulting shard-split isolation hang

## Root cause
PostgreSQL's vanilla `create_index` test runs `REINDEX SCHEMA
CONCURRENTLY pg_catalog` in parallel with `create_view`. Concurrent
reindex replaces Citus catalog indexes incrementally rather than
atomically.

The initial implementation reset metadata OIDs only when the
`pg_dist_object` table was invalidated. That fixed stale
`pg_dist_object_pkey` OID `16757`, but a parallel backend could
repopulate a later cached index while reindex was still progressing. CI
subsequently failed on stale `pg_dist_schema_pkey` OID `17321`.

The final implementation recognizes relcache invalidations for every
index OID stored in `MetadataCache` and resets the cached OIDs each time
one is replaced. The list covers all 23 `*IndexId` fields exactly,
without catalog lookups inside the relcache callback or resets for
unrelated relations.

A full metadata reset is unsafe in WAL senders: it invalidates the
worker-node cache, which then attempts to scan `pg_dist_node` inside
logical decoding. PostgreSQL rejects that non-catalog scan, shard-split
replication workers repeatedly restart, and
`create_distributed_table_concurrently` waits indefinitely for
replication catch-up. WAL senders therefore clear only `MetadataCache`,
while ordinary backends retain the full metadata-system reset.

## Stable image evidence
- citusdata/the-process#250 merged as
`c231ab76c3c3d0e8e57d61bfecad08fb2d6132ac`
- release publication run:
https://github.com/citusdata/the-process/actions/runs/36310869157
- published immutable suffix: `-vc231ab7`
- verified tags include `extbuilder:19beta4-vc231ab7`,
`exttester:19beta4-vc231ab7`, `failtester:19beta4-vc231ab7`, and
`pgupgradetester:17.11-18.6-19beta4-vc231ab7`

## Validation
- PG19 non-cassert vanilla: 239/239 passed in 10 consecutive runs
- PG19 cassert vanilla: 239/239 passed, including `create_view`
- PG19 cassert `isolation_create_distributed_table_concurrently`: passed
six final-candidate runs in 17-20 seconds
- PG19 cassert `multi_1_create_citus_schedule`: 38/38 passed, including
`multi_replicate_reference_table` and `pg19`
- PG17.11 and PG18.6 builds: passed without source compiler warnings
- PG19 Beta 4 cassert build/install with CI flags: passed
- explicit cache audit: all 23 `MetadataCacheData` `*IndexId` fields
covered exactly once
- full repository style workflow and `git diff --check`: passed

Follow-up to #8870 and citusdata/the-process#250.

---------

Co-authored-by: Ibrahim Halatci <ihalatci@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

Add PostgreSQL 19 support to Citus

3 participants