Skip to content

Commit 65b7bec

Browse files
Besroyyawzhang
andauthored
[StreamTracker] allow rollback to start-1 (#294)
Related issue: eBay/HomeStore#857 Co-authored-by: yawzhang <yawzhang@ebay.com>
1 parent bda25f1 commit 65b7bec

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class SISLConan(ConanFile):
1111
name = "sisl"
12-
version = "13.2.1"
12+
version = "13.2.2"
1313

1414
homepage = "https://github.com/eBay/sisl"
1515
description = "Library for fast data structures, utilities"

include/sisl/fds/stream_tracker.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ class StreamTracker {
9090

9191
void rollback(int64_t new_end_idx) {
9292
auto holder = std::shared_lock< folly::SharedMutex >(m_lock);
93+
// Special case: allow rollback exactly to (start_idx - 1), which clears all slots >= start
94+
if (new_end_idx + 1 == m_slot_ref_idx) {
95+
m_active_slot_bits.reset_bits(0, m_active_slot_bits.size());
96+
m_comp_slot_bits.reset_bits(0, m_comp_slot_bits.size());
97+
return;
98+
}
9399
if ((new_end_idx < m_slot_ref_idx) ||
94100
(new_end_idx >= (m_slot_ref_idx + int64_cast(m_active_slot_bits.size())))) {
95101
throw std::out_of_range("Slot idx is not in range");

0 commit comments

Comments
 (0)