Skip to content

Commit efa0728

Browse files
committed
no cleanup for disconnect
1 parent dff6fbb commit efa0728

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

server/src/test/java/org/elasticsearch/cluster/coordination/CoordinatorTests.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
import org.elasticsearch.common.settings.Settings.Builder;
5555
import org.elasticsearch.common.transport.TransportAddress;
5656
import org.elasticsearch.common.unit.TimeValue;
57-
import org.elasticsearch.common.util.concurrent.RunOnce;
5857
import org.elasticsearch.discovery.zen.PublishClusterStateStats;
5958
import org.elasticsearch.discovery.zen.UnicastHostsProvider.HostsResolver;
6059
import org.elasticsearch.indices.cluster.FakeThreadPoolMasterService;
@@ -78,7 +77,6 @@
7877
import java.util.Optional;
7978
import java.util.Set;
8079
import java.util.concurrent.Callable;
81-
import java.util.concurrent.TimeUnit;
8280
import java.util.concurrent.atomic.AtomicBoolean;
8381
import java.util.function.Consumer;
8482
import java.util.function.Function;
@@ -1146,13 +1144,18 @@ void runRandomly() {
11461144
logger.debug("----> [runRandomly {}] rebooting [{}]", thisStep, clusterNode.getId());
11471145
clusterNode.close();
11481146
clusterNodes.forEach(
1149-
cn -> {
1150-
final Runnable disconnectAction = new RunOnce(() -> cn.onNode(
1151-
() -> cn.transportService.disconnectFromNode(clusterNode.getLocalNode())).run());
1152-
cleanupActions.add(disconnectAction);
1153-
final int delay = scaledRandomIntBetween(0, Math.toIntExact(TimeUnit.MINUTES.toMillis(rarely() ? 15 : 1)));
1154-
deterministicTaskQueue.scheduleAt(deterministicTaskQueue.getCurrentTimeMillis() + delay, disconnectAction);
1155-
});
1147+
cn -> deterministicTaskQueue.scheduleNow(cn.onNode(
1148+
new Runnable() {
1149+
@Override
1150+
public void run() {
1151+
cn.transportService.disconnectFromNode(clusterNode.getLocalNode());
1152+
}
1153+
1154+
@Override
1155+
public String toString() {
1156+
return "disconnect from " + clusterNode.getLocalNode() + " after shutdown";
1157+
}
1158+
})));
11561159
clusterNodes.replaceAll(cn -> cn == clusterNode ? cn.restartedNode() : cn);
11571160
} else if (rarely()) {
11581161
final ClusterNode clusterNode = getAnyNode();

0 commit comments

Comments
 (0)