@@ -193,8 +193,6 @@ public CompatibilityVersions read(StreamInput in, String key) throws IOException
193193
194194 private final boolean wasReadFromDiff ;
195195
196- private final Map <ProjectId , Settings > projectsSettings ;
197-
198196 // built on demand
199197 private volatile RoutingNodes routingNodes ;
200198
@@ -211,7 +209,6 @@ public ClusterState(long version, String stateUUID, ClusterState state) {
211209 state .blocks (),
212210 state .customs (),
213211 false ,
214- state .projectsSettings ,
215212 state .routingNodes
216213 );
217214 }
@@ -228,7 +225,6 @@ public ClusterState(
228225 ClusterBlocks blocks ,
229226 Map <String , Custom > customs ,
230227 boolean wasReadFromDiff ,
231- Map <ProjectId , Settings > projectsSettings ,
232228 @ Nullable RoutingNodes routingNodes
233229 ) {
234230 this .version = version ;
@@ -242,7 +238,6 @@ public ClusterState(
242238 this .blocks = blocks ;
243239 this .customs = customs ;
244240 this .wasReadFromDiff = wasReadFromDiff ;
245- this .projectsSettings = projectsSettings ;
246241 this .routingNodes = routingNodes ;
247242 assert assertConsistentRoutingNodes (routingTable , nodes , routingNodes );
248243 assert assertConsistentProjectState (routingTable , metadata );
@@ -410,14 +405,6 @@ public RoutingTable routingTable(ProjectId projectId) {
410405 return routingTable .routingTable (projectId );
411406 }
412407
413- public Settings projectSettings (ProjectId projectId ) {
414- return projectsSettings .getOrDefault (projectId , Settings .EMPTY );
415- }
416-
417- public Map <ProjectId , Settings > projectsSettings () {
418- return projectsSettings ;
419- }
420-
421408 @ Deprecated (forRemoval = true )
422409 public RoutingTable routingTable () {
423410 return routingTable .getRoutingTable ();
@@ -686,8 +673,7 @@ public enum Metric {
686673 METADATA ("metadata" ),
687674 ROUTING_TABLE ("routing_table" ),
688675 ROUTING_NODES ("routing_nodes" ),
689- CUSTOMS ("customs" ),
690- PROJECTS_SETTINGS ("projects_settings" );
676+ CUSTOMS ("customs" );
691677
692678 private static final Map <String , Metric > valueToEnum ;
693679
@@ -864,22 +850,7 @@ public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params outerP
864850 customs .entrySet ().iterator (),
865851 e -> ChunkedToXContentHelper .object (e .getKey (), e .getValue ().toXContentChunked (outerParams ))
866852 )
867- : Collections .emptyIterator (),
868-
869- chunkedSection (
870- multiProject && metrics .contains (Metric .PROJECTS_SETTINGS ),
871- (builder , params ) -> builder .startArray ("projects_settings" ),
872- projectsSettings .entrySet ().iterator (),
873-
874- entry -> Iterators .single ((builder , params ) -> {
875- builder .startObject ();
876- builder .field ("id" , entry .getKey ());
877- builder .startObject ("settings" );
878- entry .getValue ().toXContent (builder , new ToXContent .MapParams (Collections .singletonMap ("flat_settings" , "true" )));
879- return builder .endObject ().endObject ();
880- }),
881- (builder , params ) -> builder .endArray ()
882- )
853+ : Collections .emptyIterator ()
883854 );
884855 }
885856
@@ -1057,7 +1028,6 @@ public static class Builder {
10571028 private final Map <String , Set <String >> nodeFeatures ;
10581029 private ClusterBlocks blocks = ClusterBlocks .EMPTY_CLUSTER_BLOCK ;
10591030 private final ImmutableOpenMap .Builder <String , Custom > customs ;
1060- private final ImmutableOpenMap .Builder <ProjectId , Settings > projectsSettings ;
10611031 private boolean fromDiff ;
10621032
10631033 public Builder (ClusterState state ) {
@@ -1073,14 +1043,12 @@ public Builder(ClusterState state) {
10731043 this .blocks = state .blocks ();
10741044 this .customs = ImmutableOpenMap .builder (state .customs ());
10751045 this .fromDiff = false ;
1076- this .projectsSettings = ImmutableOpenMap .builder (state .projectsSettings );
10771046 }
10781047
10791048 public Builder (ClusterName clusterName ) {
10801049 this .compatibilityVersions = new HashMap <>();
10811050 this .nodeFeatures = new HashMap <>();
1082- this .projectsSettings = ImmutableOpenMap .builder ();
1083- customs = ImmutableOpenMap .builder ();
1051+ this .customs = ImmutableOpenMap .builder ();
10841052 this .clusterName = clusterName ;
10851053 }
10861054
@@ -1184,16 +1152,6 @@ public Builder putRoutingTable(ProjectId projectId, RoutingTable routingTable) {
11841152 return routingTable (globalRoutingTableBuilder .put (projectId , routingTable ).build ());
11851153 }
11861154
1187- public Builder putProjectSettings (ProjectId projectId , Settings settings ) {
1188- projectsSettings .put (projectId , settings );
1189- return this ;
1190- }
1191-
1192- public Builder projectsSettings (Map <ProjectId , Settings > projectsSettings ) {
1193- this .projectsSettings .putAllFromMap (projectsSettings );
1194- return this ;
1195- }
1196-
11971155 public Builder metadata (Metadata .Builder metadataBuilder ) {
11981156 return metadata (metadataBuilder .build ());
11991157 }
@@ -1298,7 +1256,6 @@ public ClusterState build() {
12981256 metadata != null ? blocks .initializeProjects (metadata .projects ().keySet ()) : blocks ,
12991257 customs .build (),
13001258 fromDiff ,
1301- projectsSettings .build (),
13021259 routingNodes
13031260 );
13041261 }
@@ -1350,9 +1307,6 @@ public static ClusterState readFrom(StreamInput in, DiscoveryNode localNode) thr
13501307 Custom customIndexMetadata = in .readNamedWriteable (Custom .class );
13511308 builder .putCustom (customIndexMetadata .getWriteableName (), customIndexMetadata );
13521309 }
1353- if (in .getTransportVersion ().onOrAfter (TransportVersions .CLUSTER_STATE_PROJECTS_SETTINGS )) {
1354- builder .projectsSettings (in .readMap (ProjectId ::readFrom , Settings ::readSettingsFromStream ));
1355- }
13561310 return builder .build ();
13571311 }
13581312
@@ -1374,9 +1328,6 @@ public void writeTo(StreamOutput out) throws IOException {
13741328 clusterFeatures .writeTo (out );
13751329 blocks .writeTo (out );
13761330 VersionedNamedWriteable .writeVersionedWritables (out , customs );
1377- if (out .getTransportVersion ().onOrAfter (TransportVersions .CLUSTER_STATE_PROJECTS_SETTINGS )) {
1378- out .writeMap (projectsSettings );
1379- }
13801331 }
13811332
13821333 private static class ClusterStateDiff implements Diff <ClusterState > {
@@ -1414,8 +1365,6 @@ public Diff<Settings> readDiff(StreamInput in, ProjectId key) throws IOException
14141365
14151366 private final Diff <Map <String , Custom >> customs ;
14161367
1417- private final DiffableUtils .MapDiff <ProjectId , Settings , Map <ProjectId , Settings >> projectsSettings ;
1418-
14191368 ClusterStateDiff (ClusterState before , ClusterState after ) {
14201369 fromUuid = before .stateUUID ;
14211370 toUuid = after .stateUUID ;
@@ -1433,12 +1382,6 @@ public Diff<Settings> readDiff(StreamInput in, ProjectId key) throws IOException
14331382 metadata = after .metadata .diff (before .metadata );
14341383 blocks = after .blocks .diff (before .blocks );
14351384 customs = DiffableUtils .diff (before .customs , after .customs , DiffableUtils .getStringKeySerializer (), CUSTOM_VALUE_SERIALIZER );
1436- projectsSettings = DiffableUtils .diff (
1437- before .projectsSettings ,
1438- after .projectsSettings ,
1439- ProjectId .PROJECT_ID_SERIALIZER ,
1440- SETTINGS_SERIALIZER
1441- );
14421385 }
14431386
14441387 ClusterStateDiff (StreamInput in , DiscoveryNode localNode ) throws IOException {
@@ -1455,11 +1398,6 @@ public Diff<Settings> readDiff(StreamInput in, ProjectId key) throws IOException
14551398 metadata = Metadata .readDiffFrom (in );
14561399 blocks = ClusterBlocks .readDiffFrom (in );
14571400 customs = DiffableUtils .readJdkMapDiff (in , DiffableUtils .getStringKeySerializer (), CUSTOM_VALUE_SERIALIZER );
1458- if (in .getTransportVersion ().onOrAfter (TransportVersions .CLUSTER_STATE_PROJECTS_SETTINGS )) {
1459- projectsSettings = DiffableUtils .readJdkMapDiff (in , ProjectId .PROJECT_ID_SERIALIZER , SETTINGS_SERIALIZER );
1460- } else {
1461- projectsSettings = DiffableUtils .emptyDiff ();
1462- }
14631401 }
14641402
14651403 @ Override
@@ -1476,9 +1414,6 @@ public void writeTo(StreamOutput out) throws IOException {
14761414 metadata .writeTo (out );
14771415 blocks .writeTo (out );
14781416 customs .writeTo (out );
1479- if (out .getTransportVersion ().onOrAfter (TransportVersions .CLUSTER_STATE_PROJECTS_SETTINGS )) {
1480- projectsSettings .writeTo (out );
1481- }
14821417 }
14831418
14841419 @ Override
@@ -1500,7 +1435,6 @@ public ClusterState apply(ClusterState state) {
15001435 builder .metadata (metadata .apply (state .metadata ));
15011436 builder .blocks (blocks .apply (state .blocks ));
15021437 builder .customs (customs .apply (state .customs ));
1503- builder .projectsSettings (this .projectsSettings .apply (state .projectsSettings ));
15041438 builder .fromDiff (state );
15051439 return builder .build ();
15061440 }
0 commit comments