Skip to content

Commit 550af4f

Browse files
Stop rebuilding ClusterFeatures on every CS update (elastic#112559)
If the node-features maps are equal, then the instances are equal and there's no point in rebuilding which entails rebuilding the costly `allNodeFeatures` field in them eventually.
1 parent c118254 commit 550af4f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/main/java/org/elasticsearch/cluster/ClusterState.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,9 @@ public ClusterState build() {
984984
routingTable,
985985
nodes,
986986
compatibilityVersions,
987-
new ClusterFeatures(nodeFeatures),
987+
previous != null && getNodeFeatures(previous.clusterFeatures).equals(nodeFeatures)
988+
? previous.clusterFeatures
989+
: new ClusterFeatures(nodeFeatures),
988990
blocks,
989991
customs.build(),
990992
fromDiff,

0 commit comments

Comments
 (0)