Skip to content

Commit

Permalink
fix: fix query incorrect in case of concurrent delete (#38991)
Browse files Browse the repository at this point in the history
#38961

Signed-off-by: luzhang <[email protected]>
Co-authored-by: luzhang <[email protected]>
  • Loading branch information
zhagnlu and luzhang authored Jan 6, 2025
1 parent 731e882 commit 8165044
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions internal/core/src/segcore/DeletedRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,19 @@ class DeletedRecord {
accessor.lower_bound(std::make_pair(query_timestamp, 0));

auto it = start_iter;

// when end_iter point to skiplist end, concurrent delete may append new value
// after lower_bound() called, so end_iter is not logical valid.
if (end_iter == accessor.end()) {
while (it != accessor.end() && it->first <= query_timestamp) {
if (it->second < insert_barrier) {
bitset.set(it->second);
}
it++;
}
return;
}

while (it != accessor.end() && it != end_iter) {
if (it->second < insert_barrier) {
bitset.set(it->second);
Expand Down

0 comments on commit 8165044

Please sign in to comment.