Skip to content

Send the PromQL extended-support suite's statements over HTTP instead of forking a client per statement - #121862

Merged
Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:promql-extended-suite-http-transport
Sep 24, 2026
Merged

Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:promql-extended-suite-http-transport

Conversation

@groeneai

@groeneai groeneai commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Description

test_compliance.py::test_promql_extended_support, added by #120849, hits the 900 s per-test
pytest-timeout on sanitizer flavours. Since the merge it has reddened 2 master runs and 5 unrelated
PRs
, all within 2h10 today: amd_msan, 6/8 6 FAIL / 365 OK, amd_asan_ubsan, db disk, 6/8
1 FAIL / 444 OK. Failing master run:
sha 8db8b8de.

Root cause. The test issues 983 statements (123 TRUNCATE, 128 INSERT, 732 eval SELECT), each
through node.query(), which forks a clickhouse client; CI points it at the same sanitizer-built
binary as the server, so each statement pays an instrumented process bootstrap: 461 s of that run's
900 s budget, projecting to 996 s. Not one slow query, the slowest took 10.9 s; the budget expires on
whichever statement is in flight.

Change. Route those 983 statements over the node's HTTP interface, which has no process to start.
Corpus, queries and comparisons untouched; the 2 module-level DDL statements stay native and
test_evaluation.py keeps native coverage of these table functions. http_wait_end_of_query=1 plus a
body-tail check keep an exception an exception: HTTP can answer 200 with the error in the body, and
compare_eval needs a non-None error for the 13 expect_fail evals and every unsupported
classification. A timeout bump would leave the waste in place and retire the budget as a guard.

Validation, before -> after: test body 117.53 s -> 24.92 s (4.72x), native-protocol statements
1118 -> 135, client launches 988 -> 5, and all 8 pinned suites.extended_support counters
byte-identical across 2 pre-fix and 5 post-fix runs. Projected amd_msan cost ~490 s of 900 s on the
worst run seen.

Disclosure: the printed FAILURE BREAKDOWN keys collapse duplicates (119 -> 78, identical totals); the
PromQL Compliance job reads only those counters.


Workflow [PR]
Sync PR [sync-upstream/pr/121862]

Version info

  • Merged into: 26.10.1.595-master (included in 26.10 and later)

… process per statement

test_prometheus_protocols/test_compliance.py::test_promql_extended_support hits the 900s
pytest-timeout on sanitizer flavours (Integration tests (amd_msan, 6/8): 4 FAIL against 349 OK
over 7 days, plus one FAIL on amd_asan_ubsan, db disk, 6/8), which reds master and unrelated
contributors' PRs. The suite was added in ClickHouse#120849.

The test issues 983 statements over the vendored upstream promqltest corpus: one TRUNCATE per
scenario, one INSERT per LOAD block, one SELECT per eval. Each went through node.query(), which
forks a clickhouse client process and waits for it to exit, and ci/jobs/integration_test_job.py
points CLICKHOUSE_TESTS_CLIENT_BIN_PATH at the same sanitizer-instrumented binary as the server,
so every statement pays an instrumented process bootstrap. In the failing master run (sha
8db8b8d) 461s of the 900s window was spent outside any server connection, 51% of the wall clock,
and the full corpus projects to 996s. It is not one heavy query: the slowest single query there
took 10.9s and no inter-statement gap exceeded 11.5s.

Sending those statements over the node's HTTP interface removes the process bootstrap and nothing
else. The corpus, the statements and the comparisons are unchanged, and the two module-level DDL
statements keep using the native protocol so the test still exercises it. Measured on one debug
binary, before and after: test body 117.53s to 24.92s, statements reaching the native protocol
1118 to 135, client process launches 988 to 5, with all eight pinned suites.extended_support
counters byte-identical (566 passed, 141 failed, 25 unsupported of 732). The 900s budget is kept
rather than raised, so it stays a guard on PromQL evaluation cost, at roughly 1.8x projected
margin on the worst run observed.

