Skip to content

Commit

Permalink
Fix crash in replication logic when removing logs from interval. (ecl…
Browse files Browse the repository at this point in the history
…ipse-zenoh#933)

* Fix crash in replication logic when removing logs from interval.

Closes eclipse-zenoh#931
  • Loading branch information
pftbest authored Apr 16, 2024
1 parent 88573f3 commit 279317c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions plugins/zenoh-plugin-storage-manager/src/replica/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ impl Digest {

for int in intervals_to_update {
let interval = intervals.get_mut(&int).unwrap();
interval.content.retain(|x| subintervals.contains_key(x));
let content = &interval.content;
if !content.is_empty() {
// order the content, hash them
Expand All @@ -325,6 +326,7 @@ impl Digest {

for era_type in eras_to_update {
let era = eras.get_mut(&era_type).unwrap();
era.content.retain(|x| intervals.contains_key(x));
let content = &era.content;
if !content.is_empty() {
// order the content, hash them
Expand Down Expand Up @@ -491,11 +493,7 @@ impl Digest {
.get_mut(&subinterval)
.unwrap()
.content
.retain(|x| {
x.timestamp.get_time() != entry.timestamp.get_time()
&& x.timestamp.get_id() != entry.timestamp.get_id()
&& x.key != entry.key
});
.retain(|x| x.timestamp != entry.timestamp || x.key != entry.key);
subintervals_to_update.insert(subinterval);
}
if current.intervals.contains_key(&interval) {
Expand Down

0 comments on commit 279317c

Please sign in to comment.