Skip to content

Commit 3b49ebf

Browse files
committed
lsm/core: clear two-level data iterator before reload
If `_data_iter_fn` throws (e.g. a cloud-backed SST open fails), `_data_iter` previously retained the iterator from the prior block, leaving valid() reporting true against stale state. Null it before the await so the iterator is observably invalid on a thrown future.
1 parent b59c691 commit 3b49ebf

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/v/lsm/core/internal/two_level_iterator.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ class impl : public iterator {
7676

7777
private:
7878
ss::future<> init_data_block() {
79+
// Clear previous iterator first in case `_data_iter_fn` throws.
80+
_data_iter = nullptr;
81+
7982
if (!_index_iter->valid()) {
80-
_data_iter = nullptr;
8183
co_return;
8284
}
8385
auto handle = _index_iter->value();

0 commit comments

Comments
 (0)