Skip to content

Commit 1503050

Browse files
zhaohaidao赵海源
andauthored
chore: abort last not complete batch (#91)
Co-authored-by: 赵海源 <[email protected]>
1 parent 92f8c0b commit 1503050

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/fluss/src/record/arrow.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,11 @@ impl<'a> LogRecordsBatchs<'a> {
369369

370370
let batch_size_bytes =
371371
LittleEndian::read_i32(self.data.get(self.current_pos + LENGTH_OFFSET..).unwrap());
372-
Some(batch_size_bytes as usize + LOG_OVERHEAD)
372+
let batch_size = batch_size_bytes as usize + LOG_OVERHEAD;
373+
if batch_size > self.remaining_bytes {
374+
return None;
375+
}
376+
Some(batch_size)
373377
}
374378
}
375379

0 commit comments

Comments
 (0)