-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(webapp): isolate the runs list ClickHouse read pool #4763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ericallam
merged 8 commits into
main
from
feature/tri-13470-runs-list-clickhouse-one-tenants-expensive-queries-can
Aug 25, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
97bf4e9
feat(webapp): isolate the runs list ClickHouse read pool
ericallam d2bbe1b
refactor(webapp,clickhouse): route runs-list filters through PREWHERE…
ericallam 7f8db90
fix(webapp): use only per-query caps on the runs-list ClickHouse pool
ericallam 1592856
fix(webapp): default the runs-list per-query caps on
ericallam 3d7ef3b
fix(webapp): harden runs-list pool timeout and cap validation
ericallam 6a835fa
fix(webapp): keep the runs-list region filter in WHERE, not PREWHERE
ericallam fcd9a8d
fix(webapp): move error_fingerprint and machine_preset filters to WHERE
ericallam c1cd1af
fix(webapp): move region and error_fingerprint filters to PREWHERE
ericallam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: improvement | ||
| --- | ||
|
|
||
| Improved the performance and reliability of the runs list and the runs.list API, especially for large projects and filtered views. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import { ClickHouse } from "@internal/clickhouse"; | ||
| import { clickhouseTest } from "@internal/testcontainers"; | ||
| import { describe, expect, vi } from "vitest"; | ||
| import { z } from "zod"; | ||
|
|
||
| vi.setConfig({ testTimeout: 60_000 }); | ||
|
|
||
| describe("runs-list ClickHouse protection settings", () => { | ||
| clickhouseTest( | ||
| "server-side max_execution_time kills a slow read, and readonly=2 does not block the caps", | ||
| async ({ clickhouseContainer }) => { | ||
| const clickhouse = new ClickHouse({ | ||
| url: clickhouseContainer.getConnectionUrl(), | ||
| name: "runs-list-settings-test", | ||
| requestTimeoutMs: 30_000, | ||
| clickhouseSettings: { | ||
| max_execution_time: 1, | ||
| timeout_before_checking_execution_speed: 0, | ||
| max_threads: 2, | ||
| readonly: "2", | ||
| }, | ||
| }); | ||
|
|
||
| const slow = clickhouse.reader.query({ | ||
| name: "slow-read", | ||
| query: "SELECT sum(number) AS total FROM numbers(1000000000000)", | ||
| schema: z.object({ total: z.number() }), | ||
| }); | ||
| const [slowError] = await slow({}); | ||
|
|
||
| expect(slowError).not.toBeNull(); | ||
| expect(slowError?.message.toLowerCase()).toMatch(/timeout|exceeded/); | ||
|
|
||
| const fast = clickhouse.reader.query({ | ||
| name: "fast-read", | ||
| query: "SELECT 1 AS one", | ||
| schema: z.object({ one: z.number() }), | ||
| }); | ||
| const [fastError, rows] = await fast({}); | ||
|
|
||
| expect(fastError).toBeNull(); | ||
| expect(rows).toEqual([{ one: 1 }]); | ||
| } | ||
| ); | ||
|
|
||
| clickhouseTest( | ||
| "readonly=2 rejects writes while permitting reads", | ||
| async ({ clickhouseContainer }) => { | ||
| const clickhouse = new ClickHouse({ | ||
| url: clickhouseContainer.getConnectionUrl(), | ||
| name: "runs-list-readonly-test", | ||
| clickhouseSettings: { readonly: "2" }, | ||
| }); | ||
|
|
||
| const write = clickhouse.reader.query({ | ||
| name: "write-under-readonly", | ||
| query: "CREATE TABLE trigger_dev.runs_list_readonly_probe (id UInt8) ENGINE = Memory", | ||
| schema: z.object({}), | ||
| }); | ||
| const [writeError] = await write({}); | ||
|
|
||
| expect(writeError).not.toBeNull(); | ||
| expect(writeError?.message.toLowerCase()).toMatch(/readonly|read-only|read only/); | ||
| } | ||
| ); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.