Repository navigation
fix(ingestion): gate trino IT on catalog scheduling, not node liveness - #30196
Conversation
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().
Code Review ✅ ApprovedReplaces 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. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
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" |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
|
🟡 Playwright Results — all passed (28 flaky)✅ 4526 passed · ❌ 0 failed · 🟡 28 flaky · ⏭️ 96 skipped
🟡 28 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |



Problem
The trino integration tests fail intermittently in CI with
NO_NODES_AVAILABLE— all 38 tests erroring atcreate_test_datasetup, 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.DiscoveryNodeManagerrebuilds its per-catalog node map (activeNodesByCatalogHandle) only on a 5s timer, and its@PostConstructpoll runs duringapp.initialize()— beforeloadInitialCatalogs()/updateConnectorIds(). So the last rebuild before startup completes carries no catalogs, and until the next tick a catalog scan fails withNO_NODES_AVAILABLE.Meanwhile the system connector is registered on every active node unconditionally:
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 theinformation_schemaprobe sailed through while the first real scan died.Fix
Gate on a real catalog scan instead:
"SELECT count(*) FROM tpch.tiny.nation"tpchships in the base image andCOPY etc /etc/trinomerges, so the test image already has bothminioandtpch. One catalog proves the rest — a single announcement lists them all, so one refresh admits them together. This mirrors testcontainers' ownTrinoContainer.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.nationreturningNO_NODES_AVAILABLEfor ~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.