Skip to content

Commit

Permalink
issue-2429 failover node exist also remove running node,prevent execu…
Browse files Browse the repository at this point in the history
…te dead loop
  • Loading branch information
wjdxw committed Aug 18, 2024
1 parent d14bae2 commit af538c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public void onChange(final DataChangedEvent event) {
if (!failoverItems.isEmpty()) {
for (int each : failoverItems) {
failoverService.setCrashedFailoverFlagDirectly(each);
executionService.clearRunningInfo(Collections.singletonList(each));
failoverService.failoverIfNecessary();
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobRegistry;
import org.apache.shardingsphere.elasticjob.kernel.internal.schedule.JobScheduleController;
import org.apache.shardingsphere.elasticjob.kernel.internal.sharding.ExecutionService;
import org.apache.shardingsphere.elasticjob.kernel.internal.sharding.ShardingNode;
import org.apache.shardingsphere.elasticjob.kernel.internal.sharding.ShardingService;
import org.apache.shardingsphere.elasticjob.kernel.internal.storage.JobNodeStorage;
import org.apache.shardingsphere.elasticjob.test.util.ReflectionUtils;
Expand Down Expand Up @@ -157,6 +158,7 @@ void assertJobCrashedJobListenerWhenIsOtherFailoverInstanceCrashed() {
when(instanceNode.getInstanceFullPath()).thenReturn("/test_job/instances");
failoverListenerManager.new JobCrashedJobListener().onChange(new DataChangedEvent(Type.DELETED, "/test_job/instances/127.0.0.1@-@1", ""));
verify(failoverService).setCrashedFailoverFlagDirectly(1);
verify(executionService).clearRunningInfo(Collections.singletonList(1));
verify(failoverService).failoverIfNecessary();
JobRegistry.getInstance().shutdown("test_job");
}
Expand Down

0 comments on commit af538c4

Please sign in to comment.