This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 4ad588e5749 Remove useless PersistCoordinatorFacade (#34532)
4ad588e5749 is described below
commit 4ad588e5749427e4ea55eab30128cc5c2b28b48b
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Jan 29 16:21:52 2025 +0800
Remove useless PersistCoordinatorFacade (#34532)
* Refactor StandaloneMetaDataManagerPersistService.registerStorageUnits()
* Remove useless PersistCoordinatorFacade
---
.../mode/manager/ContextManager.java | 4 --
.../coordinator/PersistCoordinatorFacade.java | 37 -------------------
.../PersistCoordinatorFacadeBuilder.java | 37 -------------------
.../coordinator/ProcessPersistCoordinator.java | 40 --------------------
.../PersistCoordinatorFacadeBuilderFixture.java | 40 --------------------
...ist.coordinator.PersistCoordinatorFacadeBuilder | 18 ---------
.../handler/global/type/KillProcessHandler.java | 3 +-
.../global/type/ShowProcessListHandler.java | 3 +-
.../ClusterPersistCoordinatorFacadeBuilder.java | 39 --------------------
.../process/ClusterProcessPersistCoordinator.java | 17 +++++++--
...ist.coordinator.PersistCoordinatorFacadeBuilder | 18 ---------
.../global/type/KillProcessHandlerTest.java | 4 +-
.../global/type/ShowProcessListHandlerTest.java | 2 +-
.../ClusterProcessPersistCoordinatorTest.java | 3 +-
.../StandalonePersistCoordinatorFacadeBuilder.java | 43 ----------------------
.../StandaloneMetaDataManagerPersistService.java | 10 ++---
...ist.coordinator.PersistCoordinatorFacadeBuilder | 18 ---------
17 files changed, 26 insertions(+), 310 deletions(-)
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
index 4653d5f5a61..66cd3292db6 100644
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
+++
b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
@@ -37,7 +37,6 @@ import
org.apache.shardingsphere.mode.manager.listener.ContextManagerLifecycleLi
import org.apache.shardingsphere.mode.metadata.MetaDataContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.mode.persist.PersistServiceFacade;
-import
org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacade;
import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
import org.apache.shardingsphere.mode.state.cluster.ClusterStateContext;
@@ -64,8 +63,6 @@ public final class ContextManager implements AutoCloseable {
private final MetaDataContextManager metaDataContextManager;
- private final PersistCoordinatorFacade persistCoordinatorFacade;
-
public ContextManager(final MetaDataContexts metaDataContexts, final
ComputeNodeInstanceContext computeNodeInstanceContext, final PersistRepository
repository) {
this.metaDataContexts = metaDataContexts;
this.computeNodeInstanceContext = computeNodeInstanceContext;
@@ -76,7 +73,6 @@ public final class ContextManager implements AutoCloseable {
for (ContextManagerLifecycleListener each :
ShardingSphereServiceLoader.getServiceInstances(ContextManagerLifecycleListener.class))
{
each.onInitialized(this);
}
- persistCoordinatorFacade = new PersistCoordinatorFacade(repository,
computeNodeInstanceContext.getModeConfiguration());
}
/**
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/persist/coordinator/PersistCoordinatorFacade.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/persist/coordinator/PersistCoordinatorFacade.java
deleted file mode 100644
index 63800fd3eed..00000000000
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/persist/coordinator/PersistCoordinatorFacade.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.persist.coordinator;
-
-import lombok.Getter;
-import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
-import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
-
-/**
- * Persist coordinator facade.
- */
-@Getter
-public final class PersistCoordinatorFacade {
-
- private final ProcessPersistCoordinator processPersistCoordinator;
-
- public PersistCoordinatorFacade(final PersistRepository repository, final
ModeConfiguration modeConfig) {
- PersistCoordinatorFacadeBuilder builder =
TypedSPILoader.getService(PersistCoordinatorFacadeBuilder.class,
modeConfig.getType());
- processPersistCoordinator =
builder.buildProcessPersistCoordinator(repository);
- }
-}
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/persist/coordinator/PersistCoordinatorFacadeBuilder.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/persist/coordinator/PersistCoordinatorFacadeBuilder.java
deleted file mode 100644
index 9bb404e9c2e..00000000000
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/persist/coordinator/PersistCoordinatorFacadeBuilder.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.persist.coordinator;
-
-import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
-import org.apache.shardingsphere.infra.spi.type.typed.TypedSPI;
-import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
-
-/**
- * Persist coordinator facade builder.
- */
-@SingletonSPI
-public interface PersistCoordinatorFacadeBuilder extends TypedSPI {
-
- /**
- * Build process persist coordinator.
- *
- * @param repository persist repository
- * @return built process persist coordinator
- */
- ProcessPersistCoordinator buildProcessPersistCoordinator(PersistRepository
repository);
-}
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/persist/coordinator/ProcessPersistCoordinator.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/persist/coordinator/ProcessPersistCoordinator.java
deleted file mode 100644
index 46d56418f79..00000000000
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/persist/coordinator/ProcessPersistCoordinator.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.persist.coordinator;
-
-/**
- * Process persist coordinator.
- */
-public interface ProcessPersistCoordinator {
-
- /**
- * Report local processes.
- *
- * @param instanceId instance ID
- * @param taskId task ID
- */
- void reportLocalProcesses(String instanceId, String taskId);
-
- /**
- * Clean process.
- *
- * @param instanceId instance ID
- * @param processId process ID
- */
- void cleanProcess(String instanceId, String processId);
-}
diff --git
a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/PersistCoordinatorFacadeBuilderFixture.java
b/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/PersistCoordinatorFacadeBuilderFixture.java
deleted file mode 100644
index d2a167a4dd6..00000000000
---
a/mode/core/src/test/java/org/apache/shardingsphere/mode/fixture/PersistCoordinatorFacadeBuilderFixture.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.fixture;
-
-import
org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder;
-import
org.apache.shardingsphere.mode.persist.coordinator.ProcessPersistCoordinator;
-import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
-
-public final class PersistCoordinatorFacadeBuilderFixture implements
PersistCoordinatorFacadeBuilder {
-
- @Override
- public ProcessPersistCoordinator buildProcessPersistCoordinator(final
PersistRepository repository) {
- return null;
- }
-
- @Override
- public Object getType() {
- return "foo_type";
- }
-
- @Override
- public boolean isDefault() {
- return true;
- }
-}
diff --git
a/mode/core/src/test/resources/META-INF/services/org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder
b/mode/core/src/test/resources/META-INF/services/org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder
deleted file mode 100644
index b662f6af130..00000000000
---
a/mode/core/src/test/resources/META-INF/services/org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.mode.fixture.PersistCoordinatorFacadeBuilderFixture
diff --git
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/KillProcessHandler.java
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/KillProcessHandler.java
index 112c05cb833..f8369238cf3 100644
---
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/KillProcessHandler.java
+++
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/KillProcessHandler.java
@@ -21,6 +21,7 @@ import
org.apache.shardingsphere.infra.exception.core.external.sql.type.wrapper.
import org.apache.shardingsphere.infra.executor.sql.process.ProcessRegistry;
import
org.apache.shardingsphere.infra.executor.sql.process.lock.ProcessOperationLockRegistry;
import
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.global.GlobalDataChangedEventHandler;
+import
org.apache.shardingsphere.mode.manager.cluster.persist.coordinator.process.ClusterProcessPersistCoordinator;
import org.apache.shardingsphere.mode.node.path.state.ComputeNodePath;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
@@ -64,7 +65,7 @@ public final class KillProcessHandler implements
GlobalDataChangedEventHandler {
} catch (final SQLException ex) {
throw new SQLWrapperException(ex);
}
-
contextManager.getPersistCoordinatorFacade().getProcessPersistCoordinator().cleanProcess(instanceId,
processId);
+ new
ClusterProcessPersistCoordinator(contextManager.getPersistServiceFacade().getRepository()).cleanProcess(instanceId,
processId);
} else if (Type.DELETED == event.getType()) {
ProcessOperationLockRegistry.getInstance().notify(processId);
}
diff --git
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/ShowProcessListHandler.java
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/ShowProcessListHandler.java
index 159295b94dd..9c6f2df7b65 100644
---
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/ShowProcessListHandler.java
+++
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/ShowProcessListHandler.java
@@ -19,6 +19,7 @@ package
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.global.t
import
org.apache.shardingsphere.infra.executor.sql.process.lock.ProcessOperationLockRegistry;
import
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.global.GlobalDataChangedEventHandler;
+import
org.apache.shardingsphere.mode.manager.cluster.persist.coordinator.process.ClusterProcessPersistCoordinator;
import org.apache.shardingsphere.mode.node.path.state.ComputeNodePath;
import org.apache.shardingsphere.mode.event.DataChangedEvent;
import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
@@ -57,7 +58,7 @@ public final class ShowProcessListHandler implements
GlobalDataChangedEventHandl
String taskId = matcher.group(2);
if (Type.ADDED == event.getType()) {
if
(instanceId.equals(contextManager.getComputeNodeInstanceContext().getInstance().getMetaData().getId()))
{
-
contextManager.getPersistCoordinatorFacade().getProcessPersistCoordinator().reportLocalProcesses(instanceId,
taskId);
+ new
ClusterProcessPersistCoordinator(contextManager.getPersistServiceFacade().getRepository()).reportLocalProcesses(instanceId,
taskId);
}
} else if (Type.DELETED == event.getType()) {
ProcessOperationLockRegistry.getInstance().notify(taskId);
diff --git
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/ClusterPersistCoordinatorFacadeBuilder.java
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/ClusterPersistCoordinatorFacadeBuilder.java
deleted file mode 100644
index abd713c10b3..00000000000
---
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/ClusterPersistCoordinatorFacadeBuilder.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.manager.cluster.persist.coordinator;
-
-import
org.apache.shardingsphere.mode.manager.cluster.persist.coordinator.process.ClusterProcessPersistCoordinator;
-import
org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder;
-import
org.apache.shardingsphere.mode.persist.coordinator.ProcessPersistCoordinator;
-import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
-
-/**
- * Cluster persist coordinator facade builder.
- */
-public final class ClusterPersistCoordinatorFacadeBuilder implements
PersistCoordinatorFacadeBuilder {
-
- @Override
- public ProcessPersistCoordinator buildProcessPersistCoordinator(final
PersistRepository repository) {
- return new ClusterProcessPersistCoordinator(repository);
- }
-
- @Override
- public Object getType() {
- return "Cluster";
- }
-}
diff --git
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinator.java
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinator.java
index 113ad32b267..c316a1f5c06 100644
---
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinator.java
+++
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinator.java
@@ -24,7 +24,6 @@ import
org.apache.shardingsphere.infra.executor.sql.process.yaml.swapper.YamlPro
import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
import org.apache.shardingsphere.mode.node.path.state.ComputeNodePath;
import org.apache.shardingsphere.mode.node.path.state.ProcessNodePath;
-import
org.apache.shardingsphere.mode.persist.coordinator.ProcessPersistCoordinator;
import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
import java.util.Collection;
@@ -33,13 +32,18 @@ import java.util.Collection;
* Cluster process persist coordinator.
*/
@RequiredArgsConstructor
-public final class ClusterProcessPersistCoordinator implements
ProcessPersistCoordinator {
+public final class ClusterProcessPersistCoordinator {
private final PersistRepository repository;
private final YamlProcessListSwapper swapper = new
YamlProcessListSwapper();
- @Override
+ /**
+ * Report local processes.
+ *
+ * @param instanceId instance ID
+ * @param taskId task ID
+ */
public void reportLocalProcesses(final String instanceId, final String
taskId) {
Collection<Process> processes =
ProcessRegistry.getInstance().listAll();
if (!processes.isEmpty()) {
@@ -48,7 +52,12 @@ public final class ClusterProcessPersistCoordinator
implements ProcessPersistCoo
repository.delete(ComputeNodePath.getShowProcessListTriggerPath(instanceId,
taskId));
}
- @Override
+ /**
+ * Clean process.
+ *
+ * @param instanceId instance ID
+ * @param processId process ID
+ */
public void cleanProcess(final String instanceId, final String processId) {
repository.delete(ComputeNodePath.getKillProcessTriggerPath(instanceId,
processId));
}
diff --git
a/mode/type/cluster/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder
b/mode/type/cluster/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder
deleted file mode 100644
index 10ecee97a07..00000000000
---
a/mode/type/cluster/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.mode.manager.cluster.persist.coordinator.ClusterPersistCoordinatorFacadeBuilder
diff --git
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/KillProcessHandlerTest.java
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/KillProcessHandlerTest.java
index 4807689c26f..c7e0c1ad2a4 100644
---
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/KillProcessHandlerTest.java
+++
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/KillProcessHandlerTest.java
@@ -64,13 +64,13 @@ class KillProcessHandlerTest {
@Test
void assertHandleKillLocalProcessWithCurrentInstance() {
handler.handle(contextManager, new
DataChangedEvent("/nodes/compute_nodes/kill_process_trigger/foo_instance_id:foo_pid",
"", Type.ADDED));
-
verify(contextManager.getPersistCoordinatorFacade().getProcessPersistCoordinator()).cleanProcess("foo_instance_id",
"foo_pid");
+
verify(contextManager.getPersistServiceFacade().getRepository()).delete(any());
}
@Test
void assertHandleKillLocalProcessWithNotCurrentInstance() {
handler.handle(contextManager, new
DataChangedEvent("/nodes/compute_nodes/kill_process_trigger/bar_instance_id:foo_pid",
"", Type.ADDED));
-
verify(contextManager.getPersistCoordinatorFacade().getProcessPersistCoordinator(),
times(0)).cleanProcess("bar_instance_id", "foo_pid");
+ verify(contextManager.getPersistServiceFacade().getRepository(),
times(0)).delete(any());
}
@Test
diff --git
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/ShowProcessListHandlerTest.java
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/ShowProcessListHandlerTest.java
index 3c6a4becc41..6ebc0c543f1 100644
---
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/ShowProcessListHandlerTest.java
+++
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/ShowProcessListHandlerTest.java
@@ -74,7 +74,7 @@ class ShowProcessListHandlerTest {
void assertHandleReportLocalProcesses() {
when(ProcessRegistry.getInstance().listAll()).thenReturn(Collections.emptyList());
handler.handle(contextManager, new
DataChangedEvent("/nodes/compute_nodes/show_process_list_trigger/foo_instance_id:foo_task_id",
"", Type.ADDED));
-
verify(contextManager.getPersistCoordinatorFacade().getProcessPersistCoordinator()).reportLocalProcesses("foo_instance_id",
"foo_task_id");
+
verify(contextManager.getPersistServiceFacade().getRepository()).delete(any());
}
@Test
diff --git
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinatorTest.java
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinatorTest.java
index f64d5841dda..d1864f22ebc 100644
---
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinatorTest.java
+++
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinatorTest.java
@@ -19,7 +19,6 @@ package
org.apache.shardingsphere.mode.manager.cluster.persist.coordinator.proce
import org.apache.shardingsphere.infra.executor.sql.process.Process;
import org.apache.shardingsphere.infra.executor.sql.process.ProcessRegistry;
-import
org.apache.shardingsphere.mode.persist.coordinator.ProcessPersistCoordinator;
import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
import org.apache.shardingsphere.test.mock.AutoMockExtension;
import org.apache.shardingsphere.test.mock.StaticMockSettings;
@@ -45,7 +44,7 @@ class ClusterProcessPersistCoordinatorTest {
@Mock
private PersistRepository repository;
- private ProcessPersistCoordinator processPersistCoordinator;
+ private ClusterProcessPersistCoordinator processPersistCoordinator;
@BeforeEach
void setUp() {
diff --git
a/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/coordinator/StandalonePersistCoordinatorFacadeBuilder.java
b/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/coordinator/StandalonePersistCoordinatorFacadeBuilder.java
deleted file mode 100644
index 61b47ddc5ef..00000000000
---
a/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/coordinator/StandalonePersistCoordinatorFacadeBuilder.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.manager.standalone.persist.coordinator;
-
-import
org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder;
-import
org.apache.shardingsphere.mode.persist.coordinator.ProcessPersistCoordinator;
-import org.apache.shardingsphere.mode.spi.repository.PersistRepository;
-
-/**
- * Standalone persist coordinator facade builder.
- */
-public final class StandalonePersistCoordinatorFacadeBuilder implements
PersistCoordinatorFacadeBuilder {
-
- @Override
- public ProcessPersistCoordinator buildProcessPersistCoordinator(final
PersistRepository repository) {
- return null;
- }
-
- @Override
- public Object getType() {
- return "Standalone";
- }
-
- @Override
- public boolean isDefault() {
- return true;
- }
-}
diff --git
a/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/service/StandaloneMetaDataManagerPersistService.java
b/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/service/StandaloneMetaDataManagerPersistService.java
index e46af30c4e8..48897baadd2 100644
---
a/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/service/StandaloneMetaDataManagerPersistService.java
+++
b/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/service/StandaloneMetaDataManagerPersistService.java
@@ -143,8 +143,8 @@ public final class StandaloneMetaDataManagerPersistService
implements MetaDataMa
@Override
public void registerStorageUnits(final String databaseName, final
Map<String, DataSourcePoolProperties> toBeRegisteredProps) throws SQLException {
- SwitchingResource switchingResource =
metaDataContextManager.getResourceSwitchManager().switchByRegisterStorageUnit(metaDataContextManager.getMetaDataContexts()
-
.getMetaData().getDatabase(databaseName).getResourceMetaData(),
toBeRegisteredProps);
+ SwitchingResource switchingResource =
metaDataContextManager.getResourceSwitchManager()
+
.switchByRegisterStorageUnit(metaDataContextManager.getMetaDataContexts().getMetaData().getDatabase(databaseName).getResourceMetaData(),
toBeRegisteredProps);
ShardingSphereDatabase changedDatabase = new
MetaDataContextsFactory(metaDataPersistService,
metaDataContextManager.getComputeNodeInstanceContext()).createChangedDatabase(
databaseName, false, switchingResource, null,
metaDataContextManager.getMetaDataContexts());
metaDataContextManager.getMetaDataContexts().getMetaData().putDatabase(changedDatabase);
@@ -154,12 +154,12 @@ public final class
StandaloneMetaDataManagerPersistService implements MetaDataMa
.forEach(each -> {
if (each.isEmpty()) {
metaDataPersistService.getDatabaseMetaDataFacade().getSchema().add(databaseName,
each.getName());
+ } else {
+
metaDataPersistService.getDatabaseMetaDataFacade().getTable().persist(databaseName,
each.getName(), each.getAllTables());
}
-
metaDataPersistService.getDatabaseMetaDataFacade().getTable().persist(databaseName,
each.getName(), each.getAllTables());
});
DataSourceUnitPersistService dataSourceService =
metaDataPersistService.getDataSourceUnitService();
- metaDataPersistService.getMetaDataVersionPersistService()
- .switchActiveVersion(dataSourceService.persist(databaseName,
toBeRegisteredProps));
+
metaDataPersistService.getMetaDataVersionPersistService().switchActiveVersion(dataSourceService.persist(databaseName,
toBeRegisteredProps));
clearServiceCache();
}
diff --git
a/mode/type/standalone/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder
b/mode/type/standalone/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder
deleted file mode 100644
index ec4247fc7ca..00000000000
---
a/mode/type/standalone/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.persist.coordinator.PersistCoordinatorFacadeBuilder
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.mode.manager.standalone.persist.coordinator.StandalonePersistCoordinatorFacadeBuilder