apache / shardingsphere-elasticjob

Distributed scheduled job
Apache License 2.0
8.09k stars 3.28k forks source link

容器场景批量重启会造成服务器节点错删 #2394

Open ExploreHeart opened 1 month ago

ExploreHeart commented 1 month ago

https://github.com/apache/shardingsphere-elasticjob/blob/d94ce276d9763509cf86246f809d2e714e8500a5/kernel/src/main/java/org/apache/shardingsphere/elasticjob/kernel/internal/server/ServerService.java#L121 当前逻辑是先插入服务器节点,再插入实例节点,这两个操作不是事务的;当SDK在重启的时候:

  1. A客户端先拿到zk上的实例节点
  2. B客户端插入了服务器节点
  3. A客户端获取zk上的服务器节点
  4. A客户端拿到的实例节点中不存在B客户端的实例IP,导致后续遍历删除时,会删除B客户端的服务器节点。

    能否把SetUpFacade#registerStartUpInfo方法中插入服务器节点和实例节点做出事务操作?

songxiaosheng commented 1 month ago

感觉容器环境未来直接移除持久节点的使用会好点