Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

这里在崩溃的时候,会不会导致数据不一致 #30

Open
lutaoact opened this issue Apr 5, 2022 · 1 comment
Open

这里在崩溃的时候,会不会导致数据不一致 #30

lutaoact opened this issue Apr 5, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@lutaoact
Copy link

lutaoact commented Apr 5, 2022

如果数据文件已经被截断了,但索引文件尚未被更新,就会发生不一致。
所以我认为应该先保存 offset,然后清理索引,再清理数据。

@xnnyygn
Copy link
Owner

xnnyygn commented Apr 6, 2022

有可能。不过这里移除尾部日志理论上极少发生,而且处理文件写入过程中的宕机主要靠启动时的文件检查,写入自身能做的恢复处理不多。

你可以把两句位置移动一下,或者在初始化时检查两个文件数据是否一致。如果你提交pull request的话我这边会看一下。谢谢。

@xnnyygn xnnyygn added the enhancement New feature or request label Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants