Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2040,7 +2040,11 @@ public String getMasterName(@Nullable String viaNode) {
try {
ClusterServiceUtils.awaitClusterState(logger, state -> state.nodes().getMasterNode() != null, clusterService(viaNode));
final ClusterState state = client(viaNode).admin().cluster().prepareState(TEST_REQUEST_TIMEOUT).setLocal(true).get().getState();
return state.nodes().getMasterNode().getName();
final DiscoveryNode masterNode = state.nodes().getMasterNode();
if (masterNode == null) {
throw new AssertionError("Master is not stable but the method expects a stable master node");
}
return masterNode.getName();
} catch (Exception e) {
logger.warn("Can't fetch cluster state", e);
throw new RuntimeException("Can't get master node " + e.getMessage(), e);
Expand Down