Skip to content

Commit 698bbef

Browse files
committed
fixup! commitlog: Resumption of sealed commitlog
1 parent 6473e6d commit 698bbef

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • crates/commitlog/src/repo

crates/commitlog/src/repo/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,12 @@ pub fn resume_segment_writer<R: Repo>(
289289
max_commit: _,
290290
} = meta;
291291
let mut writer = repo.open_segment_writer(offset)?;
292+
// Ensure we have enough space for this segment.
293+
// The segment could have been created without the `fallocate` feature
294+
// enabled, so we call this here again to ensure writes can't fail due
295+
// to ENOSPC.
296+
fallocate(&mut writer, &opts)?;
297+
// We use `O_APPEND`, but make the file offset consistent regardless.
292298
writer.seek(io::SeekFrom::End(0))?;
293299

294300
Ok(Ok(Writer {

0 commit comments

Comments
 (0)