mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-30 14:34:22 +01:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user