openmessaging / dledger

A raft-based java library for building high-available, high-durable, strong-consistent commitlog.
Apache License 2.0
801 stars 315 forks source link

跟随者(follower)append分析问题 #320

Open leehom opened 3 months ago

leehom commented 3 months ago

首先分析一下pendingMap的状态

image

pengding请求过时,writeIndex调回到水位线+1作为写入点,

再看跟随者的处理 image 3.1.1 处理有点不解,按pendingMap分析,writeIndex2那批可能被返回不一致,处理没错,但本人认为更好的处理应该是保证写入点连续性即好,过期的请求删去就可以,一直走第二部分请求,若返回不一致,领导者进入比对,降低效率