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

KafkaRecordFetcher类的mayCommitCheckpoint、setToCommitCheckpoint方法有并发问题 #23

Open
songxinjianqwe opened this issue May 31, 2022 · 0 comments

Comments

@songxinjianqwe
Copy link

1、线程A调用了setToCommitCheckpoint,将toCommitCheckpoint更新为1
2、KafkaRecordFetcher线程调用了mayCommitCheckpoint,读到toCommitCheckpoint值为1,然后去commit 位点
3、线程A调用了setToCommitCheckpoint,将toCommitCheckpoint更新为2
4、KafkaRecordFetcher线程继续执行mayCommitCheckpoint方法,位点commit完毕,将toCommitCheckpoint置为空

那么这个时候位点2就丢失掉了,没法被commit了。
一种解法是第4步的时候,比较下toCommitCheckpoint是不是1,如果是1,则置为空,如果不是1,那么不置空

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant