raft-rs icon indicating copy to clipboard operation
raft-rs copied to clipboard

Entries might overflow the max_msg_size by batching

Open Fullstop000 opened this issue 5 years ago • 2 comments

https://github.com/tikv/raft-rs/blob/f7f7d0121132ef6406b59fc774778285cd1477d6/src/raft.rs#L565-L566 try_batch doesn't check the entries size after batched which might cause the overflow. Do we need to worry about this?

@hicqu @BusyJay

Fullstop000 avatar Dec 05 '19 06:12 Fullstop000

It could cause some messages contain more entries than max_batch_size. But I guess no overflow issue is introduced. I think the behavior needs to be changed.

hicqu avatar Dec 05 '19 06:12 hicqu

Maybe we can just add utils::limit_size(after_batched_msg.entries, self.max_msg_size). But we still get some extra cost from the self.raft_log.entries().

Fullstop000 avatar Dec 05 '19 06:12 Fullstop000