http_wait_end_of_query=1 and the body-tail check are both needed. compare_eval treats a non-None
error as the only thing that can make an expect_fail eval pass or classify an eval unsupported,
while http_query_and_get_answer_with_error decides success on the HTTP status alone, and
ClickHouse can answer 200 with the exception appended to the response body once part of the
response has been flushed. The setting holds the response server-side until the query resolves so
a failure arrives as an error status, and the regex covers the residual shape, which does
reproduce on this build when send_progress_in_http_headers commits the headers early. Without
them the 13 expect_fail evals would have flipped to failed with nothing turning red.
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Sep 23, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (click to expand)

An independent cold review and a separate second-model gate both ran against this head. No blocker
and no major survived.
Recording the residuals for the record.

❌ Blockers / ⚠️ Majors: none. The second-model gate returned 0 findings. The cold review's own
checks that could have failed and did not:

  • http_wait_end_of_query=1 is sufficient rather than best-effort: the response is buffered in a
    cascade that overflows to a temporary file, so on a throw it is still untouched and a real error
    status is sent.
  • The new <status> <reason>: prefix cannot reclassify errors: NOT_IMPLEMENTED is the only code
    mapped to HTTP 501, so compare_eval's 501 and code: 48 clauses stay in lockstep.
  • The settings are not silently dropped: only the deprecated buffer_size / wait_end_of_query
    spellings are reserved URL parameters, so the modern names are applied before the buffer is built.
  • The carrier enumeration reproduced independently and matched, including that the sibling
    test_promql_compliance already runs over HTTP and so was never a carrier.
  • breakdown has no consumer under ci/ and the counters increment independently of the key text, so
    the disclosed 119 -> 78 key collapse cannot move a score.

💡 Nits, none blocking:

  1. Leaving node.query() drops its stacktraces_on_timeout side effect; not raised, since the slowest
    query measured was 10.9 s and the largest inter-statement gap 11.5 s.
  2. The _HTTP_EXCEPTION_RE comment's "whatever the output format" holds as shipped, but
    http_write_exception_in_output_format or a non-default framing_output_format would each change
    it; both default off and this suite sets neither.
  3. Neither the two settings nor the body-tail check is exercised by a passing run; their proof is a
    one-off probe in which the shape was produced and the check fired. A test asserting a harness's own
    transport guard is not worth its maintenance.

Also looked at, deliberately not raised: three other integration tests sit near the same 900 s
budget (test_keeper_session::test_no_logical_error_on_shutdown_with_late_commit p50 915.5 s / 0 FAIL
of 13 755, test_sql_cluster_storage::test_keeper_storage_encrypted p95 903.7 s / 0 FAIL,
test_memory_limit::test_multiple_queries max 904.8 s / 1 FAIL); none has this mechanism, and none an
observed rate that would justify work.

@clickhouse-gh clickhouse-gh Bot closed this Sep 23, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 23, 2026
@groeneai
groeneai requested a review from vitlibar September 23, 2026 22:26
@clickhouse-gh

clickhouse-gh Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4545297]

Summary: ✅


AI Review

Summary

This PR switches the extended PromQL compliance suite from node.query to the HTTP interface so the test no longer forks a clickhouse-client process for every statement. I did not find a correctness or contract regression in the transport swap: the suite still executes each statement independently, preserves the expected error/non-error signal for compare_eval, and the PR metadata matches a CI Fix or Improvement.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Sep 23, 2026
Merged via the queue into ClickHouse:master with commit 326a33a Sep 24, 2026
176 of 349 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 24, 2026
@clickhouse-gh clickhouse-gh Bot added comp-promql PromQL / time-series subsystem: TimeSeries storage engine, PromQL parser, PromQL-to-SQL converter... and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocker This issue / pr blocks a new release can be tested Allows running workflows for external contributors comp-promql PromQL / time-series subsystem: TimeSeries storage engine, PromQL parser, PromQL-to-SQL converter... groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants