Skip to content

Commit b2e6e54

Browse files
propagate resize errors
1 parent b881c8a commit b2e6e54

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

storage/src/journal/segmented/variable.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,13 @@ impl<E: Storage + Metrics, V: CodecShared> Journal<E, V> {
402402
new_size = state.valid_offset,
403403
"trailing bytes detected: truncating"
404404
);
405-
state.blob.resize(state.valid_offset).await.ok()?;
405+
if let Err(err) =
406+
state.blob.resize(state.valid_offset).await
407+
{
408+
batch.push(Err(err.into()));
409+
state.done = true;
410+
return Some((batch, state));
411+
}
406412
}
407413
state.done = true;
408414
return if batch.is_empty() {
@@ -428,7 +434,11 @@ impl<E: Storage + Metrics, V: CodecShared> Journal<E, V> {
428434
new_size = state.valid_offset,
429435
"incomplete item at end: truncating"
430436
);
431-
state.blob.resize(state.valid_offset).await.ok()?;
437+
if let Err(err) = state.blob.resize(state.valid_offset).await {
438+
batch.push(Err(err.into()));
439+
state.done = true;
440+
return Some((batch, state));
441+
}
432442
state.done = true;
433443
return if batch.is_empty() {
434444
None

0 commit comments

Comments
 (0)