backup: break one key scan when met delete version
@@ -472,11 +472,15 @@ impl<S: Snapshot> ScanPolicy<S> for LatestEntryPolicy {
write: entry_write,
});
}
- WriteType::Delete if self.output_delete => {
+ WriteType::Delete => {
+ if self.output_delete {
break Some(TxnEntry::Commit {
default: (Vec::new(), Vec::new()),
write: (write_key.to_vec(), write_value.to_vec()),
});
+ } else {
+ break None;
+ }
}
_ => {}
}
@@ -1436,6 +1440,8 @@ mod latest_entry_tests {
check(10, 3, true, vec![&entry_a_7, &entry_b_10]);
// Scanning entries in (0, 5] should get a_3 and b_1
check(5, 0, true, vec![&entry_a_3, &entry_b_1]);
+ // Scanning entries without delete in (0, 10] should get a_7
+ check(10, 0, false, vec![&entry_a_7]);
}
}
