eventstore: optimize event store SST file filtering#4984
eventstore: optimize event store SST file filtering#4984
Conversation
This reverts commit 5770a52.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
There was a problem hiding this comment.
Code Review
This pull request implements SST file filtering for the event store by introducing a custom Pebble table property collector to track transaction commit timestamps, optimizing read performance. Feedback suggests handling potential errors from db.NewIter to prevent panics and optimizing metrics collection within the filter closure by pre-fetching Prometheus counters to reduce overhead.
| iter, _ := db.NewIter(&pebble.IterOptions{ | ||
| LowerBound: start, | ||
| UpperBound: end, | ||
| TableFilter: newEventStoreSSTFileFilter( | ||
| lowerTs, | ||
| dataRange.CommitTsEnd, | ||
| ), | ||
| }) |
There was a problem hiding this comment.
The error returned by db.NewIter is ignored. If an error occurs (e.g., due to invalid bounds if CommitTsStart > CommitTsEnd), iter will be nil, which will cause a panic when iter.First() is called on line 939. It is recommended to handle the error and return early to avoid a potential crash.
| iter, _ := db.NewIter(&pebble.IterOptions{ | |
| LowerBound: start, | |
| UpperBound: end, | |
| TableFilter: newEventStoreSSTFileFilter( | |
| lowerTs, | |
| dataRange.CommitTsEnd, | |
| ), | |
| }) | |
| iter, err := db.NewIter(&pebble.IterOptions{ | |
| LowerBound: start, | |
| UpperBound: end, | |
| TableFilter: newEventStoreSSTFileFilter( | |
| lowerTs, | |
| dataRange.CommitTsEnd, | |
| ), | |
| }) | |
| if err != nil { | |
| log.Error("failed to create pebble iterator", | |
| zap.Stringer("dispatcherID", dispatcherID), | |
| zap.Error(err)) | |
| return nil | |
| } |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
4 similar comments
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: close #4939
What is changed and how it works?
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note