feat(query-orchestrator): honour refreshKeyRenewalThreshold on locally evaluated refresh keys - #11720
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
|
Claude finished @ovr's task in 2m 38s —— View job Review: approach is sound — 0 blocking, 1 medium (synchronized refresh boundaries), 3 lowFull review — expand for detailsTodo
SummaryThe core idea — reproduce the cache-derived rate bound arithmetically instead of vetoing local evaluation — is correct and a genuine improvement over the
Findings below, none blocking. Medium — refresh keys now all flip at the same instant
Low
Nits (no action needed)
Tests & docsCoverage is good: the helper is tested directly (boundaries, monotonicity, the Not verifiedI could not run |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11720 +/- ##
==========================================
+ Coverage 62.21% 62.27% +0.06%
==========================================
Files 248 248
Lines 19979 19982 +3
Branches 4072 4072
==========================================
+ Hits 12430 12444 +14
+ Misses 6958 6948 -10
+ Partials 591 590 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
e97da3a to
eed2627
Compare
|
Claude finished @ovr's task in 1m 37s —— View job Re-review after rebase: no code changes since the last round — 0 blocking, 2 prior threads re-affirmed, 2 lowFull review — expand for detailsTodo
What changed since the last reviewThe synchronize was a rebase (single commit
Both left unresolved; no reply posted on them. Re-verified this round
Low
Nits (no action needed)
Not verified
|
Review (local, ovr): all findings addressed in c4d2436 — 0 openFull review — expand for detailsFixed in c4d2436
Verified locally
My two inline threads are resolved; the two CI threads have a reply and are left for the author/CI to resolve. PR description updated to describe the TTL cap and per-key phase. |
|
Claude finished @ovr's task in 4m 9s —— View job Re-review of
|
|
Claude finished @ovr's task in 3m 4s —— View job Re-review of
|
23b7933 to
5a66b86
Compare
|
Claude finished @ovr's task in 2m 6s —— View job Review: no blocking issues. 1 medium (PR description is out of date), 2 low (inline). Full review: expand for details
FindingsMedium: the PR description describes a design that was removed. The body still talks about
Rewrite the description to match before merging. Low (inline): Low (inline): Note, not raised inline: What checks out
Tests weren't run in this pass: the review relied on reading the code, and the author's round reports them passing. Review threadsThe listing returned 2 of my own threads. I resolved both: |
It slept for real to observe CubeStore returning a retained queue result after the cache entry expired, pinning a quirk rather than a requirement. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Review: no correctness issues found. 1 new low finding; 4 earlier threads still apply (2 low, plus 1 duplicate and 1 design note)Details
VerdictThe queue-based design looks correct. Under a New finding (posted inline)
Earlier threads that still apply (no new comments posted)
Tests / docs / comments
Review threadsThe listing returned 4 unresolved threads of mine. I resolved 0 and re-affirmed all 4, since each concern is still present in the current code. The threads on |
Reviewing PR #11720
|
|
Claude finished @ovr's task in 2m 54s —— View job Review: no blocking issues. 1 medium, 5 low (2 new inline, 3 re-affirmed open threads). The PR description contradicts the code. Full review
Medium: the PR description describes a queue design that the last commits removedThe description says local keys use "the same … query queue as SQL refresh keys" and that "the queue handler evaluates the local descriptor at execution time". It also claims "concurrent-miss deduplication", and its Test Coverage section lists "Shared queue tests … concurrent-miss deduplication". The code does not do this:
PRs are squash-merged, so update the description before merging. Otherwise the stale design ends up in the history as the rationale. Low (new inline threads)
Low (re-affirmed, still open from earlier rounds)
Checked, no issue
Review threadsThe listing returned 4 of my own unresolved threads. I resolved 0 and re-affirmed 3; the 4th ( TestsTests and lint were not run: |
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
|
Claude finished @ovr's task in 2m 29s —— View job Review: approve once the PR description is fixed. 1 medium (PR description), 4 low (2 new, 2 still open from earlier rounds), no correctness bugs found. Full review
Medium: the PR description contradicts the codeThe description says local keys "use the same shared cache identity, entry TTL, renewal rules, and query queue as SQL refresh keys", and that "the queue handler evaluates the local descriptor". It also lists "concurrent-miss deduplication" and "Shared queue tests" as preserved or covered. Commit 2b55648 removed that behaviour:
As a result, concurrent misses are not deduplicated. Each caller evaluates the key and issues its own New inline findings (low)
Still open from earlier rounds (re-affirmed)
Verified correct
I did not run the tests in this round. The review is based on reading the code. Review threadsThe listing returned 5 unresolved threads, all mine, and I resolved none. All five concerns are still present in the code:
Two current findings match open threads and were not reposted. Two new inline comments were posted. |
|
Claude finished @ovr's task in 1m 57s —— View job Review: no blocking issues. 1 medium, 3 low. The medium finding is that the PR description still describes the queue-based design that commit 2b55648 removed. Full review
Medium: the PR description doesn't match the code (top-level only)The description says local keys use "the same … query queue as SQL refresh keys". It also says "the queue handler evaluates the local descriptor at execution time", and that this "preserves cross-instance sharing, concurrent-miss deduplication". It lists "concurrent-miss deduplication" under the shared queue tests. After 2b55648 ("evaluate local refresh keys without the queue"), none of that holds:
PRs are squash-merged, so update the description before merging to state what now happens: the shared cache entry is kept, the queue is bypassed and there's no dedup. Inline
Checked and fine
Not runI couldn't run the tests: Review threadsThe listing returned 0 of my own threads (no prior threads), so there was nothing to resolve or re-affirm. All 3 inline findings are new. |
|
Claude finished @ovr's task in 2m 18s —— View job Review of #11720: looks good to merge. 0 high, 0 medium, 1 low (posted inline). Full review
Findings
Verified, no issues
Review threadsThe listing returned 0 of my own threads, so none were resolved or re-affirmed. There are no unresolved human threads either. |
| } from './utils'; | ||
| import { CacheAndQueryDriverType, MetadataOperationType } from './QueryOrchestrator'; | ||
|
|
||
| export const REFRESH_KEY_CACHE_TTL_SECONDS = 60 * 60; |
There was a problem hiding this comment.
Low: the name says this is the TTL for every refresh key entry, but it is only the pre-aggregation loader's. loadRefreshKey (QueryCache.ts:1014) writes the same entries with getExpireSecs(query), which defaults to 86400. The only caller is PreAggregationLoadCache.ts:199. Someone reading REFRESH_KEY_CACHE_TTL_SECONDS could reasonably assume it applies to all refresh key entries and reuse it in the query path. A loader-specific name such as PRE_AGGREGATION_REFRESH_KEY_TTL_SECONDS, or a non-exported constant in PreAggregationLoadCache.ts, keeps the scope visible. The PR description also calls it REFRESH_KEY_CACHE_TTL.
…cache Replace the refresh-key-specific localRefreshKey cache option with a generic fetchResult producer, drop the duplicate descriptor validation, and reuse REFRESH_KEY_CACHE_TTL_SECONDS in the partition range loader. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Claude finished @ovr's task in 1m 55s —— View job No new issues; 1 low issue from an earlier round is still open (0 high, 0 medium, 1 low). Review details
FindingsNo new inline comments this round. I checked:
Review threadsThe listing returned 1 of my own threads: 0 resolved, 1 still applies.
|
|
Claude finished @ovr's task in 2m 8s —— View job No new issues. 1 low-severity point from an earlier thread still applies (the constant name). Review details
Still open
What I checked and found correct
I didn't run the tests; this was a read-only review. Review threadsThe listing returned 1 of my threads ( |

Description of Changes Made
Allow
CUBEJS_REFRESH_KEY_LOCAL_TIMEto work together withqueryCacheOptions.refreshKeyRenewalThreshold. Previously, configuring a renewal threshold disabled local evaluation and sent time-based refresh key queries to the database. Eligibleevery-based keys now use the instance clock while retaining the shared cache's expiration and renewal rules.With a renewal threshold configured,
fetchAndCacheQueryevaluates the local descriptor directly on a cache miss or renewal and writes the result through the existing cache path. The cache identity, caller-supplied TTL, renewal timestamp, background renewal, and cache logging are preserved. Entries remain reusable across instances and when switching between SQL and local evaluation. Local computations never enter the SQL queue or create a database client, so they cannot wait behind long-running SQL queries. Concurrent misses and renewals are not deduplicated. Last-writer-wins is an accepted trade-off of direct local evaluation: if callers compute on opposite sides of an interval boundary and their writes arrive out of order, an older key can overwrite a newer key already returned to another caller. The stored value can remain until renewal or TTL expiry and may cause an extra pre-aggregation build; monotonic key values across callers are not guaranteed.Without a threshold override, including an override of zero, eligible keys are computed directly without a shared cache entry. SQL-defined and incremental keys, and keys with invalid or missing local descriptors, retain SQL execution. A shared
usesUncachedLocalRefreshKey()method keeps cache bypass and scheduled-refresh warming consistent: the scheduler warms cached local keys and skips uncached ones.Remove the unused
localRefreshKeyResultmethod and its duplicate tests, make descriptor validation a TypeScript type guard, and identify warmed interval keys by cache identity in scheduler tests. The environment-variable reference documents threshold behavior, andREFRESH_KEY_CACHE_TTL_SECONDSnames the pre-aggregation loader's existing one-hour TTL.Validation
refresh_keycolumn.Check List