Skip to content

age_global_graph: stabilize regression tests#2431

Open
jrgemignani wants to merge 1 commit into
apache:masterfrom
jrgemignani:stabilize_age_global_graph_regression_tests
Open

age_global_graph: stabilize regression tests#2431
jrgemignani wants to merge 1 commit into
apache:masterfrom
jrgemignani:stabilize_age_global_graph_regression_tests

Conversation

@jrgemignani

Copy link
Copy Markdown
Contributor

age_global_graph: stabilize regression tests under concurrent xid load

Wrap both vertex_stats() context-building phases in a single BEGIN ISOLATION LEVEL REPEATABLE READ; ... COMMIT; transaction so the three calls share one snapshot. This prevents the snapshot-fallback path in is_ggctx_invalid() from purging an already-built graph context when concurrent xid activity (autovacuum, parallel installcheck, replication, shared CI) advances the snapshot between calls, which would otherwise make the targeted delete_global_graphs(name) checks return false instead of the expected true. Read Committed is insufficient because it acquires a fresh snapshot per statement; REPEATABLE READ pins one snapshot for the whole transaction.

Also add explicit ORDER BY id to the three direct-SQL label-table SELECTs (_ag_label_vertex x2, _ag_label_edge) that return multiple rows, so their output no longer depends on heap scan order.

This is a test-only change (regress/sql/age_global_graph.sql and regress/expected/age_global_graph.out); no extension C code or SQL is modified.

All 37 regression tests pass (installcheck) on PostgreSQL 18.3.

Co-authored-by: GitHub Copilot noreply@github.com

modified: regress/expected/age_global_graph.out
modified: regress/sql/age_global_graph.sql

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR stabilizes the age_global_graph regression test output under concurrent transaction ID (xid) churn by making the snapshot used during graph-context construction deterministic, and by ensuring multi-row heap reads are ordered.

Changes:

  • Wrap each 3-call vertex_stats() context build phase in a single BEGIN ISOLATION LEVEL REPEATABLE READ; ... COMMIT; transaction so the calls share one snapshot.
  • Add ORDER BY id to direct SQL reads from _ag_label_vertex and _ag_label_edge to avoid nondeterministic heap-scan ordering.
  • Update the expected regression output to match the new SQL (transaction statements + ordered SELECT output).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
regress/sql/age_global_graph.sql Pins a single snapshot per context-build phase via REPEATABLE READ and makes label-table SELECT ordering deterministic.
regress/expected/age_global_graph.out Updates expected output to reflect the added transaction statements and ordered SELECT results.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

age_global_graph: stabilize regression tests under concurrent xid load

Wrap both vertex_stats() context-building phases in a single
BEGIN ISOLATION LEVEL REPEATABLE READ; ... COMMIT; transaction so the
three calls share one snapshot. This prevents the snapshot-fallback path
in is_ggctx_invalid() from purging an already-built graph context when
concurrent xid activity (autovacuum, parallel installcheck, replication,
shared CI) advances the snapshot between calls, which would otherwise
make the targeted delete_global_graphs(name) checks return false instead
of the expected true. Read Committed is insufficient because it acquires
a fresh snapshot per statement; REPEATABLE READ pins one snapshot for the
whole transaction.

Also add explicit ORDER BY id to the three direct-SQL label-table SELECTs
(_ag_label_vertex x2, _ag_label_edge) that return multiple rows, so their
output no longer depends on heap scan order.

This is a test-only change (regress/sql/age_global_graph.sql and
regress/expected/age_global_graph.out); no extension C code or SQL is
modified.

All 37 regression tests pass (installcheck) on PostgreSQL 18.3.

Co-authored-by: GitHub Copilot <noreply@github.com>

modified:   regress/expected/age_global_graph.out
modified:   regress/sql/age_global_graph.sql
@jrgemignani jrgemignani force-pushed the stabilize_age_global_graph_regression_tests branch from 524767c to e7da8f8 Compare June 9, 2026 17:51
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.

2 participants