Skip to content

Commit 90c76f5

Browse files
rjernstkcm
authored andcommitted
Remove remaining line length violations in o.e.cluster (#34941)
relates #34923, #34884
1 parent ec399ef commit 90c76f5

File tree

46 files changed

+768
-513
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+768
-513
lines changed

buildSrc/src/main/resources/checkstyle_suppressions.xml

Lines changed: 0 additions & 103 deletions
Large diffs are not rendered by default.

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ public void postAdded() {
216216
lastObservedState.set(new StoredState(newState));
217217
context.listener.onNewClusterState(newState);
218218
} else {
219-
logger.trace("observer: postAdded - predicate approved state but observing context has changed - ignoring ({})", newState);
219+
logger.trace("observer: postAdded - predicate approved state but observing context has changed - ignoring ({})",
220+
newState);
220221
}
221222
} else {
222223
logger.trace("observer: postAdded - predicate rejected state ({})", newState);
@@ -240,7 +241,8 @@ public void onTimeout(TimeValue timeout) {
240241
if (context != null) {
241242
clusterApplierService.removeTimeoutListener(this);
242243
long timeSinceStartMS = TimeValue.nsecToMSec(System.nanoTime() - startTimeNS);
243-
logger.trace("observer: timeout notification from cluster service. timeout setting [{}], time since start [{}]", timeOutValue, new TimeValue(timeSinceStartMS));
244+
logger.trace("observer: timeout notification from cluster service. timeout setting [{}], time since start [{}]",
245+
timeOutValue, new TimeValue(timeSinceStartMS));
244246
// update to latest, in case people want to retry
245247
lastObservedState.set(new StoredState(clusterApplierService.state()));
246248
timedOut = true;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* A task that can update the cluster state.
3030
*/
3131
public abstract class ClusterStateUpdateTask
32-
implements ClusterStateTaskConfig, ClusterStateTaskExecutor<ClusterStateUpdateTask>, ClusterStateTaskListener {
32+
implements ClusterStateTaskConfig, ClusterStateTaskExecutor<ClusterStateUpdateTask>, ClusterStateTaskListener {
3333

3434
private final Priority priority;
3535

@@ -43,7 +43,7 @@ public ClusterStateUpdateTask(Priority priority) {
4343

4444
@Override
4545
public final ClusterTasksResult<ClusterStateUpdateTask> execute(ClusterState currentState, List<ClusterStateUpdateTask> tasks)
46-
throws Exception {
46+
throws Exception {
4747
ClusterState result = execute(currentState);
4848
return ClusterTasksResult.<ClusterStateUpdateTask>builder().successes(tasks).build(result);
4949
}

server/src/main/java/org/elasticsearch/cluster/routing/OperationRouting.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public ShardIterator indexShards(ClusterState clusterState, String index, String
7474
return shards(clusterState, index, id, routing).shardsIt();
7575
}
7676

77-
public ShardIterator getShards(ClusterState clusterState, String index, String id, @Nullable String routing, @Nullable String preference) {
77+
public ShardIterator getShards(ClusterState clusterState, String index, String id, @Nullable String routing,
78+
@Nullable String preference) {
7879
return preferenceActiveShardIterator(shards(clusterState, index, id, routing), clusterState.nodes().getLocalNodeId(),
7980
clusterState.nodes(), preference, null, null);
8081
}

server/src/test/java/org/elasticsearch/cluster/SimpleClusterStateIT.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,9 @@ private void testFilteringByIndexWorks(String[] indices, String[] expected) {
198198
}
199199

200200
public void testLargeClusterStatePublishing() throws Exception {
201-
int estimatedBytesSize = scaledRandomIntBetween(ByteSizeValue.parseBytesSizeValue("10k", "estimatedBytesSize").bytesAsInt(),
202-
ByteSizeValue.parseBytesSizeValue("256k", "estimatedBytesSize").bytesAsInt());
201+
int estimatedBytesSize = scaledRandomIntBetween(
202+
ByteSizeValue.parseBytesSizeValue("10k", "estimatedBytesSize").bytesAsInt(),
203+
ByteSizeValue.parseBytesSizeValue("256k", "estimatedBytesSize").bytesAsInt());
203204
XContentBuilder mapping = XContentFactory.jsonBuilder().startObject().startObject("type").startObject("properties");
204205
int counter = 0;
205206
int numberOfFields = 0;
@@ -281,7 +282,8 @@ public void testIndicesIgnoreUnavailableFalse() throws Exception {
281282
// ignore_unavailable set to false throws exception when allowNoIndices is turned off
282283
IndicesOptions allowNoIndices = IndicesOptions.fromOptions(false, true, true, false);
283284
try {
284-
client().admin().cluster().prepareState().clear().setMetaData(true).setIndices("fzzbzz").setIndicesOptions(allowNoIndices).get();
285+
client().admin().cluster().prepareState().clear().setMetaData(true)
286+
.setIndices("fzzbzz").setIndicesOptions(allowNoIndices).get();
285287
fail("Expected IndexNotFoundException");
286288
} catch (IndexNotFoundException e) {
287289
assertThat(e.getMessage(), is("no such index [fzzbzz]"));

server/src/test/java/org/elasticsearch/cluster/ack/AckIT.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ public void testIndicesAliasesAcknowledgement() {
232232
public void testIndicesAliasesNoAcknowledgement() {
233233
createIndex("test");
234234

235-
AcknowledgedResponse indicesAliasesResponse = client().admin().indices().prepareAliases().addAlias("test", "alias").setTimeout("0s").get();
235+
AcknowledgedResponse indicesAliasesResponse = client().admin().indices().prepareAliases()
236+
.addAlias("test", "alias").setTimeout("0s").get();
236237
assertThat(indicesAliasesResponse.isAcknowledged(), equalTo(false));
237238
}
238239

@@ -285,7 +286,8 @@ public void testPutMappingNoAcknowledgement() {
285286
createIndex("test");
286287
ensureGreen();
287288

288-
AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping("test").setType("test").setSource("field", "type=keyword").setTimeout("0s").get();
289+
AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping("test").setType("test")
290+
.setSource("field", "type=keyword").setTimeout("0s").get();
289291
assertThat(putMappingResponse.isAcknowledged(), equalTo(false));
290292
}
291293

server/src/test/java/org/elasticsearch/cluster/metadata/DateMathExpressionResolverTests.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,22 @@ public void testExpression_MultiParts() throws Exception {
9494
public void testExpression_CustomFormat() throws Exception {
9595
List<String> results = expressionResolver.resolve(context, Arrays.asList("<.marvel-{now/d{YYYY.MM.dd}}>"));
9696
assertThat(results.size(), equalTo(1));
97-
assertThat(results.get(0), equalTo(".marvel-" + DateTimeFormat.forPattern("YYYY.MM.dd").print(new DateTime(context.getStartTime(), UTC))));
97+
assertThat(results.get(0),
98+
equalTo(".marvel-" + DateTimeFormat.forPattern("YYYY.MM.dd").print(new DateTime(context.getStartTime(), UTC))));
9899
}
99100

100101
public void testExpression_EscapeStatic() throws Exception {
101102
List<String> result = expressionResolver.resolve(context, Arrays.asList("<.mar\\{v\\}el-{now/d}>"));
102103
assertThat(result.size(), equalTo(1));
103-
assertThat(result.get(0), equalTo(".mar{v}el-" + DateTimeFormat.forPattern("YYYY.MM.dd").print(new DateTime(context.getStartTime(), UTC))));
104+
assertThat(result.get(0),
105+
equalTo(".mar{v}el-" + DateTimeFormat.forPattern("YYYY.MM.dd").print(new DateTime(context.getStartTime(), UTC))));
104106
}
105107

106108
public void testExpression_EscapeDateFormat() throws Exception {
107109
List<String> result = expressionResolver.resolve(context, Arrays.asList("<.marvel-{now/d{'\\{year\\}'YYYY}}>"));
108110
assertThat(result.size(), equalTo(1));
109-
assertThat(result.get(0), equalTo(".marvel-" + DateTimeFormat.forPattern("'{year}'YYYY").print(new DateTime(context.getStartTime(), UTC))));
111+
assertThat(result.get(0),
112+
equalTo(".marvel-" + DateTimeFormat.forPattern("'{year}'YYYY").print(new DateTime(context.getStartTime(), UTC))));
110113
}
111114

112115
public void testExpression_MixedArray() throws Exception {
@@ -115,9 +118,11 @@ public void testExpression_MixedArray() throws Exception {
115118
));
116119
assertThat(result.size(), equalTo(4));
117120
assertThat(result.get(0), equalTo("name1"));
118-
assertThat(result.get(1), equalTo(".marvel-" + DateTimeFormat.forPattern("YYYY.MM.dd").print(new DateTime(context.getStartTime(), UTC))));
121+
assertThat(result.get(1),
122+
equalTo(".marvel-" + DateTimeFormat.forPattern("YYYY.MM.dd").print(new DateTime(context.getStartTime(), UTC))));
119123
assertThat(result.get(2), equalTo("name2"));
120-
assertThat(result.get(3), equalTo(".logstash-" + DateTimeFormat.forPattern("YYYY.MM").print(new DateTime(context.getStartTime(), UTC).withDayOfMonth(1))));
124+
assertThat(result.get(3), equalTo(".logstash-" +
125+
DateTimeFormat.forPattern("YYYY.MM").print(new DateTime(context.getStartTime(), UTC).withDayOfMonth(1))));
121126
}
122127

123128
public void testExpression_CustomTimeZoneInIndexName() throws Exception {
@@ -135,7 +140,8 @@ public void testExpression_CustomTimeZoneInIndexName() throws Exception {
135140
DateTime now;
136141
if (hoursOffset >= 0) {
137142
// rounding to next day 00:00
138-
now = DateTime.now(UTC).plusHours(hoursOffset).plusMinutes(minutesOffset).withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0);
143+
now = DateTime.now(UTC).plusHours(hoursOffset).plusMinutes(minutesOffset)
144+
.withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0);
139145
} else {
140146
// rounding to today 00:00
141147
now = DateTime.now(UTC).withHourOfDay(0).withMinuteOfHour(0).withSecondOfMinute(0);

server/src/test/java/org/elasticsearch/cluster/metadata/WildcardExpressionResolverTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ public void testMatchesConcreteIndicesWildcardAndAliases() {
218218
// when ignoreAliases option is not set, WildcardExpressionResolver resolves the provided
219219
// expressions against the defined indices and aliases
220220
IndicesOptions indicesAndAliasesOptions = IndicesOptions.fromOptions(false, false, true, false, true, false, false);
221-
IndexNameExpressionResolver.Context indicesAndAliasesContext = new IndexNameExpressionResolver.Context(state, indicesAndAliasesOptions);
221+
IndexNameExpressionResolver.Context indicesAndAliasesContext =
222+
new IndexNameExpressionResolver.Context(state, indicesAndAliasesOptions);
222223

223224
// ignoreAliases option is set, WildcardExpressionResolver resolves the provided expressions
224225
// only against the defined indices

server/src/test/java/org/elasticsearch/cluster/routing/UnassignedInfoTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ public void testNewIndexRestored() {
141141
.build();
142142
ClusterState clusterState = ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY))
143143
.metaData(metaData)
144-
.routingTable(RoutingTable.builder().addAsNewRestore(metaData.index("test"), new SnapshotRecoverySource(new Snapshot("rep1", new SnapshotId("snp1", UUIDs.randomBase64UUID())), Version.CURRENT, "test"), new IntHashSet()).build()).build();
144+
.routingTable(RoutingTable.builder().addAsNewRestore(metaData.index("test"), new SnapshotRecoverySource(
145+
new Snapshot("rep1", new SnapshotId("snp1", UUIDs.randomBase64UUID())), Version.CURRENT, "test"),
146+
new IntHashSet()).build()).build();
145147
for (ShardRouting shard : clusterState.getRoutingNodes().shardsWithState(UNASSIGNED)) {
146148
assertThat(shard.unassignedInfo().getReason(), equalTo(UnassignedInfo.Reason.NEW_INDEX_RESTORED));
147149
}

server/src/test/java/org/elasticsearch/cluster/routing/allocation/AddIncrementallyTests.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public class AddIncrementallyTests extends ESAllocationTestCase {
5252

5353
public void testAddNodesAndIndices() {
5454
Settings.Builder settings = Settings.builder();
55-
settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString());
55+
settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
56+
ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString());
5657
AllocationService service = createAllocationService(settings.build());
5758

5859
ClusterState clusterState = initCluster(service, 1, 3, 3, 1);
@@ -95,7 +96,8 @@ public void testAddNodesAndIndices() {
9596

9697
public void testMinimalRelocations() {
9798
Settings.Builder settings = Settings.builder();
98-
settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString())
99+
settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
100+
ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString())
99101
.put("cluster.routing.allocation.node_concurrent_recoveries", 2);
100102
AllocationService service = createAllocationService(settings.build());
101103

@@ -156,7 +158,8 @@ public void testMinimalRelocations() {
156158

157159
public void testMinimalRelocationsNoLimit() {
158160
Settings.Builder settings = Settings.builder();
159-
settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(), ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString())
161+
settings.put(ClusterRebalanceAllocationDecider.CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE_SETTING.getKey(),
162+
ClusterRebalanceAllocationDecider.ClusterRebalanceType.ALWAYS.toString())
160163
.put("cluster.routing.allocation.node_concurrent_recoveries", 100)
161164
.put("cluster.routing.allocation.node_initial_primaries_recoveries", 100);
162165
AllocationService service = createAllocationService(settings.build());
@@ -261,8 +264,8 @@ private ClusterState initCluster(AllocationService service, int numberOfNodes, i
261264
RoutingTable.Builder routingTableBuilder = RoutingTable.builder();
262265

263266
for (int i = 0; i < numberOfIndices; i++) {
264-
IndexMetaData.Builder index = IndexMetaData.builder("test" + i).settings(settings(Version.CURRENT)).numberOfShards(numberOfShards).numberOfReplicas(
265-
numberOfReplicas);
267+
IndexMetaData.Builder index = IndexMetaData.builder("test" + i)
268+
.settings(settings(Version.CURRENT)).numberOfShards(numberOfShards).numberOfReplicas(numberOfReplicas);
266269
metaDataBuilder = metaDataBuilder.put(index);
267270
}
268271

@@ -279,7 +282,8 @@ private ClusterState initCluster(AllocationService service, int numberOfNodes, i
279282
for (int i = 0; i < numberOfNodes; i++) {
280283
nodes.add(newNode("node" + i));
281284
}
282-
ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY)).nodes(nodes).metaData(metaData).routingTable(initialRoutingTable).build();
285+
ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING
286+
.getDefault(Settings.EMPTY)).nodes(nodes).metaData(metaData).routingTable(initialRoutingTable).build();
283287
clusterState = service.reroute(clusterState, "reroute");
284288

285289
logger.info("restart all the primary shards, replicas will start initializing");
@@ -300,7 +304,8 @@ private ClusterState addIndex(ClusterState clusterState, AllocationService servi
300304
MetaData.Builder metaDataBuilder = MetaData.builder(clusterState.getMetaData());
301305
RoutingTable.Builder routingTableBuilder = RoutingTable.builder(clusterState.routingTable());
302306

303-
IndexMetaData.Builder index = IndexMetaData.builder("test" + indexOrdinal).settings(settings(Version.CURRENT)).numberOfShards(numberOfShards).numberOfReplicas(
307+
IndexMetaData.Builder index = IndexMetaData.builder("test" + indexOrdinal).settings(settings(Version.CURRENT))
308+
.numberOfShards(numberOfShards).numberOfReplicas(
304309
numberOfReplicas);
305310
IndexMetaData imd = index.build();
306311
metaDataBuilder = metaDataBuilder.put(imd, true);

0 commit comments

Comments
 (0)