recover readers exactly from checkpoint #1620
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题
之前在从checkpoint恢复reader时,无论之前reader在哪个位置,都会将reader放置到readerArray中,然后在后续移动到正确的位置。
如果出现日志轮转文件数量大于readArray最大大小时,并且出现inode复用,就会出现readerArray顺序错误(readerArray强要求,reader顺序按照文件轮转降序排列,即 log.2 log.1 log)
目前,已知导致的问题:
解决方法
在checkpoint中新增字段,保存reader在readerArray中的位置。
-2:不在队列中
-1:默认值,新建的reader,需要放置到readerArray末尾
>0:在readerArray中的实际位置
在从checkpoint中恢复的时候,根据不同的值,恢复reader到之前准确的位置。