sandynz commented on a change in pull request #14991:
URL: https://github.com/apache/shardingsphere/pull/14991#discussion_r791436856
##########
File path:
shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/cache/subscriber/ScalingRegistrySubscriber.java
##########
@@ -98,6 +111,10 @@ public void scalingTaskFinished(final
ScalingTaskFinishedEvent event) {
log.info("start to delete cache, ruleCacheId={}", ruleCacheId);
registryCacheManager.deleteCache(SchemaMetaDataNode.getRulePath(event.getTargetSchemaName()),
ruleCacheId);
}
+ if
(schemaNameLockedMap.getOrDefault(decorateLockName(event.getTargetSchemaName()),
false)) {
+ log.info("scaling job finished, release schema name lock, event =
{}", event);
+ lockRegistryService.releaseLock(event.getTargetSchemaName());
Review comment:
Seems `schemaNameLockedMap` just has `put` operation, but no `remove`
operation, will it cause issue?
##########
File path:
shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/cache/subscriber/ScalingRegistrySubscriber.java
##########
@@ -98,6 +108,10 @@ public void scalingTaskFinished(final
ScalingTaskFinishedEvent event) {
log.info("start to delete cache, ruleCacheId={}", ruleCacheId);
registryCacheManager.deleteCache(SchemaMetaDataNode.getRulePath(event.getTargetSchemaName()),
ruleCacheId);
}
+ if (lockStatus) {
Review comment:
OK, then you could comment it in this PR, it's clear to see it later.
##########
File path:
shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/cache/subscriber/ScalingRegistrySubscriber.java
##########
@@ -130,6 +127,20 @@ public void clusterSwitchConfiguration(final
ClusterSwitchConfigurationEvent eve
persistService.persist(schemaName, event.getTargetRuleConfigs());
}
+ /**
+ * scaling release lock.
+ *
+ * @param event Scaling Job Release Schema Name Lock Event
+ */
+ @Subscribe
+ public void scalingJobReleaseLockEvent(final
ScalingJobReleaseSchemaNameLockEvent event) {
+ if (schemaNameLockedMap.getOrDefault(event.getSchemaName(), false)) {
+ log.info("scaling job finished, release schema name lock, event =
{}", event);
+
lockRegistryService.releaseLock(decorateLockName(event.getSchemaName()));
+ schemaNameLockedMap.remove(event.getSchemaName());
+ }
+ }
Review comment:
Is new event necessary for success case? Could we just do it in
`scalingTaskFinished` like before, and add new logic for failure case later?
--
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]