Skip to content

fix(ingestion): gate trino IT on catalog scheduling, not node liveness - #30196

Merged
pmbrull merged 1 commit into
mainfrom
fix/trino-it-nodes-available-startup-race
Jul 17, 2026
Merged

pmbrull merged 1 commit into
mainfrom
fix/trino-it-nodes-available-startup-race

Conversation

@IceS2

@IceS2 IceS2 commented Jul 17, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The trino integration tests fail intermittently in CI with NO_NODES_AVAILABLE — all 38 tests erroring at create_test_data setup, hitting one random python leg per run.

Root cause

For the first ~1–3s after ======== SERVER STARTED ========, the trino coordinator accepts queries but cannot yet schedule one against a catalog. DiscoveryNodeManager rebuilds its per-catalog node map (activeNodesByCatalogHandle) only on a 5s timer, and its @PostConstruct poll runs during app.initialize() — before loadInitialCatalogs() / updateConnectorIds(). So the last rebuild before startup completes carries no catalogs, and until the next tick a catalog scan fails with NO_NODES_AVAILABLE.

Meanwhile the system connector is registered on every active node unconditionally:

// DiscoveryNodeManager.refreshNodesInternal()
byCatalogHandleBuilder.put(CATALOG_HANDLE, node);   // always

The old readiness gate queried system.runtime.nodes, served by that system connector — so it passed the instant the node was active and could never witness the unscheduled catalog. That is why the information_schema probe sailed through while the first real scan died.

Fix

Gate on a real catalog scan instead:

"SELECT count(*) FROM tpch.tiny.nation"

tpch ships in the base image and COPY etc /etc/trino merges, so the test image already has both minio and tpch. One catalog proves the rest — a single announcement lists them all, so one refresh admits them together. This mirrors testcontainers' own TrinoContainer.getTestQueryString(), which uses exactly this query for exactly this reason.

Metadata-only probes (information_schema, SHOW SCHEMAS) are not valid: those use separate catalog sub-handles and pass during the window.

Validation

Reproduced the startup window deterministically against the repo's own trino image (6/6 cycles, SELECT count(*) FROM tpch.tiny.nation returning NO_NODES_AVAILABLE for ~0.8–1.5s after the old gate already passed). A/B at catalog level: baseline 6/6 fail, gated 0/6. Full fixture stack passes with the change.

The trino integration-test fixtures fail intermittently in CI with
NO_NODES_AVAILABLE at create_test_data setup, one random python leg per run.

For the first seconds after "SERVER STARTED", the trino coordinator accepts
queries but cannot yet schedule one against a catalog: DiscoveryNodeManager
rebuilds its per-catalog node map only on a 5s timer, and the announcement
carrying the catalogs lands after the last rebuild before startup completes.
Until the next tick, a catalog scan fails with NO_NODES_AVAILABLE while the
system connector -- registered on every active node regardless of catalog --
answers happily.

The readiness gate queried system.runtime.nodes, served by that system
connector, so it passed the instant the node was active and could never
witness the unscheduled catalog. Gate on a real catalog scan instead
(SELECT count(*) FROM tpch.tiny.nation); one catalog proves the rest because a
single announcement lists them all. This mirrors testcontainers' own
TrinoContainer.getTestQueryString().
@IceS2
IceS2 requested a review from a team as a code owner July 17, 2026 16:02
Copilot AI review requested due to automatic review settings July 17, 2026 16:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Jul 17, 2026
@gitar-bot

gitar-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Replaces the unreliable node liveness check with a TPCH catalog query to gate Trino integration tests, preventing race conditions during startup. The approach aligns with standard testcontainer patterns and eliminates transient failures.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

