fix: auto mode - #91
Conversation
|
Warning Review limit reached
Next review available in: 38 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Walkthrough
ChangesAutomatic shard reading
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| """ | ||
| if self._full_mode_latched: | ||
| return False | ||
| count = self._sparse_read_counts.get(cache_key, 0) + 1 |
There was a problem hiding this comment.
MEDIUM
The counter is scoped to one shard, so a full scan can never promote when chunks_per_shard < 256: every shard remains below the threshold even if the scan crosses thousands of shards, retaining the unbounded sparse-read penalty. The benchmark masks this by lowering the threshold to 8. Track scan-wide progress or cap the threshold based on the shard size.
There was a problem hiding this comment.
thats intended. so sparse mode gets advantages across long time ranges
| # far but latches independently afterward — it has the opposite | ||
| # read/write posture, and a writable clone can never take the sparse | ||
| # path at all, so there is nothing for a shared latch to coordinate. | ||
| clone._full_mode_latched = self._full_mode_latched |
There was a problem hiding this comment.
MEDIUM
The counters and cache are shared across clones, but the latch is copied by value. After a read-only clone from a writable store latches and clears the shared counters, another with_read_only(True) clone from that writable parent inherits its stale False latch and resumes sparse reads for evicted shards. Keep the latch in shared mutable state so all clones observe promotion.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #91 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 8 8
Lines 3168 3198 +30
=========================================
+ Hits 3168 3198 +30 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| return False | ||
| count = self._sparse_read_counts.get(cache_key, 0) + 1 | ||
| if count >= self._SPARSE_PROMOTE_THRESHOLD: | ||
| self._full_mode_latched = True |
There was a problem hiding this comment.
MEDIUM
_sparse_read_counts grows once per distinct shard and is never bounded or pruned unless the entire store latches or is cleared. The intended long-range point-read workload may touch millions of shards without promotion, causing persistent memory growth outside the bounded LRU cache. Use a bounded/LRU counter map or discard inactive shard counters.
There was a problem hiding this comment.
very unlikely. shards are limited to 1000.
| self._pending_shard_loads.clear() | ||
| await self._shard_data_cache.clear() | ||
| # A cleared store has a new access pattern to learn. | ||
| self._sparse_read_counts.clear() |
There was a problem hiding this comment.
MEDIUM
This reset only runs for v2 stores. clear() returns through Store.clear() for v1, although v1 also receives the new default auto mode, so a cleared v1 store retains its latch and stale counters. Subsequent reads can remain permanently in full mode or promote early; reset auto state in the common/v1 clear path as well.
There was a problem hiding this comment.
don't worry about v1
Summary by CodeRabbit
autoshard read mode, now the default.