You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/07/16 08:24:51 UTC

[GitHub] [shardingsphere-elasticjob] Technoboy- opened a new issue #1085: Shard is not working when instance node removes

Technoboy- opened a new issue #1085:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1085


   In master branch, after we upgrade curator and zookeeper version. we face a new bug.
   Scenario:
   Config a job with 2 shard items and param '0=A,1=B',  start two process.
   Process A gets item 0, and process B gets item 1.
   Then shutdown process B, process A should take over the item 1, but not working.
   
   Guess to lose curator event or other bug


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] terrymanu closed issue #1085: Shard is not working when instance node removes

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #1085:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1085


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere-elasticjob] Technoboy- commented on issue #1085: Shard is not working when instance node removes

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on issue #1085:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/1085#issuecomment-659288940


   The reason is described below:
   ```
   public abstract class AbstractJobListener implements CuratorCacheListener {
       
       @Override
       public final void event(final Type type, final ChildData oldData, final ChildData data) {
           if (null == data) {
               return;
           }
           String path = data.getPath();
           if (path.isEmpty()) {
               return;
           }
           dataChanged(path, type, null == data.getData() ? "" : new String(data.getData(), Charsets.UTF_8));
       }
       
       protected abstract void dataChanged(String path, Type eventType, String data);
   }
   ```
   The new curator API for listening node should implements CuratorCacheListener, and this method add new parameters.
    - ChildData oldData : is the snapshot of the old node data 
    -  ChildData data : is the new node data
    If the type is NODE_DELETED, the data will be null, and will be filtered.
   So, we have made the updates below:
   ```
   public abstract class AbstractJobListener implements CuratorCacheListener {
       
       @Override
       public final void event(final Type type, final ChildData oldData, final ChildData newData) {
           if (null == newData && null == oldData) {
               return;
           }
           String path = Type.NODE_DELETED == type ? oldData.getPath() : newData.getPath();
           byte[] data = Type.NODE_DELETED == type ? oldData.getData() : newData.getData();
           if (path.isEmpty()) {
               return;
           }
           dataChanged(path, type, null == data ? "" : new String(data, Charsets.UTF_8));
       }
       
       protected abstract void dataChanged(String path, Type eventType, String data);
   }
   ```


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org