Skip to content

Commit

Permalink
fix: replay memtable should from flushed_entry_id + 1
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Dec 28, 2023
1 parent 907211a commit 3cda5df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/log-store/src/kafka/log_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,8 @@ impl LogStore for KafkaLogStore {
&& entry.ns.region_id == region_id
{
yield Ok(entries);
} else {
yield Ok(vec![]);
}

// Terminates the stream if the entry with the end offset was read.
if record_offset >= end_offset {
debug!(
Expand Down
4 changes: 3 additions & 1 deletion src/mito2/src/region/opener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,9 @@ pub(crate) async fn replay_memtable<S: LogStore>(
// data in the WAL.
let mut last_entry_id = flushed_entry_id;
let mut region_write_ctx = RegionWriteCtx::new(region_id, version_control, wal_options.clone());
let mut wal_stream = wal.scan(region_id, flushed_entry_id, wal_options)?;

let replay_from_entry_id = flushed_entry_id + 1;
let mut wal_stream = wal.scan(region_id, replay_from_entry_id, wal_options)?;
while let Some(res) = wal_stream.next().await {
let (entry_id, entry) = res?;
last_entry_id = last_entry_id.max(entry_id);
Expand Down

0 comments on commit 3cda5df

Please sign in to comment.