-
Notifications
You must be signed in to change notification settings - Fork 713
fix: ordering of events in a partition #8520
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:
|
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 Summary
This PR fixes a critical ordering issue in the search cache service where events within a single partition were being returned in unpredictable chronological order. The change re-enables previously commented-out sorting logic that ensures proper ordering of cached search responses.
The fix operates at two levels:
- Single Partition Sorting: Re-activates the
sort_responsefunction call for single-result scenarios (lines 328-336), ensuring that even when there's only one partition, the events are properly sorted before being returned. - Default Ordering Enhancement: Improves the
sort_responsefunction (lines 660-671) to provide fallback timestamp-based ordering when no explicit ORDER BY clause is specified in the query.
This addresses a gap in the search functionality where multi-partition results were properly sorted through the merge_response function, but single-partition results bypassed sorting entirely. The change is particularly important for OpenObserve's temporal data analysis capabilities, as consistent chronological ordering is essential for caching, pagination, and user experience. The enhancement ensures that all search results maintain proper ordering regardless of whether they come from single or multiple partitions, using timestamp-based sorting as a reliable fallback when no explicit ordering criteria are provided.
Confidence score: 4/5
- This PR is safe to merge with low risk as it restores expected functionality
- Score reflects a straightforward bug fix that re-enables existing, tested sorting logic
- Pay close attention to the sort_response function changes to ensure default ordering logic is correct
1 file reviewed, no comments
PR Code Suggestions ✨Explore these optional code suggestions:
|
c063874 to
10946b8
Compare
10946b8 to
66ac592
Compare
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 376 | 351 | 0 | 21 | 4 | 93% | 4m 31s |
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 376 | 351 | 0 | 21 | 4 | 93% | 5m 5s |
PR Type
Bug fix, Enhancement
Description
Fix event ordering in fallback path
Enable sorting when no order specified
Respect ascending/descending by timestamp
Remove unused param underscore usage
Diagram Walkthrough
File Walkthrough
mod.rs
Correct sorting logic and default orderingsrc/service/search/cache/mod.rs