-
Notifications
You must be signed in to change notification settings - Fork 715
perf: no need watch data retention events #8866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
Optimizes the data retention deletion system by disabling watch events for date-range-specific deletions while keeping them enabled for full stream deletions.
Key Changes:
- Modified
delete_streamandprocess_streamto conditionally setneed_watchbased on whetherdate_rangeisNone(full deletion) orSome(partial deletion) - When deleting all stream data (
date_range.is_none()), watch events are still triggered (need_watch = true) to ensure cluster-wide coordination - When deleting specific date ranges, watch events are now disabled (
need_watch = false) to reduce unnecessary event overhead for routine retention operations
Performance Impact:
- Reduces watch event traffic for date-range deletions, which are more frequent routine operations
- Maintains critical watch events for full stream deletions, which require cluster coordination
Identified Issue:
delete_stream_donefunction (line 124) still unconditionally usesdb::NEED_WATCHfor all deletions, creating an inconsistency with the new pattern established in this PR
Confidence Score: 3/5
- This PR is safe to merge with moderate risk due to an inconsistency that should be addressed
- The optimization logic is sound and reduces unnecessary watch events for routine operations. However, there's an inconsistency:
delete_stream_done(src/service/db/compact/retention.rs:124) still always usesdb::NEED_WATCHregardless ofdate_range, which contradicts the new pattern. This won't cause failures but creates asymmetry in watch behavior between creation and completion of date-range deletions. - src/service/db/compact/retention.rs - The
delete_stream_donefunction should apply the same conditional watch logic for consistency
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| src/service/db/compact/retention.rs | 3/5 | Optimizes watch events for date-range deletions to reduce overhead, but has an inconsistency with delete_stream_done which still always watches |
Sequence Diagram
sequenceDiagram
participant Client
participant RetentionAPI as retention::delete_stream
participant DB as db::put
participant Watcher as retention::watch
participant Cache as CACHE
Note over Client,Cache: Scenario 1: Delete ALL stream data
Client->>RetentionAPI: delete_stream(date_range=None)
RetentionAPI->>RetentionAPI: Check CACHE (rate limit)
RetentionAPI->>Cache: Insert key with timestamp
RetentionAPI->>DB: put(key, "OK", need_watch=true)
DB->>Watcher: Trigger watch event (Put)
Watcher->>Cache: Update CACHE
Note over Client,Cache: Scenario 2: Delete specific date range
Client->>RetentionAPI: delete_stream(date_range=Some((start, end)))
RetentionAPI->>RetentionAPI: Check CACHE (rate limit)
RetentionAPI->>Cache: Insert key with timestamp
RetentionAPI->>DB: put(key, "OK", need_watch=false)
Note over DB,Watcher: No watch event triggered (optimization)
Note over Client,Cache: Issue: delete_stream_done inconsistency
Client->>RetentionAPI: delete_stream_done(date_range=Some(...))
RetentionAPI->>DB: delete_if_exists(key, need_watch=true)
DB->>Watcher: Triggers watch even for date ranges
Note over Watcher: Inconsistent: should not watch for date ranges
1 file reviewed, 1 comment
Testdino Test Results
|
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 365 | 339 | 0 | 19 | 7 | 93% | 5m 12s |
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 365 | 342 | 0 | 19 | 4 | 94% | 5m 13s |
YashodhanJoshi1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a minor nit, but otherwise lgtm
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 365 | 342 | 0 | 19 | 4 | 94% | 4m 39s |
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 365 | 343 | 0 | 19 | 3 | 94% | 4m 39s |
- [x] perf: no need watch data retention events - [x] perf: cache latest version if get from db - [x] fix: cache missing of schema
Uh oh!
There was an error while loading. Please reload this page.