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 @@ -1381,6 +1381,15 @@ private void setMultiProjectParams(Map<String, String> xContentParams) {
}
}

/**
* Verifies that all nodes in the cluster see the same master node and cluster UUID and use the same JSON serialization.
* <ul>
* <li> Fetches the cluster state from every node in the cluster </li>
* <li> Fetches the master node's view of the cluster state </li>
* <li> Compares each node's view with the master node's </li>
* </ul>
* @param namedWriteableRegistry
*/
protected final void doEnsureClusterStateConsistency(NamedWriteableRegistry namedWriteableRegistry) {
// This check has very little value in external test clusters and there is no guaranteed method of obtaining the master cluster
// state in those clusters.
Expand Down Expand Up @@ -1408,6 +1417,10 @@ protected final void doEnsureClusterStateConsistency(NamedWriteableRegistry name
);
Map<String, Object> masterStateMap = convertToMap(masterClusterState, xContentParams());
String masterId = masterClusterState.nodes().getMasterNodeId();
if (masterId == null) {
logger.warn("Failed to find an elected master in the cluster state: " + masterClusterState);
throw new AssertionError("Unable to find master in cluster state. Expecting a stable master node");
}
for (SubscribableListener<ClusterStateResponse> localStateListener : localStates) {
localStateListener.andThenAccept(localClusterStateResponse -> {
byte[] localClusterStateBytes = ClusterState.Builder.toBytes(localClusterStateResponse.getState());
Expand Down