Tier partitions in bound order and refuse to drop a non-empty partition - #73
Conversation
|
Warning Review limit reached
Next review available in: 45 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: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe archiver now processes partitions by range-bound order, uses one watermark snapshot per cycle, and verifies that stale partitions are empty before removal. Unit tests, architecture documentation, and tiered journey coverage validate these behaviors. ChangesBound-ordered archival
Estimated code review effort: 4 (Complex) | ~45 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/partition/partition_test.go (1)
356-390: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the
rows.Err()propagation path.
listPartitionsnow returnsrows.Err()before sorting (internal/partition/partition.golines 361-363), butmockRows.Err()always returnsnil. No test exercises the case where row iteration fails. Add a case where a mockErr()returns a non-nil error, and assertFindExpired/listPartitionspropagates it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/partition/partition_test.go` around lines 356 - 390, Add a test covering rows.Err() propagation through FindExpired/listPartitions by configuring the mock rows returned by mockDB to report a non-nil iteration error after row processing. Assert the returned error matches the injected error and that no successful partition result is used; extend the existing mockRows test setup or add a focused test alongside the FindExpired cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/partition/partition_test.go`:
- Around line 356-390: Add a test covering rows.Err() propagation through
FindExpired/listPartitions by configuring the mock rows returned by mockDB to
report a non-nil iteration error after row processing. Assert the returned error
matches the injected error and that no successful partition result is used;
extend the existing mockRows test setup or add a focused test alongside the
FindExpired cases.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 1342e0d5-7d85-4c60-b96b-7d7276762c9a
📒 Files selected for processing (6)
ci/journey.shcmd/archiver/main.gocmd/archiver/main_test.godocs/architecture_tiered.mdinternal/partition/partition.gointernal/partition/partition_test.go
9dd9cba to
0b9396b
Compare
Partitions past the hot window were tiered in name order while the
destructive branch compared bounds. With any naming whose text order differs
from calendar order (unpadded months, where "10" sorts before "9"), the first
cutover carried the watermark past a later partition, which was then dropped
as already-archived without ever being exported: rows in neither tier, exit 0.
Candidates now sort by bound. The watermark is read once per cycle instead of
once per partition, so loop order cannot change a partition's outcome.
Dropping a stale partition requires it to be empty rather than relying on the
watermark alone.
The two-level path was unaffected: it already grouped leaves by upper bound
and never consulted the watermark.
Closes #71