LetheTan opened a new issue, #28073:
URL: https://github.com/apache/shardingsphere/issues/28073

   ## Question
   
   i deployed a ShardingSphere-Proxy 5.4.0 Cluster,The persistent repository 
type uses nacos Cluster
   
   then i REGISTER STORAGE UNIT and CREATE SHARDING TABLE RULE
   
   the IllegalStateException  exception will always be thrown
   
   but the UNIT and  TABLE RULE works fine when query data through the proxy
   
   ```java
   SLF4J: Class path contains multiple SLF4J bindings.
   SLF4J: Found binding in 
[jar:file:/opt/shardingsphere-proxy/lib/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
   SLF4J: Found binding in 
[jar:file:/opt/shardingsphere-proxy/agent/shardingsphere-agent-5.4.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
   SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an 
explanation.
   SLF4J: Actual binding is of type 
[ch.qos.logback.classic.util.ContextSelectorStaticBinder]
   ###|||2023-08-11 
10:03:37.847|||INFO|||-|||-|||main|||PluginJarLoader--->Loaded jar: 
shardingsphere-agent-tracing-opentelemetry-5.4.0.jar
   ###|||2023-08-11 
10:03:37.850|||INFO|||-|||-|||main|||PluginJarLoader--->Loaded jar: 
shardingsphere-agent-metrics-prometheus-5.4.0.jar
   ###|||2023-08-11 
10:03:37.850|||INFO|||-|||-|||main|||PluginJarLoader--->Loaded jar: 
shardingsphere-agent-metrics-core-5.4.0.jar
   ###|||2023-08-11 
10:03:37.850|||INFO|||-|||-|||main|||PluginJarLoader--->Loaded jar: 
shardingsphere-agent-plugin-core-5.4.0.jar
   ###|||2023-08-11 
10:03:37.850|||INFO|||-|||-|||main|||PluginJarLoader--->Loaded jar: 
shardingsphere-agent-logging-file-5.4.0.jar
   ###|||2023-08-11 
10:03:54.865|||INFO|||-|||-|||main|||ShardingSphereProxyVersion--->Database 
name is `MySQL`, version is `8.0.32`, database name is `test`
   ###|||2023-08-11 
10:03:54.867|||INFO|||-|||-|||main|||ProxySSLContext--->Proxy frontend SSL/TLS 
is not enabled.
   ###|||2023-08-11 
10:03:55.082|||INFO|||-|||-|||main|||ShardingSphereProxy--->ShardingSphere-Proxy
 Cluster mode started successfully
   ###|||2023-08-11 
10:03:57.183|||INFO|||-|||-|||epollEventLoopGroup-3-1|||PluginLifecycleServiceManager--->Start
 plugin: File
   ###|||2023-08-11 
10:03:57.183|||INFO|||-|||-|||epollEventLoopGroup-3-1|||PluginLifecycleServiceManager--->Start
 plugin: Prometheus
   ###|||2023-08-11 
10:03:57.270|||INFO|||-|||-|||epollEventLoopGroup-3-1|||PrometheusPluginLifecycleService--->Prometheus
 metrics HTTP server `0.0.0.0:8080` start success.
   ###|||2023-08-11 
10:06:12.991|||ERROR|||-|||-|||ShardingSphere-data-collect-0|||default--->Exception
 thrown by subscriber method 
update(org.apache.shardingsphere.infra.metadata.statistics.event.ShardingSphereSchemaDataAlteredEvent)
 on subscriber 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.metadata.subscriber.ShardingSphereSchemaDataRegistrySubscriber@73ae0257
 when dispatching event: 
org.apache.shardingsphere.infra.metadata.statistics.event.ShardingSphereSchemaDataAlteredEvent@506be009
   java.lang.IllegalStateException: Key 
`/lock/exclusive/locks/statistics_shardingsphere_shardingsphere_sharding_table_statistics`
 already exists
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:589)
        at 
org.apache.shardingsphere.mode.repository.cluster.nacos.NacosRepository.persistExclusiveEphemeral(NacosRepository.java:123)
        at 
org.apache.shardingsphere.mode.repository.cluster.lock.impl.DefaultDistributedLock.persist(DefaultDistributedLock.java:66)
        at 
org.apache.shardingsphere.infra.util.retry.RetryExecutor.execute(RetryExecutor.java:47)
        at 
org.apache.shardingsphere.mode.repository.cluster.lock.impl.DefaultDistributedLock.tryLock(DefaultDistributedLock.java:58)
        at 
org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.GlobalLockPersistService.tryLock(GlobalLockPersistService.java:35)
        at 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.metadata.subscriber.ShardingSphereSchemaDataRegistrySubscriber.update(ShardingSphereSchemaDataRegistrySubscriber.java:55)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at 
com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:87)
        at 
com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:144)
        at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:72)
        at 
com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
        at 
com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:67)
        at 
com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:108)
        at com.google.common.eventbus.EventBus.post(EventBus.java:212)
        at 
org.apache.shardingsphere.infra.util.eventbus.EventBusContext.post(EventBusContext.java:51)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.compareUpdateAndSendEventForTable(ShardingSphereStatisticsScheduleCollector.java:144)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.lambda$compareUpdateAndSendEventForSchema$8(ShardingSphereStatisticsScheduleCollector.java:133)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.compareUpdateAndSendEventForSchema(ShardingSphereStatisticsScheduleCollector.java:133)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.lambda$compareUpdateAndSendEventForDatabase$7(ShardingSphereStatisticsScheduleCollector.java:127)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.compareUpdateAndSendEventForDatabase(ShardingSphereStatisticsScheduleCollector.java:127)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.lambda$compareUpdateAndSendEvent$6(ShardingSphereStatisticsScheduleCollector.java:121)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.compareUpdateAndSendEvent(ShardingSphereStatisticsScheduleCollector.java:121)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.run(ShardingSphereStatisticsScheduleCollector.java:82)
        at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at 
java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at 
java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
   ###|||2023-08-11 
10:06:43.074|||ERROR|||-|||-|||ShardingSphere-data-collect-0|||default--->Exception
 thrown by subscriber method 
update(org.apache.shardingsphere.infra.metadata.statistics.event.ShardingSphereSchemaDataAlteredEvent)
 on subscriber 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.metadata.subscriber.ShardingSphereSchemaDataRegistrySubscriber@73ae0257
 when dispatching event: 
org.apache.shardingsphere.infra.metadata.statistics.event.ShardingSphereSchemaDataAlteredEvent@4173efa5
   java.lang.IllegalStateException: Key 
`/lock/exclusive/locks/statistics_shardingsphere_shardingsphere_sharding_table_statistics`
 already exists
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:589)
        at 
org.apache.shardingsphere.mode.repository.cluster.nacos.NacosRepository.persistExclusiveEphemeral(NacosRepository.java:123)
        at 
org.apache.shardingsphere.mode.repository.cluster.lock.impl.DefaultDistributedLock.persist(DefaultDistributedLock.java:66)
        at 
org.apache.shardingsphere.infra.util.retry.RetryExecutor.execute(RetryExecutor.java:47)
        at 
org.apache.shardingsphere.mode.repository.cluster.lock.impl.DefaultDistributedLock.tryLock(DefaultDistributedLock.java:58)
        at 
org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.GlobalLockPersistService.tryLock(GlobalLockPersistService.java:35)
        at 
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.metadata.subscriber.ShardingSphereSchemaDataRegistrySubscriber.update(ShardingSphereSchemaDataRegistrySubscriber.java:55)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at 
com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:87)
        at 
com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:144)
        at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:72)
        at 
com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
        at 
com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:67)
        at 
com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:108)
        at com.google.common.eventbus.EventBus.post(EventBus.java:212)
        at 
org.apache.shardingsphere.infra.util.eventbus.EventBusContext.post(EventBusContext.java:51)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.compareUpdateAndSendEventForTable(ShardingSphereStatisticsScheduleCollector.java:144)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.lambda$compareUpdateAndSendEventForSchema$8(ShardingSphereStatisticsScheduleCollector.java:133)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.compareUpdateAndSendEventForSchema(ShardingSphereStatisticsScheduleCollector.java:133)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.lambda$compareUpdateAndSendEventForDatabase$7(ShardingSphereStatisticsScheduleCollector.java:127)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.compareUpdateAndSendEventForDatabase(ShardingSphereStatisticsScheduleCollector.java:127)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.lambda$compareUpdateAndSendEvent$6(ShardingSphereStatisticsScheduleCollector.java:121)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.compareUpdateAndSendEvent(ShardingSphereStatisticsScheduleCollector.java:121)
        at 
org.apache.shardingsphere.data.pipeline.core.listener.ShardingSphereStatisticsScheduleCollector$ShardingSphereDataCollectorRunnable.run(ShardingSphereStatisticsScheduleCollector.java:82)
        at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at 
java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at 
java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
   ```
   
   
   
   I haven't updated the schema data,the ShardingSphereSchemaDataAlteredEvent 
is also be triggered
   
   
![image](https://github.com/apache/shardingsphere/assets/20707953/84fe62ab-cb16-48dd-89c3-516fac0a6943)
   
   
   the server.yaml 
   
   ```yaml
   mode:
     type: Cluster
     repository:
       type: Nacos
       props:
         clusterIp: xx.xx.xxx.xxx:8848
         namespace: test
         server-lists: xx.xx.xxx.xxx::8848
         retryIntervalMilliseconds: 500
         timeToLiveSeconds: 60
   ```
   


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

Reply via email to