Fix tribe node cluster state version increments (#25629)

With #24236, tribe nodes submit cluster state changes to their MasterService, making it unnecessary to explicitly update the cluster state version. This PR fixes the double-incrementing of cluster state versions on tribe nodes, which are not harmful, but unnecessary.
This commit is contained in:
Yannick Welsch 2017-07-10 16:25:11 +02:00 committed by GitHub
parent 3a5a54e83e
commit 7836bbf4d4
2 changed files with 4 additions and 1 deletions

View File

@ -367,7 +367,7 @@ public class TribeService extends AbstractLifecycleComponent {
@Override
public ClusterTasksResult<ClusterChangedEvent> execute(ClusterState currentState, List<ClusterChangedEvent> tasks) throws Exception {
ClusterTasksResult.Builder<ClusterChangedEvent> builder = ClusterTasksResult.builder();
ClusterState.Builder newState = ClusterState.builder(currentState).incrementVersion();
ClusterState.Builder newState = ClusterState.builder(currentState);
boolean clusterStateChanged = updateNodes(currentState, tasks, newState);
clusterStateChanged |= updateIndicesAndMetaData(currentState, tasks, newState);
builder.successes(tasks);

View File

@ -496,8 +496,11 @@ public class TribeIT extends ESIntegTestCase {
Collections.sort(customMetaDatas, (cm1, cm2) -> cm2.getData().compareTo(cm1.getData()));
final MergableCustomMetaData1 tribeNodeCustomMetaData = customMetaDatas.get(0);
try (Releasable tribeNode = startTribeNode()) {
ClusterState clusterState = client().admin().cluster().prepareState().get().getState();
putCustomMetaData(cluster1, customMetaData1);
assertCustomMetaDataUpdated(internalCluster(), customMetaData1);
// check that cluster state version is properly incremented
assertThat(client().admin().cluster().prepareState().get().getState().getVersion(), equalTo(clusterState.getVersion() + 1));
putCustomMetaData(cluster2, customMetaData2);
assertCustomMetaDataUpdated(internalCluster(), tribeNodeCustomMetaData);
}