feat(server): OURIOS_COMPACTION_ENABLED to disable a pod's compaction sweep - #303
Conversation
|
Warning Review limit reached
More reviews will be available in 42 minutes and 21 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?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 credits. 🚦 How do rate 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 see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds ChangesCompaction Opt-Out Control
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
…TION_ENABLED The binary always ran the compaction sweep, so a multi-pod deployment had every receiver/querier/compactor pod sweeping (publish_cas-safe but redundant object listing each interval). Add OURIOS_COMPACTION_ENABLED (default on; opt-out via a falsey value, unlike the opt-in receiver/querier roles): when off, the process skips building/running the compactor entirely, so a deployment can disable it on receiver+querier pods and run a single dedicated compactor. Default-on preserves existing behavior; the small-file hazard (#4) is unchanged for any deployment that keeps a sweeper running. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
b93b292 to
05444fe
Compare
There was a problem hiding this comment.
Pull request overview
Adds an opt-out switch for the server’s background compaction role so multi-pod deployments can run compaction on a single dedicated pod while other pods focus on receiver/querier roles.
Changes:
- Introduces
OURIOS_COMPACTION_ENABLED(default on) and threads it through config assembly. - Makes compactor/audit-sink construction conditional and keeps the main loop alive via a pending future when compaction is disabled.
- Adds unit tests validating the opt-out behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@crates/ourios-server/src/main.rs`:
- Around line 411-441: The compaction branch in main should emit subsystem
telemetry for both states and stop using stderr for hot-path failures. Update
the `compactor`/`compaction` flow to publish a Prometheus metric or gauge
indicating whether compaction is enabled or disabled for this pod, and make sure
the disabled `None` path records that state explicitly. Replace the `eprintln!`
calls inside `Compactor::run`’s callback with structured Ourios logging (using
the server’s logging path) so sweep errors and `compaction sweep failed` are
visible in telemetry with context.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 1b398417-a2b0-4307-a67a-43d4c88275cf
📒 Files selected for processing (1)
crates/ourios-server/src/main.rs
Per review: build the compactor via an explicit if (clone audit_store only when enabled, don't move store into a never-run closure); skip interval parsing when compaction is disabled so a disabled pod won't fail on an unused knob; and log the disabled state at startup so it's visible in a multi-pod rollout. Tests: disabled config tolerates a bad interval. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The slice-2d 'audit sink wired unconditionally' comment was left truncated and contradicts the new compaction-enabled control flow; replace it with one comment describing the conditional build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What
Adds
OURIOS_COMPACTION_ENABLED(default on) toourios-server. When set to a falsey value (0/false/no/off), the process skips building and running the compaction sweep entirely. This is opt-out (unlike the opt-inOURIOS_RECEIVER_ENABLED/OURIOS_QUERIER_ENABLEDroles).Why
The binary unconditionally ran the background compaction sweep, so a multi-pod deployment (receiver StatefulSet + querier Deployment + compactor) had every pod sweeping on its interval.
publish_casmakes concurrent sweeps correct (losers no-op), but it's redundant load — N pods each listing the bucket every interval. This flag lets the Helm chart disable compaction on the receiver + querier pods so a single dedicated compactor sweeps (the clean topology for the S3-native chart, workstream C).Behavior / invariants
Compactorand no audit sink; the run loop runs the receiver/querier (if enabled) + waits for SIGINT/SIGTERM (the compaction branch is apendingfuture).publish_cas(RFC 0009 §3.2 / RFC0013.3-4) keeps any concurrent sweeps safe regardless.Tests
build_config_compaction_is_opt_out(default + non-falsey → on;0/false/no/off/trimmed → off);rfc0019_7asserts default-on.cargo fmt,clippy -D warnings,cargo test -p ourios-server(20 passed),cargo doc -D warnings— all green.Follow-on
The S3-native Helm chart (workstream C) sets
OURIOS_COMPACTION_ENABLED=0on the receiver + querier workloads and leaves it default-on for the dedicated compactor Deployment.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes