@@ -71,22 +71,18 @@ impl SstConcatIterator {
|
||||
}
|
||||
|
||||
fn move_until_valid(&mut self) -> Result<()> {
|
||||
loop {
|
||||
if let Some(iter) = self.current.as_mut() {
|
||||
if iter.is_valid() {
|
||||
break;
|
||||
}
|
||||
if self.next_sst_idx >= self.sstables.len() {
|
||||
self.current = None;
|
||||
} else {
|
||||
self.current = Some(SsTableIterator::create_and_seek_to_first(
|
||||
self.sstables[self.next_sst_idx].clone(),
|
||||
)?);
|
||||
self.next_sst_idx += 1;
|
||||
}
|
||||
} else {
|
||||
while let Some(iter) = self.current.as_mut() {
|
||||
if iter.is_valid() {
|
||||
break;
|
||||
}
|
||||
if self.next_sst_idx >= self.sstables.len() {
|
||||
self.current = None;
|
||||
} else {
|
||||
self.current = Some(SsTableIterator::create_and_seek_to_first(
|
||||
self.sstables[self.next_sst_idx].clone(),
|
||||
)?);
|
||||
self.next_sst_idx += 1;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -22,10 +22,8 @@ impl<A: StorageIterator, B: StorageIterator> TwoMergeIterator<A, B> {
|
||||
}
|
||||
|
||||
fn skip_b(&mut self) -> Result<()> {
|
||||
if self.a.is_valid() {
|
||||
if self.b.is_valid() && self.b.key() == self.a.key() {
|
||||
self.b.next()?;
|
||||
}
|
||||
if self.a.is_valid() && self.b.is_valid() && self.b.key() == self.a.key() {
|
||||
self.b.next()?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user