fix/mvcc: set log offset to end of file after recovery finishes

otherwise we start overwriting existing log entries
This commit is contained in:
Jussi Saurio
2025-10-01 12:45:30 +03:00
parent d2863dd62f
commit e9f0c59bcc
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