Repository navigation
fix: skip exhausted search windows - #3587
adityareddy-dev wants to merge 9 commits into
Conversation
|
Hi @adityareddy-dev, thanks for the pull request! Before we review code from a first-time contributor, a maintainer vouches for them, and you're not on our list yet. There's nothing else to file and this PR stays open — a maintainer will look at it, usually within a day or two, and vouch for you right here if it's a genuine attempt at the problem. To make that quick, check the PR description has:
More detail in our contributing guide. |
PR Review
1 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 1 minor 1 posted as inline comment(s) on the changed lines. Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
bcacd17 to
b25c8cc
Compare
Deep Review✅ No critical issues found. The core logic is conservative by construction: 🟡 P2 — recommended
🔵 P3 nitpicks (3)
Reviewers (8): correctness, adversarial, testing, maintainability, performance, reliability, kieran-typescript, previous-comments. Testing gaps:
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 |
ab7139d to
9263c98
Compare
|
Done. |
e508541 to
bdac94d
Compare
|
@adityareddy-dev is attempting to deploy a commit to the ClickHouse Team on Vercel. A member of the Team first needs to authorize it. |
2a44a78 to
7b0c09f
Compare
7b0c09f to
aa6623c
Compare
|
Fixed. |
ea17b69 to
01081a8
Compare
| }); | ||
| const sourceSettings = new Map( | ||
| source?.querySettings | ||
| ?.filter(({ setting, value }) => setting.length && value.length) |
There was a problem hiding this comment.
🔵 minor — Empty-setting filter copies joinQuerySettings and can drift from the SQL actually sent
The setting.length && value.length filter repeats the one in joinQuerySettings (packages/common-utils/src/core/utils.ts:1393), which decides which source settings reach the SQL SETTINGS clause. The inference here is only correct if both filters stay identical. Fix: export a small filterQuerySettings (or querySettingsToMap) helper from common-utils and use it in both places.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| source?.querySettings, | ||
| ); | ||
|
|
||
| let canSkipShortPage = false; |
There was a problem hiding this comment.
🔵 minor — The check for whether query limits can truncate a page is about 60 lines of logic written inline in the queryFn, and it repeats the empty-setting filter from joinQuerySettings
Move this logic into a pure helper next to joinQuerySettings in packages/common-utils/src/core/utils.ts (for example canResultBeTruncated(serverSettings, querySettings, queryTimeout, limit)). The helper should reuse that file's setting.length && value.length filter (utils.ts:1393) so the SETTINGS rendering and this check can't drift apart. Then unit-test it directly instead of through roughly 80 hook renders.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
🦋 Changeset detectedLatest commit: 229dbf5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
| ?.filter(({ setting, value }) => setting.length && value.length) | ||
| .map(({ setting, value }) => [setting, value]), | ||
| ); | ||
| // SQL SETTINGS override the timeout injected by the client, then server defaults. |
There was a problem hiding this comment.
🔵 minor — The hook keeps its own copy of how ClickHouse settings take effect, in two places
Move the settings check (lines 275-336) into a pure helper in packages/common-utils/src/core/utils.ts, next to joinQuerySettings. It would take the server settings, source settings, queryTimeout and the requested limit, and return a boolean. Today the inline code copies two pieces of logic. (1) The empty-pair filter at lines 281-283 repeats joinQuerySettings (core/utils.ts:1421). If the copies drift, the decision will be based on settings that differ from the SETTINGS clause actually sent. (2) The max_execution_time precedence (source setting, then the client timeout, then the server value) restates processClickhouseSettings (packages/common-utils/src/clickhouse/index.ts:609-614). A setting added to the client defaults later will not be counted here. Unit-test the helper directly instead of rendering the whole hook for each of the ~90 settings combinations.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
|
@karl-power can you vouch for me on this one? |
Summary
A short search page triggered another query in the same time window. I now skip that query only when the effective query limits rule out truncation. Capped or unknown results keep paging within the window.
Fixes #1403.
How to reproduce
Starting point: A search spanning multiple time windows, with a page limit of 100 and only one matching row in the first window.
On
main:OFFSET 1.On this branch:
throwor its limits disabled.OFFSET 0.How to test on Vercel preview
N/A, query pagination change with no visual changes.
References
#1403