Repository navigation
feat(app): prefer shared MergeTree settings - #3570
Conversation
On Cloud, read shared_merge_tree_settings falling back to merge_tree_settings per key. part of O11Y-29693
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 22dcc5e The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
|
|
||
| return new Map(json.data.map(row => [row.name, row.value])); | ||
| // OSS has no shared_merge_tree_settings; querying it fails. | ||
| const isCloud = await this.isClickHouseCloud({ connectionId }); |
There was a problem hiding this comment.
🟠 major — A failed Cloud check permanently caches settings that ignore the shared table
If the Cloud check fails once (a timeout or network blip), isClickHouseCloud (metadata.ts:2146-2173) doesn't cache the failure but returns false. getMergeTreeSettings then builds a map from merge_tree_settings alone. MetadataCache.set stores it with no TTL (metadata.ts:304-330), so a Cloud connection keeps missing the shared-table values for the life of the session. That is exactly the bug this PR is meant to fix. Fix: if detection fails, don't cache this result either. For example, add a method that returns boolean | undefined, and return undefined from getMergeTreeSettings when the result is undefined.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
| return new Map(json.data.map(row => [row.name, row.value])); | ||
| // OSS has no shared_merge_tree_settings; querying it fails. | ||
| const isCloud = await this.isClickHouseCloud({ connectionId }); | ||
| const [mergeTreeRows, sharedMergeTreeRows] = await Promise.all([ |
There was a problem hiding this comment.
🟠 major — A failed shared-table read throws away the merge_tree_settings result too
Both queries run in one Promise.all inside one try, so any error reading system.shared_merge_tree_settings makes the whole call return undefined. That includes 'Not enough privileges' for a restricted Cloud user, a case getSettings (metadata.ts:2226-2236) already handles. Block-column detection then fails, although on main it worked from merge_tree_settings. And since undefined isn't cached, every call re-runs both queries (useMergeTreeSettings uses staleTime 0 on failure). This contradicts the 'falls back to merge_tree_settings per key' claim in the changeset. Fix: catch the shared read on its own (e.g. .catch(() => [])) so the merge_tree_settings rows are still used.
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
PR Review
3 finding(s): 🔴 0 critical · 🟠 2 major · 🔵 1 minor 2 posted as inline comment(s) on the changed lines. 1 listed below. Findings outside the changed lines1 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
Deep Review
🟡 P2 — recommended
🔵 P3 nitpicks (4)
Reviewers (7): correctness, kieran-typescript, testing, reliability, maintainability, performance, project-standards. Testing gaps: Cloud path with an empty (zero-row) No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 464 passed • 1 skipped • 1446s
Tests ran across 4 shards in parallel. |
Summary
On ClickHouse Cloud, read MergeTree settings from
system.shared_merge_tree_settings, falling back tosystem.merge_tree_settingsfor each setting, when detecting persisted_block_numberand_block_offsetcolumns.Metadata.getMergeTreeSettingsalso readssystem.shared_merge_tree_settingson Cloud (detected withisClickHouseCloud). Where both tables set a key, the shared value winssystem.merge_tree_settings, since OSS servers don't have the shared tableundefined(not cached), so the next call retriesThe code is identical to the EE change, so the forward-port should merge without conflicts.
How to reproduce
Starting point: a ClickHouse Cloud service where block columns are enabled in the shared settings but not in
system.merge_tree_settings. Check with:Add a log table on that service as a source, with no block-column settings in its
SETTINGSclause, and ingest some rows.On
main:_block_number/_block_offsetand falls back to matching the full row.On this branch:
_block_numberand_block_offset.How to test on Vercel preview
N/A — non-UI change.
References