@@ -106,8 +106,6 @@ public class ProjectMetadata implements Iterable<IndexMetadata>, Diffable<Projec
106106 private volatile SortedMap <String , IndexAbstraction > indicesLookup ;
107107 private final Map <String , MappingMetadata > mappingsByHash ;
108108
109- private final Settings settings ;
110-
111109 private final IndexVersion oldestIndexVersion ;
112110
113111 public static final ClusterBlock PROJECT_UNDER_DELETION_BLOCK = new ClusterBlock (
@@ -138,7 +136,6 @@ private ProjectMetadata(
138136 String [] visibleClosedIndices ,
139137 SortedMap <String , IndexAbstraction > indicesLookup ,
140138 Map <String , MappingMetadata > mappingsByHash ,
141- Settings settings ,
142139 IndexVersion oldestIndexVersion
143140 ) {
144141 this .id = id ;
@@ -157,7 +154,6 @@ private ProjectMetadata(
157154 this .visibleClosedIndices = visibleClosedIndices ;
158155 this .indicesLookup = indicesLookup ;
159156 this .mappingsByHash = mappingsByHash ;
160- this .settings = settings ;
161157 this .oldestIndexVersion = oldestIndexVersion ;
162158 assert assertConsistent ();
163159 }
@@ -239,7 +235,6 @@ public ProjectMetadata withLifecycleState(Index index, LifecycleExecutionState l
239235 visibleClosedIndices ,
240236 indicesLookup ,
241237 mappingsByHash ,
242- settings ,
243238 oldestIndexVersion
244239 );
245240 }
@@ -273,7 +268,6 @@ public ProjectMetadata withIndexSettingsUpdates(Map<Index, Settings> updates) {
273268 visibleClosedIndices ,
274269 indicesLookup ,
275270 mappingsByHash ,
276- settings ,
277271 oldestIndexVersion
278272 );
279273 }
@@ -308,7 +302,6 @@ public ProjectMetadata withAllocationAndTermUpdatesOnly(Map<String, IndexMetadat
308302 visibleClosedIndices ,
309303 indicesLookup ,
310304 mappingsByHash ,
311- settings ,
312305 oldestIndexVersion
313306 );
314307 }
@@ -397,7 +390,6 @@ public ProjectMetadata withAddedIndex(IndexMetadata index) {
397390 updatedVisibleClosedIndices ,
398391 null ,
399392 updatedMappingsByHash ,
400- settings ,
401393 IndexVersion .min (index .getCompatibilityVersion (), oldestIndexVersion )
402394 );
403395 }
@@ -749,10 +741,6 @@ public Map<String, IndexTemplateMetadata> templates() {
749741 return templates ;
750742 }
751743
752- public Settings settings () {
753- return settings ;
754- }
755-
756744 /**
757745 * Checks whether the provided index is a data stream.
758746 */
@@ -1123,9 +1111,6 @@ public boolean isIndexManagedByILM(IndexMetadata indexMetadata) {
11231111 }
11241112
11251113 static boolean isStateEquals (ProjectMetadata project1 , ProjectMetadata project2 ) {
1126- if (project1 .settings ().equals (project2 .settings ()) == false ) {
1127- return false ;
1128- }
11291114 if (project1 .templates ().equals (project2 .templates ()) == false ) {
11301115 return false ;
11311116 }
@@ -1159,7 +1144,6 @@ public static class Builder {
11591144 private final ImmutableOpenMap .Builder <String , IndexTemplateMetadata > templates ;
11601145 private final ImmutableOpenMap .Builder <String , Metadata .ProjectCustom > customs ;
11611146 private final ImmutableOpenMap .Builder <String , ReservedStateMetadata > reservedStateMetadata ;
1162- private Settings settings = Settings .EMPTY ;
11631147
11641148 private SortedMap <String , IndexAbstraction > previousIndicesLookup ;
11651149
@@ -1177,7 +1161,6 @@ public static class Builder {
11771161 this .templates = ImmutableOpenMap .builder (projectMetadata .templates );
11781162 this .customs = ImmutableOpenMap .builder (projectMetadata .customs );
11791163 this .reservedStateMetadata = ImmutableOpenMap .builder (projectMetadata .reservedStateMetadata );
1180- this .settings = projectMetadata .settings ;
11811164 this .previousIndicesLookup = projectMetadata .indicesLookup ;
11821165 this .mappingsByHash = new HashMap <>(projectMetadata .mappingsByHash );
11831166 this .checkForUnusedMappings = false ;
@@ -1551,11 +1534,6 @@ public Builder removeReservedState(ReservedStateMetadata metadata) {
15511534 return this ;
15521535 }
15531536
1554- public Builder settings (Settings settings ) {
1555- this .settings = settings ;
1556- return this ;
1557- }
1558-
15591537 public Builder indexGraveyard (final IndexGraveyard indexGraveyard ) {
15601538 return putCustom (IndexGraveyard .TYPE , indexGraveyard );
15611539 }
@@ -1715,7 +1693,6 @@ public ProjectMetadata build(boolean skipNameCollisionChecks) {
17151693 visibleClosedIndicesArray ,
17161694 indicesLookup ,
17171695 Collections .unmodifiableMap (mappingsByHash ),
1718- settings ,
17191696 IndexVersion .fromId (oldestIndexVersionId )
17201697 );
17211698 }
@@ -2143,7 +2120,7 @@ public static ProjectMetadata fromXContent(XContentParser parser) throws IOExcep
21432120 }
21442121 }
21452122 case "settings" -> {
2146- projectBuilder . settings ( Settings .fromXContent (parser ) );
2123+ Settings .fromXContent (parser );
21472124 }
21482125 default -> Metadata .Builder .parseCustomObject (
21492126 parser ,
@@ -2190,11 +2167,6 @@ public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params p) {
21902167 ),
21912168 indices ,
21922169 customs ,
2193- multiProject ? Iterators .single ((builder , params ) -> {
2194- builder .startObject ("settings" );
2195- settings .toXContent (builder , new ToXContent .MapParams (Collections .singletonMap ("flat_settings" , "true" )));
2196- return builder .endObject ();
2197- }) : Collections .emptyIterator (),
21982170 multiProject
21992171 ? ChunkedToXContentHelper .object ("reserved_state" , reservedStateMetadata ().values ().iterator ())
22002172 : Collections .emptyIterator ()
@@ -2229,8 +2201,9 @@ public static ProjectMetadata readFrom(StreamInput in) throws IOException {
22292201 builder .put (ReservedStateMetadata .readFrom (in ));
22302202 }
22312203
2232- if (in .getTransportVersion ().onOrAfter (TransportVersions .PROJECT_METADATA_SETTINGS )) {
2233- builder .settings (Settings .readSettingsFromStream (in ));
2204+ if (in .getTransportVersion ()
2205+ .between (TransportVersions .PROJECT_METADATA_SETTINGS , TransportVersions .CLUSTER_STATE_PROJECTS_SETTINGS )) {
2206+ Settings .readSettingsFromStream (in );
22342207 }
22352208
22362209 return builder .build ();
@@ -2264,8 +2237,9 @@ public void writeTo(StreamOutput out) throws IOException {
22642237 VersionedNamedWriteable .writeVersionedWriteables (out , customs .values ());
22652238 out .writeCollection (reservedStateMetadata .values ());
22662239
2267- if (out .getTransportVersion ().onOrAfter (TransportVersions .PROJECT_METADATA_SETTINGS )) {
2268- settings .writeTo (out );
2240+ if (out .getTransportVersion ()
2241+ .between (TransportVersions .PROJECT_METADATA_SETTINGS , TransportVersions .CLUSTER_STATE_PROJECTS_SETTINGS )) {
2242+ Settings .EMPTY .writeTo (out );
22692243 }
22702244 }
22712245
@@ -2286,15 +2260,13 @@ static class ProjectMetadataDiff implements Diff<ProjectMetadata> {
22862260 String ,
22872261 ReservedStateMetadata ,
22882262 ImmutableOpenMap <String , ReservedStateMetadata >> reservedStateMetadata ;
2289- private final Diff <Settings > settingsDiff ;
22902263
22912264 private ProjectMetadataDiff (ProjectMetadata before , ProjectMetadata after ) {
22922265 if (before == after ) {
22932266 indices = DiffableUtils .emptyDiff ();
22942267 templates = DiffableUtils .emptyDiff ();
22952268 customs = DiffableUtils .emptyDiff ();
22962269 reservedStateMetadata = DiffableUtils .emptyDiff ();
2297- settingsDiff = Settings .EMPTY_DIFF ;
22982270 } else {
22992271 indices = DiffableUtils .diff (before .indices , after .indices , DiffableUtils .getStringKeySerializer ());
23002272 templates = DiffableUtils .diff (before .templates , after .templates , DiffableUtils .getStringKeySerializer ());
@@ -2309,22 +2281,19 @@ private ProjectMetadataDiff(ProjectMetadata before, ProjectMetadata after) {
23092281 after .reservedStateMetadata ,
23102282 DiffableUtils .getStringKeySerializer ()
23112283 );
2312- settingsDiff = after .settings .diff (before .settings );
23132284 }
23142285 }
23152286
23162287 ProjectMetadataDiff (
23172288 DiffableUtils .MapDiff <String , IndexMetadata , ImmutableOpenMap <String , IndexMetadata >> indices ,
23182289 DiffableUtils .MapDiff <String , IndexTemplateMetadata , ImmutableOpenMap <String , IndexTemplateMetadata >> templates ,
23192290 DiffableUtils .MapDiff <String , Metadata .ProjectCustom , ImmutableOpenMap <String , Metadata .ProjectCustom >> customs ,
2320- DiffableUtils .MapDiff <String , ReservedStateMetadata , ImmutableOpenMap <String , ReservedStateMetadata >> reservedStateMetadata ,
2321- Diff <Settings > settingsDiff
2291+ DiffableUtils .MapDiff <String , ReservedStateMetadata , ImmutableOpenMap <String , ReservedStateMetadata >> reservedStateMetadata
23222292 ) {
23232293 this .indices = indices ;
23242294 this .templates = templates ;
23252295 this .customs = customs ;
23262296 this .reservedStateMetadata = reservedStateMetadata ;
2327- this .settingsDiff = settingsDiff ;
23282297 }
23292298
23302299 ProjectMetadataDiff (StreamInput in ) throws IOException {
@@ -2336,10 +2305,9 @@ private ProjectMetadataDiff(ProjectMetadata before, ProjectMetadata after) {
23362305 DiffableUtils .getStringKeySerializer (),
23372306 RESERVED_DIFF_VALUE_READER
23382307 );
2339- if (in .getTransportVersion ().onOrAfter (TransportVersions .PROJECT_METADATA_SETTINGS )) {
2340- settingsDiff = Settings .readSettingsDiffFromStream (in );
2341- } else {
2342- settingsDiff = Settings .EMPTY_DIFF ;
2308+ if (in .getTransportVersion ()
2309+ .between (TransportVersions .PROJECT_METADATA_SETTINGS , TransportVersions .CLUSTER_STATE_PROJECTS_SETTINGS )) {
2310+ Settings .readSettingsDiffFromStream (in );
23432311 }
23442312 }
23452313
@@ -2365,18 +2333,15 @@ public void writeTo(StreamOutput out) throws IOException {
23652333 templates .writeTo (out );
23662334 customs .writeTo (out );
23672335 reservedStateMetadata .writeTo (out );
2368- if (out .getTransportVersion ().onOrAfter (TransportVersions .PROJECT_METADATA_SETTINGS )) {
2369- settingsDiff .writeTo (out );
2336+ if (out .getTransportVersion ()
2337+ .between (TransportVersions .PROJECT_METADATA_SETTINGS , TransportVersions .CLUSTER_STATE_PROJECTS_SETTINGS )) {
2338+ Settings .EMPTY_DIFF .writeTo (out );
23702339 }
23712340 }
23722341
23732342 @ Override
23742343 public ProjectMetadata apply (ProjectMetadata part ) {
2375- if (indices .isEmpty ()
2376- && templates .isEmpty ()
2377- && customs .isEmpty ()
2378- && reservedStateMetadata .isEmpty ()
2379- && settingsDiff == Settings .EMPTY_DIFF ) {
2344+ if (indices .isEmpty () && templates .isEmpty () && customs .isEmpty () && reservedStateMetadata .isEmpty ()) {
23802345 // nothing to do
23812346 return part ;
23822347 }
@@ -2391,7 +2356,6 @@ public ProjectMetadata apply(ProjectMetadata part) {
23912356 && builder .dataStreamMetadata () == part .custom (DataStreamMetadata .TYPE , DataStreamMetadata .EMPTY )) {
23922357 builder .previousIndicesLookup = part .indicesLookup ;
23932358 }
2394- builder .settings = settingsDiff .apply (part .settings );
23952359 return builder .build (true );
23962360 }
23972361 }
0 commit comments