This is an automated email from the ASF dual-hosted git repository.

menghaoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 6a2c554  Modify add event for Etcd (#12544)
6a2c554 is described below

commit 6a2c554c5d103a0c2eec89116b9e26e88f7fad8f
Author: zhaojinchao <[email protected]>
AuthorDate: Sat Sep 18 16:01:24 2021 +0800

    Modify add event for Etcd (#12544)
    
    * fixed etcd add event
    
    * update
---
 .../shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java    | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-repository/shardingsphere-cluster-mode-repository-provider/shardingsphere-cluster-mode-repository-etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java
 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-repository/shardingsphere-cluster-mode-repository-provider/shardingsphere-cluster-mo
 [...]
index efbd906..0a839d0 100644
--- 
a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-repository/shardingsphere-cluster-mode-repository-provider/shardingsphere-cluster-mode-repository-etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java
+++ 
b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-repository/shardingsphere-cluster-mode-repository-provider/shardingsphere-cluster-mode-repository-etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java
@@ -126,6 +126,9 @@ public final class EtcdRepository implements 
ClusterPersistRepository {
     }
     
     private Type getEventChangedType(final WatchEvent event) {
+        if (1 == event.getKeyValue().getVersion()) {
+            return Type.ADDED;
+        }
         switch (event.getEventType()) {
             case PUT:
                 return Type.UPDATED;

Reply via email to