# already answers. Any catalog proves the rest -- one announcement lists them all.
retry(wait=wait_fixed(1), stop=stop_after_delay(120))(_exec)(
"select system.runtime.nodes.node_id from system.runtime.nodes"
"SELECT count(*) FROM tpch.tiny.nation"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Readiness Uses Missing Catalog

The test image copies only the minio catalog configuration, while this mandatory probe queries tpch.tiny.nation. When tpch is not registered, every attempt fails with a missing-catalog error until the 120-second retry expires, so the trino_container fixture fails even if the catalog used by the tests is ready.

Context Used: CLAUDE.md (source)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is a false positive — tpch is registered in the test image.

The base image trinodb/trino:418 ships /etc/trino/catalog/tpch.properties (alongside jmx, memory, tpcds). The Dockerfile's COPY etc /etc/trino merges into that directory rather than replacing it, so the built image ends up with both the base catalogs and the added minio.properties.

Verified at runtime against the image this repo actually builds:

$ docker build --build-arg BASE_IMAGE=trinodb/trino:418 -t t . && \
  docker run --rm --entrypoint sh t -c 'ls /etc/trino/catalog/'
jmx.properties
memory.properties
minio.properties      # from COPY
tpcds.properties
tpch.properties       # from base image

The fix was validated end-to-end against this exact built image, where SELECT count(*) FROM tpch.tiny.nation succeeds once the startup window closes (and returns NO_NODES_AVAILABLE for ~1s before that — which is the whole point of the gate). So the 120s retry resolves in a couple of seconds, not by timing out.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (28 flaky)

✅ 4526 passed · ❌ 0 failed · 🟡 28 flaky · ⏭️ 96 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 424 0 3 16
✅ Shard 2 11 0 0 0
🟡 Shard 3 821 0 10 9
🟡 Shard 4 821 0 1 18
🟡 Shard 5 833 0 6 5
🟡 Shard 6 787 0 1 46
🟡 Shard 7 829 0 7 2
🟡 28 flaky test(s) (passed on retry)
  • Flow/TestConnectionModal.spec.ts › failure state shows remediation card with error content (shard 1, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: metric (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › a fully denied user sees neither asset type when browsing (shard 1, 1 retry)
  • Features/BulkEditEntity.spec.ts › Glossary Term (Nested) (shard 3, 2 retries)
  • Features/BulkImportWithDotInName.spec.ts › CSV with quoted FQN loads correctly in import grid (shard 3, 1 retry)
  • Features/ContextCenterArchivePage.spec.ts › archive page lazy-loads more rows on scroll within its own scroll container (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article list cards, recently viewed widget, and pagination work (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article edit persistence and unsaved title behavior are correct (shard 3, 2 retries)
  • Features/ContextCenterArticles.spec.ts › description: switching articles does not bleed unsaved content into next article (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › clearing search restores the unfiltered list (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › Shared memory shows the shared-with-specific-people description (shard 3, 1 retry)
  • Features/ContextCenterPermission.spec.ts › user with view-only permission cannot see restore or delete actions on an archived document (shard 3, 1 retry)
  • Features/SearchExport.spec.ts › Export queues a background job and downloads from the jobs tray (shard 4, 1 retry)
  • Flow/IngestionBot.spec.ts › Ingestion bot should be able to access domain specific domain (shard 5, 1 retry)
  • Flow/PersonaDeletionUserProfile.spec.ts › User profile loads correctly before and after persona deletion (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Table (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Time (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Set table-cp custom property on column and verify in UI (shard 5, 1 retry)
  • Pages/DataContracts.spec.ts › Contract Status badge should be visible on condition if Contract Tab is present/hidden by Persona (shard 5, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 6, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Import partial success - some terms pass, some fail (shard 7, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Glossary CSV import rejects unknown relation type (shard 7, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for pipelineService in platform lineage (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for apiService in platform lineage (shard 7, 1 retry)
  • Pages/ServiceEntity.spec.ts › Tier Add, Update and Remove (shard 7, 1 retry)
  • Pages/TasksUIFlow.spec.ts › Create and reject tag task for Dashboard via UI (shard 7, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@pmbrull
pmbrull merged commit 969a609 into main Jul 17, 2026
70 of 71 checks passed
@pmbrull
pmbrull deleted the fix/trino-it-nodes-available-startup-race branch July 17, 2026 19:09

This branch was previously deployed

1 inactive deployment
test — 50fc6bb5 Deployed Jul 17, 2026 by IceS2 via playwright-ci-postgresql (3, 7) #57089
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants