You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by tu...@apache.org on 2022/11/15 06:01:31 UTC
[shardingsphere] branch master updated: fix issue 20802 (#22178)
This is an automated email from the ASF dual-hosted git repository.
tuichenchuxin 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 373e38c7a29 fix issue 20802 (#22178)
373e38c7a29 is described below
commit 373e38c7a294d20af19817cb369a05de65991bb3
Author: xuup <33...@users.noreply.github.com>
AuthorDate: Tue Nov 15 14:01:15 2022 +0800
fix issue 20802 (#22178)
---
.../coordinator/subscriber/ProcessListChangedSubscriber.java | 4 ++--
.../subscriber/ProcessListChangedSubscriberTest.java | 10 ++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriber.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriber.java
index 1e1c774b078..9f82191f82e 100644
--- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriber.java
+++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriber.java
@@ -71,9 +71,9 @@ public final class ProcessListChangedSubscriber {
}
/**
- * Trigger show process list.
+ * Kill process list id.
*
- * @param event show process list trigger event
+ * @param event kill process list id event
* @throws SQLException SQL exception
*/
@Subscribe
diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriberTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriberTest.java
index b7cab8eddf6..c56caa79acc 100644
--- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriberTest.java
+++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriberTest.java
@@ -32,6 +32,7 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.manager.ContextManagerBuilderParameter;
import org.apache.shardingsphere.mode.manager.cluster.ClusterContextManagerBuilder;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.RegistryCenter;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.KillProcessListIdEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.ShowProcessListTriggerEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.ShowProcessListUnitCompleteEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.util.ReflectionUtil;
@@ -131,6 +132,15 @@ public final class ProcessListChangedSubscriberTest {
"contexts:" + System.lineSeparator() + "- startTimeMillis: 0" + System.lineSeparator());
verify(repository).delete("/nodes/compute_nodes/process_trigger/" + instanceId + ":foo_process_id");
}
+
+ @Test
+ public void assertKillProcessListId() throws SQLException, NoSuchFieldException, IllegalAccessException {
+ String instanceId = contextManager.getInstanceContext().getInstance().getMetaData().getId();
+ String processId = "foo_process_id";
+ subscriber.killProcessListId(new KillProcessListIdEvent(instanceId, processId));
+ ClusterPersistRepository repository = ReflectionUtil.getFieldValue(subscriber, "registryCenter", RegistryCenter.class).getRepository();
+ verify(repository).delete("/nodes/compute_nodes/process_kill/" + instanceId + ":foo_process_id");
+ }
private void lockAndAwaitDefaultTime(final ShowProcessListSimpleLock lock) {
lock.lock();