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

soulasuna 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 6eca117158a Pass UUID to governance center repository. (#21632)
6eca117158a is described below

commit 6eca117158ad3f9054ccd3717a320f01bc14655d
Author: zhaojinchao <[email protected]>
AuthorDate: Wed Oct 19 12:01:20 2022 +0800

    Pass UUID to governance center repository. (#21632)
    
    * Pass UUID to governance center repository.
    
    * Fix checkstyle
    
    * Fix checkstyle
    
    * fix
    
    * Revise
---
 .../namespace/fixture/FixtureClusterPersistRepository.java    |  3 ++-
 .../mode/manager/cluster/ClusterContextManagerBuilder.java    |  3 ++-
 .../coordinator/ClusterPersistRepositoryFactoryTest.java      |  4 +++-
 .../coordinator/fixture/ClusterPersistRepositoryFixture.java  |  3 ++-
 .../process/ProcessListClusterPersistRepositoryFixture.java   |  3 ++-
 .../mode/repository/cluster/ClusterPersistRepository.java     |  4 +++-
 .../repository/cluster/ClusterPersistRepositoryFactory.java   |  6 ++++--
 .../mode/repository/cluster/consul/ConsulRepository.java      |  3 ++-
 .../mode/repository/cluster/etcd/EtcdRepository.java          |  3 ++-
 .../mode/repository/cluster/nacos/NacosRepository.java        |  3 ++-
 .../cluster/zookeeper/CuratorZookeeperRepository.java         |  8 ++++++--
 .../cluster/zookeeper/listener/SessionConnectionListener.java |  8 +++++---
 .../cluster/zookeeper/CuratorZookeeperRepositoryTest.java     | 11 ++++++-----
 .../proxy/fixture/ClusterPersistRepositoryFixture.java        |  3 ++-
 .../driver/fixture/TestClusterPersistRepository.java          |  3 ++-
 .../data/pipeline/framework/watcher/ScalingWatcher.java       |  4 +++-
 .../data/pipeline/core/util/PipelineContextUtil.java          |  4 +++-
 17 files changed, 51 insertions(+), 25 deletions(-)

diff --git 
a/jdbc/spring/core/spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/fixture/FixtureClusterPersistRepository.java
 
b/jdbc/spring/core/spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/fixture/FixtureClusterPersistRepository.java
index c97afd229c0..fc52507236e 100644
--- 
a/jdbc/spring/core/spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/fixture/FixtureClusterPersistRepository.java
+++ 
b/jdbc/spring/core/spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/fixture/FixtureClusterPersistRepository.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.spring.namespace.fixture;
 
 import org.apache.shardingsphere.infra.database.DefaultDatabase;
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import 
org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEventListener;
@@ -33,7 +34,7 @@ public final class FixtureClusterPersistRepository implements 
ClusterPersistRepo
     private final Map<String, String> registryData = new LinkedHashMap<>();
     
     @Override
-    public void init(final ClusterPersistRepositoryConfiguration config) {
+    public void init(final ClusterPersistRepositoryConfiguration config, final 
InstanceMetaData instanceMetaData) {
         registryData.put("/metadata", DefaultDatabase.LOGIC_NAME);
     }
     
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
index 839be7ddfe3..15c0d6f282f 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
@@ -46,7 +46,8 @@ public final class ClusterContextManagerBuilder implements 
ContextManagerBuilder
     
     @Override
     public ContextManager build(final ContextManagerBuilderParameter 
parameter) throws SQLException {
-        ClusterPersistRepository repository = 
ClusterPersistRepositoryFactory.getInstance((ClusterPersistRepositoryConfiguration)
 parameter.getModeConfiguration().getRepository());
+        ClusterPersistRepository repository = 
ClusterPersistRepositoryFactory.getInstance((ClusterPersistRepositoryConfiguration)
 parameter.getModeConfiguration().getRepository(),
+                parameter.getInstanceMetaData());
         MetaDataPersistService persistService = new 
MetaDataPersistService(repository);
         persistConfigurations(persistService, parameter);
         RegistryCenter registryCenter = new RegistryCenter(repository, new 
EventBusContext(), parameter.getInstanceMetaData(), 
parameter.getDatabaseConfigs());
diff --git 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterPersistRepositoryFactoryTest.java
 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterPersistRepositoryFactoryTest.java
index 0c8d1779e47..67b94ae4704 100644
--- 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterPersistRepositoryFactoryTest.java
+++ 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterPersistRepositoryFactoryTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.mode.manager.cluster.coordinator;
 
+import 
org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryFactory;
 import org.junit.Test;
@@ -30,6 +31,7 @@ public final class ClusterPersistRepositoryFactoryTest {
     
     @Test
     public void assertNewInstance() {
-        assertThat(ClusterPersistRepositoryFactory.getInstance(new 
ClusterPersistRepositoryConfiguration("FIXTURE", "", "", new 
Properties())).getType(), is("FIXTURE"));
+        assertThat(ClusterPersistRepositoryFactory.getInstance(new 
ClusterPersistRepositoryConfiguration("FIXTURE", "", "", new Properties()),
+                new ProxyInstanceMetaData("foo_id", 3307)).getType(), 
is("FIXTURE"));
     }
 }
diff --git 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/fixture/ClusterPersistRepositoryFixture.java
 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/fixture/ClusterPersistRepositoryFixture.java
index a1483752820..ce38fcd3c17 100644
--- 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/fixture/ClusterPersistRepositoryFixture.java
+++ 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/fixture/ClusterPersistRepositoryFixture.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.mode.manager.cluster.coordinator.fixture;
 
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import 
org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEventListener;
@@ -28,7 +29,7 @@ import java.util.concurrent.Executor;
 public final class ClusterPersistRepositoryFixture implements 
ClusterPersistRepository {
     
     @Override
-    public void init(final ClusterPersistRepositoryConfiguration config) {
+    public void init(final ClusterPersistRepositoryConfiguration config, final 
InstanceMetaData instanceMetaData) {
     }
     
     @Override
diff --git 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/process/ProcessListClusterPersistRepositoryFixture.java
 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/process/ProcessListClusterPersistRepositoryFixture.java
index 450609903a9..69004bf3a3b 100644
--- 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/process/ProcessListClusterPersistRepositoryFixture.java
+++ 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/process/ProcessListClusterPersistRepositoryFixture.java
@@ -17,6 +17,7 @@
 
 package 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.process;
 
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import 
org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEventListener;
@@ -32,7 +33,7 @@ public final class ProcessListClusterPersistRepositoryFixture 
implements Cluster
     private static final Map<String, String> REGISTRY_DATA = new 
LinkedHashMap<>();
     
     @Override
-    public void init(final ClusterPersistRepositoryConfiguration config) {
+    public void init(final ClusterPersistRepositoryConfiguration config, final 
InstanceMetaData instanceMetaData) {
     }
     
     @Override
diff --git 
a/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/ClusterPersistRepository.java
 
b/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/ClusterPersistRepository.java
index 3f91d4c9459..686371b6938 100644
--- 
a/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/ClusterPersistRepository.java
+++ 
b/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/ClusterPersistRepository.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.mode.repository.cluster;
 
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import org.apache.shardingsphere.mode.persist.PersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEventListener;
 
@@ -31,8 +32,9 @@ public interface ClusterPersistRepository extends 
PersistRepository {
      * Initialize registry center.
      *
      * @param config cluster persist repository configuration
+     * @param instanceMetaData instance meta data
      */
-    void init(ClusterPersistRepositoryConfiguration config);
+    void init(ClusterPersistRepositoryConfiguration config, InstanceMetaData 
instanceMetaData);
     
     /**
      * Get current time from registry center.
diff --git 
a/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/ClusterPersistRepositoryFactory.java
 
b/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/ClusterPersistRepositoryFactory.java
index cbf5a65ddca..ba839933b8f 100644
--- 
a/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/ClusterPersistRepositoryFactory.java
+++ 
b/mode/type/cluster/repository/api/src/main/java/org/apache/shardingsphere/mode/repository/cluster/ClusterPersistRepositoryFactory.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.mode.repository.cluster;
 import com.google.common.base.Preconditions;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import org.apache.shardingsphere.infra.util.spi.ShardingSphereServiceLoader;
 import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry;
 
@@ -37,12 +38,13 @@ public final class ClusterPersistRepositoryFactory {
      * Get instance of cluster persist repository.
      * 
      * @param config persist repository configuration
+     * @param instanceMetaData instance meta data
      * @return got instance
      */
-    public static ClusterPersistRepository getInstance(final 
ClusterPersistRepositoryConfiguration config) {
+    public static ClusterPersistRepository getInstance(final 
ClusterPersistRepositoryConfiguration config, final InstanceMetaData 
instanceMetaData) {
         Preconditions.checkNotNull(config, "Cluster persist repository 
configuration cannot be null.");
         ClusterPersistRepository result = 
TypedSPIRegistry.getRegisteredService(ClusterPersistRepository.class, 
config.getType(), config.getProps());
-        result.init(config);
+        result.init(config, instanceMetaData);
         return result;
     }
 }
diff --git 
a/mode/type/cluster/repository/provider/consul/src/main/java/org/apache/shardingsphere/mode/repository/cluster/consul/ConsulRepository.java
 
b/mode/type/cluster/repository/provider/consul/src/main/java/org/apache/shardingsphere/mode/repository/cluster/consul/ConsulRepository.java
index 22224db9bc2..348ad23811a 100644
--- 
a/mode/type/cluster/repository/provider/consul/src/main/java/org/apache/shardingsphere/mode/repository/cluster/consul/ConsulRepository.java
+++ 
b/mode/type/cluster/repository/provider/consul/src/main/java/org/apache/shardingsphere/mode/repository/cluster/consul/ConsulRepository.java
@@ -24,6 +24,7 @@ import com.ecwid.consul.v1.kv.model.GetValue;
 import com.ecwid.consul.v1.kv.model.PutParams;
 import com.ecwid.consul.v1.session.model.NewSession;
 import com.ecwid.consul.v1.session.model.Session;
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import 
org.apache.shardingsphere.mode.repository.cluster.consul.lock.ConsulInternalLockProvider;
@@ -55,7 +56,7 @@ public class ConsulRepository implements 
ClusterPersistRepository {
     private Map<String, Collection<String>> watchKeyMap;
     
     @Override
-    public void init(final ClusterPersistRepositoryConfiguration config) {
+    public void init(final ClusterPersistRepositoryConfiguration config, final 
InstanceMetaData instanceMetaData) {
         consulClient = new ShardingSphereConsulClient(new 
ConsulRawClient(config.getServerLists()));
         consulProps = new ConsulProperties(config.getProps());
         consulInternalLockProvider = new 
ConsulInternalLockProvider(consulClient, consulProps);
diff --git 
a/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java
 
b/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java
index c8f3541699e..f432d208b92 100644
--- 
a/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java
+++ 
b/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java
@@ -32,6 +32,7 @@ import io.etcd.jetcd.support.Observers;
 import io.etcd.jetcd.support.Util;
 import io.etcd.jetcd.watch.WatchEvent;
 import lombok.SneakyThrows;
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import 
org.apache.shardingsphere.mode.repository.cluster.etcd.lock.EtcdInternalLockProvider;
@@ -59,7 +60,7 @@ public final class EtcdRepository implements 
ClusterPersistRepository {
     private EtcdInternalLockProvider etcdInternalLockHolder;
     
     @Override
-    public void init(final ClusterPersistRepositoryConfiguration config) {
+    public void init(final ClusterPersistRepositoryConfiguration config, final 
InstanceMetaData instanceMetaData) {
         etcdProps = new EtcdProperties(config.getProps());
         client = 
Client.builder().endpoints(Util.toURIs(Splitter.on(",").trimResults().splitToList(config.getServerLists())))
                 .namespace(ByteSequence.from(config.getNamespace(), 
StandardCharsets.UTF_8))
diff --git 
a/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepository.java
 
b/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepository.java
index a2a857a10f3..e9884e005d9 100644
--- 
a/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepository.java
+++ 
b/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepository.java
@@ -27,6 +27,7 @@ import com.alibaba.nacos.common.utils.StringUtils;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
 import lombok.SneakyThrows;
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import org.apache.shardingsphere.infra.instance.utils.IpUtils;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
@@ -68,7 +69,7 @@ public final class NacosRepository implements 
ClusterPersistRepository {
     private ServiceController serviceController;
     
     @Override
-    public void init(final ClusterPersistRepositoryConfiguration config) {
+    public void init(final ClusterPersistRepositoryConfiguration config, final 
InstanceMetaData instanceMetaData) {
         nacosProps = new NacosProperties(config.getProps());
         client = createClient(config);
         initServiceMetadata();
diff --git 
a/mode/type/cluster/repository/provider/zookeeper-curator/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/CuratorZookeeperRepository.java
 
b/mode/type/cluster/repository/provider/zookeeper-curator/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/CuratorZookeeperRepository.java
index ef4fc342489..dc187b91bba 100644
--- 
a/mode/type/cluster/repository/provider/zookeeper-curator/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/CuratorZookeeperRepository.java
+++ 
b/mode/type/cluster/repository/provider/zookeeper-curator/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/CuratorZookeeperRepository.java
@@ -32,6 +32,7 @@ import org.apache.curator.retry.ExponentialBackoffRetry;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.shardingsphere.infra.instance.InstanceContext;
 import org.apache.shardingsphere.infra.instance.InstanceContextAware;
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import 
org.apache.shardingsphere.mode.repository.cluster.exception.ClusterPersistRepositoryException;
@@ -73,8 +74,11 @@ public final class CuratorZookeeperRepository implements 
ClusterPersistRepositor
     
     private ZookeeperInternalLockProvider internalLockProvider;
     
+    private InstanceMetaData instanceMetaData;
+    
     @Override
-    public void init(final ClusterPersistRepositoryConfiguration config) {
+    public void init(final ClusterPersistRepositoryConfiguration config, final 
InstanceMetaData instanceMetaData) {
+        this.instanceMetaData = instanceMetaData;
         ZookeeperProperties zookeeperProps = new 
ZookeeperProperties(config.getProps());
         client = buildCuratorClient(config, zookeeperProps);
         internalLockProvider = new ZookeeperInternalLockProvider(client);
@@ -402,7 +406,7 @@ public final class CuratorZookeeperRepository implements 
ClusterPersistRepositor
     
     @Override
     public void setInstanceContext(final InstanceContext instanceContext) {
-        client.getConnectionStateListenable().addListener(new 
SessionConnectionListener(instanceContext, this));
+        client.getConnectionStateListenable().addListener(new 
SessionConnectionListener(instanceMetaData, instanceContext, this));
     }
     
     @Override
diff --git 
a/mode/type/cluster/repository/provider/zookeeper-curator/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/listener/SessionConnectionListener.java
 
b/mode/type/cluster/repository/provider/zookeeper-curator/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/listener/SessionConnectionListener.java
index b8186520731..464e52313e1 100644
--- 
a/mode/type/cluster/repository/provider/zookeeper-curator/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/listener/SessionConnectionListener.java
+++ 
b/mode/type/cluster/repository/provider/zookeeper-curator/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/listener/SessionConnectionListener.java
@@ -24,6 +24,7 @@ import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.shardingsphere.infra.instance.InstanceContext;
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import org.apache.shardingsphere.mode.metadata.persist.node.ComputeNode;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.zookeeper.handler.CuratorZookeeperExceptionHandler;
@@ -40,6 +41,8 @@ public final class SessionConnectionListener implements 
ConnectionStateListener
     
     private static final int RECONNECT_INTERVAL_SECONDS = 5;
     
+    private final InstanceMetaData instanceMetaData;
+    
     private final InstanceContext instanceContext;
     
     private final ClusterPersistRepository repository;
@@ -51,7 +54,7 @@ public final class SessionConnectionListener implements 
ConnectionStateListener
             do {
                 reRegistered = reRegister(client);
             } while (!reRegistered);
-            log.debug("instance re-register success instance id: {}", 
instanceContext.getInstance().getCurrentInstanceId());
+            log.debug("instance re-register success instance id: {}", 
instanceMetaData.getId());
         }
     }
     
@@ -61,8 +64,7 @@ public final class SessionConnectionListener implements 
ConnectionStateListener
                 if (isNeedGenerateWorkerId()) {
                     instanceContext.generateWorkerId(new Properties());
                 }
-                
repository.persistEphemeral(ComputeNode.getOnlineInstanceNodePath(instanceContext.getInstance().getCurrentInstanceId(),
-                        
instanceContext.getInstance().getMetaData().getType()), 
instanceContext.getInstance().getMetaData().getAttributes());
+                
repository.persistEphemeral(ComputeNode.getOnlineInstanceNodePath(instanceMetaData.getId(),
 instanceMetaData.getType()), instanceMetaData.getAttributes());
                 return true;
             }
             sleepInterval();
diff --git 
a/mode/type/cluster/repository/provider/zookeeper-curator/src/test/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/CuratorZookeeperRepositoryTest.java
 
b/mode/type/cluster/repository/provider/zookeeper-curator/src/test/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/CuratorZookeeperRepositoryTest.java
index df9aef21fc9..7ec5d1f530f 100644
--- 
a/mode/type/cluster/repository/provider/zookeeper-curator/src/test/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/CuratorZookeeperRepositoryTest.java
+++ 
b/mode/type/cluster/repository/provider/zookeeper-curator/src/test/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/CuratorZookeeperRepositoryTest.java
@@ -35,6 +35,7 @@ import org.apache.curator.framework.recipes.cache.ChildData;
 import org.apache.curator.framework.recipes.cache.CuratorCache;
 import org.apache.curator.framework.recipes.cache.CuratorCacheListener;
 import org.apache.curator.framework.recipes.locks.InterProcessLock;
+import 
org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import 
org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent;
 import 
org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent.Type;
@@ -121,7 +122,7 @@ public final class CuratorZookeeperRepositoryTest {
         mockClient();
         mockBuilder();
         ClusterPersistRepositoryConfiguration config = new 
ClusterPersistRepositoryConfiguration(REPOSITORY.getType(), "governance", 
SERVER_LISTS, new Properties());
-        REPOSITORY.init(config);
+        REPOSITORY.init(config, new ProxyInstanceMetaData("foo_id", 3307));
         mockInternalLockHolder();
     }
     
@@ -263,7 +264,7 @@ public final class CuratorZookeeperRepositoryTest {
         props.setProperty(ZookeeperPropertyKey.TIME_TO_LIVE_SECONDS.getKey(), 
"1000");
         
props.setProperty(ZookeeperPropertyKey.OPERATION_TIMEOUT_MILLISECONDS.getKey(), 
"2000");
         ClusterPersistRepositoryConfiguration config = new 
ClusterPersistRepositoryConfiguration(REPOSITORY.getType(), "governance", 
SERVER_LISTS, props);
-        REPOSITORY.init(config);
+        REPOSITORY.init(config, new ProxyInstanceMetaData("foo_id", 3307));
     }
     
     @Test
@@ -271,7 +272,7 @@ public final class CuratorZookeeperRepositoryTest {
         Properties props = new Properties();
         props.setProperty(ZookeeperPropertyKey.TIME_TO_LIVE_SECONDS.getKey(), 
"0");
         ClusterPersistRepositoryConfiguration config = new 
ClusterPersistRepositoryConfiguration(REPOSITORY.getType(), "governance", 
SERVER_LISTS, props);
-        REPOSITORY.init(config);
+        REPOSITORY.init(config, new ProxyInstanceMetaData("foo_id", 3307));
     }
     
     @Test
@@ -279,7 +280,7 @@ public final class CuratorZookeeperRepositoryTest {
         Properties props = new Properties();
         
props.setProperty(ZookeeperPropertyKey.OPERATION_TIMEOUT_MILLISECONDS.getKey(), 
"0");
         ClusterPersistRepositoryConfiguration config = new 
ClusterPersistRepositoryConfiguration(REPOSITORY.getType(), "governance", 
SERVER_LISTS, props);
-        REPOSITORY.init(config);
+        REPOSITORY.init(config, new ProxyInstanceMetaData("foo_id", 3307));
     }
     
     @Test
@@ -287,7 +288,7 @@ public final class CuratorZookeeperRepositoryTest {
         Properties props = new Properties();
         props.setProperty(ZookeeperPropertyKey.DIGEST.getKey(), "any");
         ClusterPersistRepositoryConfiguration config = new 
ClusterPersistRepositoryConfiguration(REPOSITORY.getType(), "governance", 
SERVER_LISTS, props);
-        REPOSITORY.init(config);
+        REPOSITORY.init(config, new ProxyInstanceMetaData("foo_id", 3307));
         verify(builder).aclProvider(any(ACLProvider.class));
     }
     
diff --git 
a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/ClusterPersistRepositoryFixture.java
 
b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/ClusterPersistRepositoryFixture.java
index 7e56867e493..628fd8dd497 100644
--- 
a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/ClusterPersistRepositoryFixture.java
+++ 
b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/fixture/ClusterPersistRepositoryFixture.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.proxy.fixture;
 
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import 
org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEventListener;
@@ -32,7 +33,7 @@ public final class ClusterPersistRepositoryFixture implements 
ClusterPersistRepo
     private static final Map<String, String> REGISTRY_DATA = new 
LinkedHashMap<>();
     
     @Override
-    public void init(final ClusterPersistRepositoryConfiguration config) {
+    public void init(final ClusterPersistRepositoryConfiguration config, final 
InstanceMetaData instanceMetaData) {
     }
     
     @Override
diff --git 
a/test/integration-driver-test/src/test/java/org/apache/shardingsphere/driver/fixture/TestClusterPersistRepository.java
 
b/test/integration-driver-test/src/test/java/org/apache/shardingsphere/driver/fixture/TestClusterPersistRepository.java
index 4efd89fe2f8..d6c4a80cbb5 100644
--- 
a/test/integration-driver-test/src/test/java/org/apache/shardingsphere/driver/fixture/TestClusterPersistRepository.java
+++ 
b/test/integration-driver-test/src/test/java/org/apache/shardingsphere/driver/fixture/TestClusterPersistRepository.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.driver.fixture;
 
 import org.apache.shardingsphere.infra.database.DefaultDatabase;
+import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import 
org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEventListener;
@@ -33,7 +34,7 @@ public final class TestClusterPersistRepository implements 
ClusterPersistReposit
     private final Map<String, String> registryData = new LinkedHashMap<>();
     
     @Override
-    public void init(final ClusterPersistRepositoryConfiguration config) {
+    public void init(final ClusterPersistRepositoryConfiguration config, final 
InstanceMetaData instanceMetaData) {
         registryData.put("/metadata", DefaultDatabase.LOGIC_NAME);
     }
     
diff --git 
a/test/integration-test/scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/watcher/ScalingWatcher.java
 
b/test/integration-test/scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/watcher/ScalingWatcher.java
index fb469efd48b..aedd8916cab 100644
--- 
a/test/integration-test/scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/watcher/ScalingWatcher.java
+++ 
b/test/integration-test/scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/framework/watcher/ScalingWatcher.java
@@ -20,6 +20,7 @@ package 
org.apache.shardingsphere.integration.data.pipeline.framework.watcher;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import 
org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.compose.BaseContainerComposer;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.compose.DockerContainerComposer;
 import 
org.apache.shardingsphere.integration.data.pipeline.framework.container.compose.NativeContainerComposer;
@@ -33,6 +34,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.UUID;
 
 @RequiredArgsConstructor
 @Slf4j
@@ -56,7 +58,7 @@ public class ScalingWatcher extends TestWatcher {
         ClusterPersistRepositoryConfiguration config = new 
ClusterPersistRepositoryConfiguration("ZooKeeper", namespace,
                 
dockerContainerComposer.getGovernanceContainer().getServerLists(), new 
Properties());
         ClusterPersistRepository zookeeperRepository = new 
CuratorZookeeperRepository();
-        zookeeperRepository.init(config);
+        zookeeperRepository.init(config, new 
ProxyInstanceMetaData(UUID.randomUUID().toString(), 3307));
         List<String> childrenKeys = zookeeperRepository.getChildrenKeys("/");
         for (String each : childrenKeys) {
             if (!"scaling".equals(each)) {
diff --git 
a/test/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineContextUtil.java
 
b/test/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineContextUtil.java
index fa683d3bb81..c62946d2305 100644
--- 
a/test/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineContextUtil.java
+++ 
b/test/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineContextUtil.java
@@ -41,6 +41,7 @@ import 
org.apache.shardingsphere.data.pipeline.yaml.process.YamlPipelineReadConf
 import 
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
 import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
 import org.apache.shardingsphere.infra.database.DefaultDatabase;
+import 
org.apache.shardingsphere.infra.instance.metadata.proxy.ProxyInstanceMetaData;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereColumn;
 import 
org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereTable;
 import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -57,6 +58,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
+import java.util.UUID;
 
 public final class PipelineContextUtil {
     
@@ -74,7 +76,7 @@ public final class PipelineContextUtil {
             
             @Override
             protected ClusterPersistRepository initialize() {
-                return 
ClusterPersistRepositoryFactory.getInstance(PERSIST_REPOSITORY_CONFIG);
+                return 
ClusterPersistRepositoryFactory.getInstance(PERSIST_REPOSITORY_CONFIG, new 
ProxyInstanceMetaData(UUID.randomUUID().toString(), 3307));
             }
         };
     }

Reply via email to