Skip to content

Commit 3a95016

Browse files
author
Srikanth Padakanti
committed
Remove the bounded address helper and it's setting
Signed-off-by: Srikanth Padakanti <[email protected]>
1 parent 02d65fa commit 3a95016

File tree

3 files changed

+1
-75
lines changed

3 files changed

+1
-75
lines changed

server/src/main/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelper.java

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -74,27 +74,6 @@ public class ClusterFormationFailureHelper {
7474
Setting.Property.NodeScope
7575
);
7676

77-
public static final Setting<Integer> DISCOVERY_CLUSTER_FORMATION_WARNING_ADDRESS_LIMIT_SETTING = Setting.intSetting(
78-
"discovery.cluster_formation_warning_addresses_limit",
79-
200,
80-
0,
81-
Setting.Property.NodeScope
82-
);
83-
84-
/** Package-private for deterministic unit testing of cluster formation warning log formatting. */
85-
static String formatListForLog(List<?> items, int limit) {
86-
if (items == null || items.isEmpty()) {
87-
return "[]";
88-
}
89-
if (limit <= 0) {
90-
return "[... omitted; size=" + items.size() + "]";
91-
}
92-
if (items.size() <= limit) {
93-
return items.toString();
94-
}
95-
return items.subList(0, limit) + " ... (+" + (items.size() - limit) + " more)";
96-
}
97-
9877
private final Supplier<ClusterFormationState> clusterFormationStateSupplier;
9978
private final ThreadPool threadPool;
10079
private final TimeValue clusterFormationWarningTimeout;
@@ -210,15 +189,13 @@ String getDescription() {
210189
false
211190
).map(n -> n.toString()).collect(Collectors.toList());
212191

213-
final int addressLimit = DISCOVERY_CLUSTER_FORMATION_WARNING_ADDRESS_LIMIT_SETTING.get(settings);
214-
215192
final String discoveryWillContinueDescription = String.format(
216193
Locale.ROOT,
217194
"node term %d, last-accepted version %d in term %d; discovery will continue using %s from hosts providers and %s from last-known cluster state",
218195
currentTerm,
219196
clusterState.getVersionOrMetadataVersion(),
220197
clusterState.term(),
221-
formatListForLog(resolvedAddresses, addressLimit),
198+
resolvedAddresses,
222199
clusterStateNodes
223200
);
224201

server/src/main/java/org/opensearch/common/settings/ClusterSettings.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,6 @@ public void apply(Settings value, Settings current, Settings previous) {
660660
PeerFinder.DISCOVERY_FIND_PEERS_INTERVAL_DURING_DECOMMISSION_SETTING,
661661
PeerFinder.DISCOVERY_REQUEST_PEERS_TIMEOUT_SETTING,
662662
ClusterFormationFailureHelper.DISCOVERY_CLUSTER_FORMATION_WARNING_TIMEOUT_SETTING,
663-
ClusterFormationFailureHelper.DISCOVERY_CLUSTER_FORMATION_WARNING_ADDRESS_LIMIT_SETTING,
664663
ElectionSchedulerFactory.ELECTION_INITIAL_TIMEOUT_SETTING,
665664
ElectionSchedulerFactory.ELECTION_BACK_OFF_TIME_SETTING,
666665
ElectionSchedulerFactory.ELECTION_MAX_TIMEOUT_SETTING,

server/src/test/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelperTests.java

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,54 +1000,4 @@ public void testDescriptionAfterBootstrapping() {
10001000
);
10011001
}
10021002

1003-
public void testFormatListForLogTruncates() {
1004-
assertThat(ClusterFormationFailureHelper.formatListForLog(null, 10), is("[]"));
1005-
assertThat(ClusterFormationFailureHelper.formatListForLog(emptyList(), 10), is("[]"));
1006-
1007-
assertThat(ClusterFormationFailureHelper.formatListForLog(Arrays.asList("a", "b", "c", "d"), 0), is("[... omitted; size=4]"));
1008-
1009-
assertThat(ClusterFormationFailureHelper.formatListForLog(Arrays.asList("a", "b", "c", "d"), 2), is("[a, b] ... (+2 more)"));
1010-
1011-
assertThat(ClusterFormationFailureHelper.formatListForLog(Arrays.asList("a", "b", "c", "d"), 4), is("[a, b, c, d]"));
1012-
}
1013-
1014-
public void testDescriptionWithLongHostsProviderAddressesListTruncates() {
1015-
final Settings settings = Settings.builder()
1016-
.put(ClusterFormationFailureHelper.DISCOVERY_CLUSTER_FORMATION_WARNING_ADDRESS_LIMIT_SETTING.getKey(), 2)
1017-
.build();
1018-
1019-
final DiscoveryNode localNode = new DiscoveryNode("local", buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT);
1020-
final ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT)
1021-
.version(12L)
1022-
.metadata(Metadata.builder().coordinationMetadata(CoordinationMetadata.builder().term(4L).build()))
1023-
.nodes(DiscoveryNodes.builder().add(localNode).localNodeId(localNode.getId()))
1024-
.build();
1025-
1026-
final TransportAddress a1 = buildNewFakeTransportAddress();
1027-
final TransportAddress a2 = buildNewFakeTransportAddress();
1028-
final TransportAddress a3 = buildNewFakeTransportAddress();
1029-
final TransportAddress a4 = buildNewFakeTransportAddress();
1030-
final TransportAddress a5 = buildNewFakeTransportAddress();
1031-
1032-
assertThat(
1033-
new ClusterFormationState(
1034-
settings,
1035-
clusterState,
1036-
Arrays.asList(a1, a2, a3, a4, a5),
1037-
emptyList(),
1038-
16L,
1039-
electionStrategy,
1040-
new StatusInfo(HEALTHY, "healthy-info")
1041-
).getDescription(),
1042-
is(
1043-
"cluster-manager not discovered yet: have discovered []; node term 16, last-accepted version 12 in term 4; "
1044-
+ "discovery will continue using ["
1045-
+ a1
1046-
+ ", "
1047-
+ a2
1048-
+ "] ... (+3 more) from hosts providers and [] from last-known cluster state"
1049-
)
1050-
);
1051-
}
1052-
10531003
}

0 commit comments

Comments
 (0)