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

可能发生错过任务情况 #2391

Open
xingcong1991 opened this issue May 8, 2024 · 0 comments
Open

可能发生错过任务情况 #2391

xingcong1991 opened this issue May 8, 2024 · 0 comments

Comments

@xingcong1991
Copy link

xingcong1991 commented May 8, 2024

版本: 2.1.5,按平均分配策略
3个节点A、B、C ,6个任务,那么A节点分配 1、2两个任务,B节点分配 3、4两个任务,C节点分配5、6 任务
如果此时到了触发时间并且C宕机, 那么发生重分片,由于 判断 重分片的依据是 存在 necessary 节点,因为com.dangdang.ddframe.job.lite.internal.sharding.ShardingListenerManager.ListenServersChangedJobListener#dataChanged
创建 necessary 节点和shardingIfNecessary方法判断是否有necessary 节点 是两处,并不同步,那么如果此时A节点没发现 necessary 节点,那么会获取当前 1、2两个任务进行执行,直到执行完毕,然后进行 重分片,重分片A得到1、2、5任务,B得到3、4、6任务, 此时B会执行,A因为刚执行一次, 得等下一次 执行, 此时5任务这一轮就错过了,当然自动转移可以解决,但是如果其他分片策略可能 导致 任务 错过
另:客户端reconnected下在3节点 , 8 分片,假设C节点断开, A 、B 节点分别对应 1、2、3、4和5、6、7、8分片,如果C连接回来,A对应 1、2、7分片,此时在C连接回来重分片前,A执行完毕, 重分片后因A执行完毕,那么任务7在本轮可能错过

@xingcong1991 xingcong1991 changed the title 可能发生漏任务情况 可能发生错过任务情况 May 8, 2024
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