Skip to content

Commit 897a0a1

Browse files
committed
Apply cluster states in system context
Today cluster states are sometimes (rarely) applied in the default context rather than system context, which means that any appliers which capture their contexts cannot do things like remote transport actions when security is enabled. There are at least two ways that we end up applying the cluster state in the default context: 1. locally applying a cluster state that indicates that the master has failed 2. the elected master times out while waiting for a response from another node This commit ensures that cluster states are always applied in the system context. Mitigates elastic#53751
1 parent 561a7f8 commit 897a0a1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ private static ClusterState initialState(DiscoveryNode localNode, long term, lon
122122
private void setupFakeMasterServiceAndCoordinator(long term, ClusterState initialState) {
123123
deterministicTaskQueue
124124
= new DeterministicTaskQueue(Settings.builder().put(Node.NODE_NAME_SETTING.getKey(), "test").build(), random());
125+
final ThreadPool fakeThreadPool = deterministicTaskQueue.getThreadPool();
125126
FakeThreadPoolMasterService fakeMasterService = new FakeThreadPoolMasterService("test_node","test",
126-
threadPool, deterministicTaskQueue::scheduleNow);
127-
setupMasterServiceAndCoordinator(term, initialState, fakeMasterService, deterministicTaskQueue.getThreadPool(), Randomness.get());
127+
fakeThreadPool, deterministicTaskQueue::scheduleNow);
128+
setupMasterServiceAndCoordinator(term, initialState, fakeMasterService, fakeThreadPool, Randomness.get());
128129
fakeMasterService.setClusterStatePublisher((event, publishListener, ackListener) -> {
129130
coordinator.handlePublishRequest(new PublishRequest(event.state()));
130131
publishListener.onResponse(null);

0 commit comments

Comments
 (0)