From 100a87226618c386b88cc797c8d1ebccb170d033 Mon Sep 17 00:00:00 2001 From: Ahmed Farghal Date: Fri, 31 May 2024 11:13:17 +0100 Subject: [PATCH] Do not fail iterator on range deletion tombstones --- crates/bifrost/src/loglets/local_loglet/read_stream.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/bifrost/src/loglets/local_loglet/read_stream.rs b/crates/bifrost/src/loglets/local_loglet/read_stream.rs index e995d7dc6..7da8d5d04 100644 --- a/crates/bifrost/src/loglets/local_loglet/read_stream.rs +++ b/crates/bifrost/src/loglets/local_loglet/read_stream.rs @@ -61,6 +61,11 @@ impl LocalLogletReadStream { let key = RecordKey::new(loglet.log_id, after.next()); let mut read_opts = rocksdb::ReadOptions::default(); read_opts.set_tailing(true); + // In some cases, the underlying ForwardIterator will fail it hits a RangeDelete tombstone. + // For our puroses, we can ignore these tombstones. TL;DR if loglet reader started before a + // trim point and data is readable, we should continue reading them. It's the + // responsibility of the upper layer to decide on a sane value of _after_. + read_opts.set_ignore_range_deletions(true); read_opts.set_prefix_same_as_start(true); read_opts.set_total_order_seek(false); read_opts.set_iterate_lower_bound(key.to_bytes());