Commitlog offset index (#1671)

Signed-off-by: Shubham Mishra <shubham@clockworklabs.io>
Co-authored-by: Kim Altintop <kim@eagain.io>
This commit is contained in:
Shubham Mishra
2024-09-24 21:36:49 +05:30
committed by GitHub
parent eadea95a77
commit eeaa00a05f
14 changed files with 1837 additions and 1008 deletions
+2 -2
View File
@@ -230,8 +230,8 @@ impl<R: Repo, T> Generic<R, T> {
} else {
let byte_offset = segment::Header::LEN as u64 + bytes_read;
debug!("truncating segment {segment} to {offset} at {byte_offset}");
let file = self.repo.open_segment(segment)?;
file.ftruncate(byte_offset)?;
let mut file = self.repo.open_segment(segment)?;
file.ftruncate(offset, byte_offset)?;
// Some filesystems require fsync after ftruncate.
file.fsync()?;
break;