Merge 'fix/mvcc: set log offset to end of file after recovery finishes' from Jussi Saurio

otherwise we start overwriting existing log entries
Closes #3495

Reviewed-by: Nikita Sivukhin (@sivukhin)
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #3496
This commit is contained in:
Jussi Saurio
2025-10-01 13:52:12 +03:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@@ -1973,6 +1973,8 @@ impl<Clock: LogicalClock> MvStore<Clock> {
self.delete(tx_id, rowid)?;
}
StreamingResult::Eof => {
// Set offset to the end so that next writes go to the end of the file
self.storage.logical_log.write().unwrap().offset = reader.offset as u64;
break;
}
}

View File

@@ -14,7 +14,7 @@ use crate::{types::IOResult, File};
pub struct LogicalLog {
pub file: Arc<dyn File>,
offset: u64,
pub offset: u64,
}
/// Log's Header, this will be the 64 bytes in any logical log file.
@@ -231,7 +231,7 @@ enum StreamingState {
pub struct StreamingLogicalLogReader {
file: Arc<dyn File>,
/// Offset to read from file
offset: usize,
pub offset: usize,
/// Log Header
header: Option<Arc<LogHeader>>,
/// Cached buffer after io read