58
58
import java .util .Arrays ;
59
59
import java .util .Collections ;
60
60
import java .util .EnumSet ;
61
+ import java .util .HashMap ;
61
62
import java .util .HashSet ;
62
63
import java .util .Iterator ;
63
64
import java .util .List ;
@@ -516,7 +517,7 @@ public Iterator<Setting<?>> settings() {
516
517
517
518
private final ImmutableOpenMap <String , DiffableStringMap > customData ;
518
519
519
- private final ImmutableOpenIntMap < Set <String >> inSyncAllocationIds ;
520
+ private final Map < Integer , Set <String >> inSyncAllocationIds ;
520
521
521
522
private final transient int totalNumberOfShards ;
522
523
@@ -571,7 +572,7 @@ private IndexMetadata(
571
572
final MappingMetadata mapping ,
572
573
final ImmutableOpenMap <String , AliasMetadata > aliases ,
573
574
final ImmutableOpenMap <String , DiffableStringMap > customData ,
574
- final ImmutableOpenIntMap < Set <String >> inSyncAllocationIds ,
575
+ final Map < Integer , Set <String >> inSyncAllocationIds ,
575
576
final DiscoveryNodeFilters requireFilters ,
576
577
final DiscoveryNodeFilters initialRecoveryFilters ,
577
578
final DiscoveryNodeFilters includeFilters ,
@@ -889,7 +890,7 @@ public Map<String, String> getCustomData(final String key) {
889
890
return this .customData .get (key );
890
891
}
891
892
892
- public ImmutableOpenIntMap < Set <String >> getInSyncAllocationIds () {
893
+ public Map < Integer , Set <String >> getInSyncAllocationIds () {
893
894
return inSyncAllocationIds ;
894
895
}
895
896
@@ -1031,7 +1032,7 @@ private static class IndexMetadataDiff implements Diff<IndexMetadata> {
1031
1032
private final Diff <ImmutableOpenMap <String , MappingMetadata >> mappings ;
1032
1033
private final Diff <ImmutableOpenMap <String , AliasMetadata >> aliases ;
1033
1034
private final Diff <ImmutableOpenMap <String , DiffableStringMap >> customData ;
1034
- private final Diff <ImmutableOpenIntMap < Set <String >>> inSyncAllocationIds ;
1035
+ private final Diff <Map < Integer , Set <String >>> inSyncAllocationIds ;
1035
1036
private final Diff <ImmutableOpenMap <String , RolloverInfo >> rolloverInfos ;
1036
1037
private final boolean isSystem ;
1037
1038
private final IndexLongFieldRange timestampRange ;
@@ -1095,7 +1096,7 @@ private static class IndexMetadataDiff implements Diff<IndexMetadata> {
1095
1096
mappings = DiffableUtils .readImmutableOpenMapDiff (in , DiffableUtils .getStringKeySerializer (), MAPPING_DIFF_VALUE_READER );
1096
1097
aliases = DiffableUtils .readImmutableOpenMapDiff (in , DiffableUtils .getStringKeySerializer (), ALIAS_METADATA_DIFF_VALUE_READER );
1097
1098
customData = DiffableUtils .readImmutableOpenMapDiff (in , DiffableUtils .getStringKeySerializer (), CUSTOM_DIFF_VALUE_READER );
1098
- inSyncAllocationIds = DiffableUtils .readImmutableOpenIntMapDiff (
1099
+ inSyncAllocationIds = DiffableUtils .readJdkMapDiff (
1099
1100
in ,
1100
1101
DiffableUtils .getVIntKeySerializer (),
1101
1102
DiffableUtils .StringSetValueSerializer .getInstance ()
@@ -1153,7 +1154,7 @@ public IndexMetadata apply(IndexMetadata part) {
1153
1154
).get (MapperService .SINGLE_MAPPING_NAME );
1154
1155
builder .aliases .putAllFromMap (aliases .apply (part .aliases ));
1155
1156
builder .customMetadata .putAllFromMap (customData .apply (part .customData ));
1156
- builder .inSyncAllocationIds .putAll (( Map < Integer , Set < String >>) inSyncAllocationIds .apply (part .inSyncAllocationIds ));
1157
+ builder .inSyncAllocationIds .putAll (inSyncAllocationIds .apply (part .inSyncAllocationIds ));
1157
1158
builder .rolloverInfos .putAllFromMap (rolloverInfos .apply (part .rolloverInfos ));
1158
1159
builder .system (isSystem );
1159
1160
builder .timestampRange (timestampRange );
@@ -1309,7 +1310,7 @@ public static class Builder {
1309
1310
private MappingMetadata mapping ;
1310
1311
private final ImmutableOpenMap .Builder <String , AliasMetadata > aliases ;
1311
1312
private final ImmutableOpenMap .Builder <String , DiffableStringMap > customMetadata ;
1312
- private final ImmutableOpenIntMap . Builder < Set <String >> inSyncAllocationIds ;
1313
+ private final Map < Integer , Set <String >> inSyncAllocationIds ;
1313
1314
private final ImmutableOpenMap .Builder <String , RolloverInfo > rolloverInfos ;
1314
1315
private Integer routingNumShards ;
1315
1316
private boolean isSystem ;
@@ -1320,7 +1321,7 @@ public Builder(String index) {
1320
1321
this .index = index ;
1321
1322
this .aliases = ImmutableOpenMap .builder ();
1322
1323
this .customMetadata = ImmutableOpenMap .builder ();
1323
- this .inSyncAllocationIds = ImmutableOpenIntMap . builder ();
1324
+ this .inSyncAllocationIds = new HashMap <> ();
1324
1325
this .rolloverInfos = ImmutableOpenMap .builder ();
1325
1326
this .isSystem = false ;
1326
1327
}
@@ -1338,7 +1339,7 @@ public Builder(IndexMetadata indexMetadata) {
1338
1339
this .aliases = ImmutableOpenMap .builder (indexMetadata .aliases );
1339
1340
this .customMetadata = ImmutableOpenMap .builder (indexMetadata .customData );
1340
1341
this .routingNumShards = indexMetadata .routingNumShards ;
1341
- this .inSyncAllocationIds = ImmutableOpenIntMap . builder (indexMetadata .inSyncAllocationIds );
1342
+ this .inSyncAllocationIds = new HashMap <> (indexMetadata .inSyncAllocationIds );
1342
1343
this .rolloverInfos = ImmutableOpenMap .builder (indexMetadata .rolloverInfos );
1343
1344
this .isSystem = indexMetadata .isSystem ;
1344
1345
this .timestampRange = indexMetadata .timestampRange ;
@@ -2019,7 +2020,7 @@ public static IndexMetadata legacyFromXContent(XContentParser parser) throws IOE
2019
2020
allocationIds .add (parser .text ());
2020
2021
}
2021
2022
}
2022
- builder .putInSyncAllocationIds (Integer .valueOf (shardId ), allocationIds );
2023
+ builder .putInSyncAllocationIds (Integer .parseInt (shardId ), allocationIds );
2023
2024
} else {
2024
2025
throw new IllegalArgumentException ("Unexpected token: " + token );
2025
2026
}
0 commit comments