[Store] Skip BatchQuery when offloading_objects is empty (#2138)#2204
[Store] Skip BatchQuery when offloading_objects is empty (#2138)#2204io-wy wants to merge 3 commits into
Conversation
The boundary check `qp_index > qp_list_.size()` misses the case where `qp_index == size()`, allowing an out-of-bounds access to `qp_list_[size()]`. This reads a wild pointer and passes it to `ibv_modify_qp()`, leading to segfault or silent memory corruption. Fix by changing `>` to `>=` so that all invalid indices are rejected.
This reverts commit df1134d.
…2138) When no objects need offloading (steady state without eviction), OffloadObjects() still built an empty bucket and called BatchQuerySegmentSlices with an empty keys vector. BatchQuery() returned an empty result, triggering an INVALID_REPLICA error log that confused operators. Fix by early-returning from OffloadObjects when the input map is empty, avoiding the unnecessary query and log noise.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a fast-path in FileStorage::OffloadObjects to skip bucketization/backend work when there’s nothing to offload.
Changes:
- Return early from
OffloadObjectswhenoffloading_objectsis empty.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request introduces an early return in the FileStorage::OffloadObjects function when the offloading_objects map is empty, preventing unnecessary processing. As there were no review comments provided for this change, I have no feedback to provide.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Thanks for this fix. Your approach is correct. However, this issue has already been fixed in PR #2151. |
Fixes #2138
When no objects need offloading (steady state without eviction),
OffloadObjects()still built an empty bucket and calledBatchQuerySegmentSliceswith an empty keys vector.BatchQuery()returned an empty result, triggering anINVALID_REPLICAerror log that confused operators.Root cause
In the non-
BucketStorageBackendpath:The empty bucket is then iterated, and
BatchQuerySegmentSlices([])returnsINVALID_REPLICAbecauseBatchQuery([])yields an empty result vector.Fix
Early-return from
OffloadObjectswhen the input map is empty, avoiding the unnecessary query and log noise.