ExploreHeart opened a new issue, #2395: URL: https://github.com/apache/shardingsphere-elasticjob/issues/2395
https://github.com/apache/shardingsphere-elasticjob/blob/d94ce276d9763509cf86246f809d2e714e8500a5/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/sharding/ShardingService.java#L129 ### 当前判断条件 1. 非主节点:!leaderService.isLeaderUntilBlock() ; 2. 存在需要分片标识或者主节点插入正在分片标识:(jobNodeStorage.isJobNodeExisted(ShardingNode.NECESSARY) || jobNodeStorage.isJobNodeExisted(ShardingNode.PROCESSING)) ### 触发死循环条件 1. 主分片完成后,分片标识被重新插入(实例上线或者下线); 2. 触发这个场景后,从节点将一直循环请求ZK到下一轮任务调度; 3. 当前逻辑是100ms执行上述判断逻辑,对ZK请求4次,单个任务对ZK请求=40次/s; ### 优化思路 1. 任务执行调度时,插入当前轮次执行时间和下一轮执行时间到上下文中; 2. 主节点分片完成后,插入分片完成时间到leader/sharding节点 3. 从节点等待分片完成逻辑,增加读取主节点分片完成时间判断,当(分片完成时间>当前轮次&&分片完成时间<下一轮次 )或者 分片完成时间>=下一轮次时,退出分片等待完成循环 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
