Skip to content

Commit 12ad399

Browse files
committed
Reformat Elasticsearch source
1 parent 4e09186 commit 12ad399

File tree

10,457 files changed

+437698
-282981
lines changed

Some content is hidden

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

10,457 files changed

+437698
-282981
lines changed

build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/precommit/FormattingPrecommitPlugin.java

Lines changed: 2 additions & 250 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void apply(Project project) {
6060
formatterConfigPath = "../" + formatterConfigPath;
6161
}
6262

63-
java.target(getTargets(project.getPath()));
63+
java.target("src/**/*.java");
6464

6565
// Use `@formatter:off` and `@formatter:on` to toggle formatting - ONLY IF STRICTLY NECESSARY
6666
java.toggleOffOn("@formatter:off", "@formatter:on");
@@ -83,259 +83,11 @@ public void apply(Project project) {
8383
}
8484
}
8585

86-
@SuppressWarnings("CheckStyle")
87-
private Object[] getTargets(String projectPath) {
88-
if (projectPath.equals(":server")) {
89-
return new String[] {
90-
"src/*/java/org/elasticsearch/action/admin/cluster/repositories/**/*.java",
91-
"src/*/java/org/elasticsearch/action/admin/cluster/snapshots/**/*.java",
92-
"src/test/java/org/elasticsearch/common/xcontent/support/XContentMapValuesTests.java",
93-
"src/*/java/org/elasticsearch/index/IndexMode.java",
94-
"src/*/java/org/elasticsearch/index/IndexRouting.java",
95-
"src/*/java/org/elasticsearch/index/TimeSeriesModeTests.java",
96-
"src/*/java/org/elasticsearch/index/snapshots/**/*.java",
97-
"src/*/java/org/elasticsearch/repositories/**/*.java",
98-
"src/*/java/org/elasticsearch/search/aggregations/**/*.java",
99-
"src/*/java/org/elasticsearch/snapshots/**/*.java" };
100-
} else if (projectPath.equals(":test:framework")) {
101-
return new String[] {
102-
"src/test/java/org/elasticsearch/common/xcontent/support/AbstractFilteringTestCase.java",
103-
};
104-
} else {
105-
// Normally this isn"t necessary, but we have Java sources in
106-
// non-standard places
107-
return new String[] { "src/**/*.java" };
108-
}
109-
}
110-
11186
// Do not add new sub-projects here!
11287
private static final List<String> PROJECT_PATHS_TO_EXCLUDE = List.of(
113-
":client:benchmark",
114-
":client:client-benchmark-noop-api-plugin",
115-
":client:rest",
116-
":client:rest-high-level",
117-
":client:rest-high-level:qa:ssl-enabled",
118-
":client:sniffer",
119-
":client:test",
120-
":distribution:archives:integ-test-zip",
12188
":distribution:bwc:bugfix",
12289
":distribution:bwc:maintenance",
12390
":distribution:bwc:minor",
124-
":distribution:bwc:staged",
125-
":distribution:docker",
126-
":docs",
127-
":example-plugins:custom-settings",
128-
":example-plugins:custom-significance-heuristic",
129-
":example-plugins:custom-suggester",
130-
":example-plugins:painless-whitelist",
131-
":example-plugins:rescore",
132-
":example-plugins:rest-handler",
133-
":example-plugins:script-expert-scoring",
134-
":example-plugins:security-authorization-engine",
135-
":libs:elasticsearch-cli",
136-
":libs:elasticsearch-core",
137-
":libs:elasticsearch-dissect",
138-
":libs:elasticsearch-geo",
139-
":libs:elasticsearch-grok",
140-
":libs:elasticsearch-lz4",
141-
":libs:elasticsearch-nio",
142-
":libs:elasticsearch-plugin-classloader",
143-
":libs:elasticsearch-secure-sm",
144-
":libs:elasticsearch-ssl-config",
145-
":libs:elasticsearch-x-content",
146-
":modules:analysis-common",
147-
":modules:ingest-common",
148-
":modules:ingest-geoip",
149-
":modules:ingest-geoip:qa:file-based-update",
150-
":modules:ingest-user-agent",
151-
":modules:lang-expression",
152-
":modules:lang-mustache",
153-
":modules:lang-painless",
154-
":modules:lang-painless:spi",
155-
":modules:mapper-extras",
156-
":modules:parent-join",
157-
":modules:percolator",
158-
":modules:rank-eval",
159-
":modules:reindex",
160-
":modules:repository-url",
161-
":modules:systemd",
162-
":modules:tasks",
163-
":modules:transport-netty4",
164-
":plugins:analysis-icu",
165-
":plugins:analysis-kuromoji",
166-
":plugins:analysis-nori",
167-
":plugins:analysis-phonetic",
168-
":plugins:analysis-smartcn",
169-
":plugins:analysis-stempel",
170-
":plugins:analysis-ukrainian",
171-
":plugins:discovery-azure-classic",
172-
":plugins:discovery-ec2",
173-
":plugins:discovery-ec2:qa:amazon-ec2",
174-
":plugins:discovery-gce",
175-
":plugins:discovery-gce:qa:gce",
176-
":plugins:ingest-attachment",
177-
":plugins:mapper-annotated-text",
178-
":plugins:mapper-murmur3",
179-
":plugins:mapper-size",
180-
":plugins:repository-azure",
181-
":plugins:repository-gcs",
182-
":plugins:repository-hdfs",
183-
":plugins:repository-hdfs:hadoop-common",
184-
":plugins:repository-s3",
185-
":plugins:store-smb",
186-
":plugins:transport-nio",
187-
":qa:ccs-rolling-upgrade-remote-cluster",
188-
":qa:ccs-unavailable-clusters",
189-
":qa:die-with-dignity",
190-
":qa:evil-tests",
191-
":qa:full-cluster-restart",
192-
":qa:logging-config",
193-
":qa:mixed-cluster",
194-
":qa:multi-cluster-search",
195-
":qa:no-bootstrap-tests",
196-
":qa:remote-clusters",
197-
":qa:repository-multi-version",
198-
":qa:rolling-upgrade",
199-
":qa:smoke-test-http",
200-
":qa:smoke-test-ingest-with-all-dependencies",
201-
":qa:smoke-test-multinode",
202-
":qa:smoke-test-plugins",
203-
":qa:snapshot-based-recoveries",
204-
":qa:snapshot-based-recoveries:azure",
205-
":qa:snapshot-based-recoveries:fs",
206-
":qa:snapshot-based-recoveries:gcs",
207-
":qa:snapshot-based-recoveries:s3",
208-
":qa:verify-version-constants",
209-
":rest-api-spec",
210-
":test:fixtures:geoip-fixture",
211-
":test:fixtures:krb5kdc-fixture",
212-
":test:fixtures:old-elasticsearch",
213-
":test:logger-usage",
214-
":x-pack:docs",
215-
":x-pack:license-tools",
216-
":x-pack:plugin",
217-
":x-pack:plugin:async-search",
218-
":x-pack:plugin:async-search:qa",
219-
":x-pack:plugin:async-search:qa:security",
220-
":x-pack:plugin:autoscaling:qa:rest",
221-
":x-pack:plugin:ccr",
222-
":x-pack:plugin:ccr:qa",
223-
":x-pack:plugin:ccr:qa:downgrade-to-basic-license",
224-
":x-pack:plugin:ccr:qa:multi-cluster",
225-
":x-pack:plugin:ccr:qa:non-compliant-license",
226-
":x-pack:plugin:ccr:qa:rest",
227-
":x-pack:plugin:ccr:qa:restart",
228-
":x-pack:plugin:ccr:qa:security",
229-
":x-pack:plugin:core",
230-
":x-pack:plugin:data-streams:qa:multi-node",
231-
":x-pack:plugin:data-streams:qa:rest",
232-
":x-pack:plugin:deprecation",
233-
":x-pack:plugin:enrich:qa:common",
234-
":x-pack:plugin:enrich:qa:rest",
235-
":x-pack:plugin:enrich:qa:rest-with-advanced-security",
236-
":x-pack:plugin:enrich:qa:rest-with-security",
237-
":x-pack:plugin:eql",
238-
":x-pack:plugin:eql:qa",
239-
":x-pack:plugin:eql:qa:common",
240-
":x-pack:plugin:eql:qa:mixed-node",
241-
":x-pack:plugin:eql:qa:multi-cluster-with-security",
242-
":x-pack:plugin:eql:qa:rest",
243-
":x-pack:plugin:eql:qa:security",
244-
":x-pack:plugin:fleet:qa:rest",
245-
":x-pack:plugin:graph",
246-
":x-pack:plugin:graph:qa:with-security",
247-
":x-pack:plugin:identity-provider",
248-
":x-pack:plugin:identity-provider:qa:idp-rest-tests",
249-
":x-pack:plugin:ilm",
250-
":x-pack:plugin:ilm:qa:multi-cluster",
251-
":x-pack:plugin:ilm:qa:multi-node",
252-
":x-pack:plugin:ilm:qa:rest",
253-
":x-pack:plugin:ilm:qa:with-security",
254-
":x-pack:plugin:mapper-constant-keyword",
255-
":x-pack:plugin:mapper-flattened",
256-
":x-pack:plugin:ml",
257-
":x-pack:plugin:ml:qa:basic-multi-node",
258-
":x-pack:plugin:ml:qa:disabled",
259-
":x-pack:plugin:ml:qa:ml-with-security",
260-
":x-pack:plugin:ml:qa:native-multi-node-tests",
261-
":x-pack:plugin:ml:qa:no-bootstrap-tests",
262-
":x-pack:plugin:ml:qa:single-node-tests",
263-
":x-pack:plugin:monitoring",
264-
":x-pack:plugin:ql",
265-
":x-pack:plugin:repository-encrypted:qa:azure",
266-
":x-pack:plugin:repository-encrypted:qa:gcs",
267-
":x-pack:plugin:repository-encrypted:qa:s3",
268-
":x-pack:plugin:rollup:qa:rest",
269-
":x-pack:plugin:search-business-rules",
270-
":x-pack:plugin:searchable-snapshots:qa:rest",
271-
":x-pack:plugin:security",
272-
":x-pack:plugin:security:cli",
273-
":x-pack:plugin:security:qa:basic-enable-security",
274-
":x-pack:plugin:security:qa:security-basic",
275-
":x-pack:plugin:security:qa:security-disabled",
276-
":x-pack:plugin:security:qa:security-not-enabled",
277-
":x-pack:plugin:security:qa:security-trial",
278-
":x-pack:plugin:security:qa:service-account",
279-
":x-pack:plugin:security:qa:smoke-test-all-realms",
280-
":x-pack:plugin:security:qa:tls-basic",
281-
":x-pack:plugin:shutdown:qa:multi-node",
282-
":x-pack:plugin:snapshot-repo-test-kit:qa:rest",
283-
":x-pack:plugin:spatial",
284-
":x-pack:plugin:sql",
285-
":x-pack:plugin:sql:jdbc",
286-
":x-pack:plugin:sql:qa",
287-
":x-pack:plugin:sql:qa:jdbc",
288-
":x-pack:plugin:sql:qa:jdbc:security",
289-
":x-pack:plugin:sql:qa:mixed-node",
290-
":x-pack:plugin:sql:qa:security",
291-
":x-pack:plugin:sql:qa:server:multi-node",
292-
":x-pack:plugin:sql:qa:server:single-node",
293-
":x-pack:plugin:sql:sql-action",
294-
":x-pack:plugin:sql:sql-cli",
295-
":x-pack:plugin:sql:sql-client",
296-
":x-pack:plugin:sql:sql-proto",
297-
":x-pack:plugin:stack:qa:rest",
298-
":x-pack:plugin:text-structure:qa:text-structure-with-security",
299-
":x-pack:plugin:transform",
300-
":x-pack:plugin:transform:qa:multi-cluster-tests-with-security",
301-
":x-pack:plugin:transform:qa:multi-node-tests",
302-
":x-pack:plugin:transform:qa:single-node-tests",
303-
":x-pack:plugin:vector-tile:qa:multi-cluster",
304-
":x-pack:plugin:vectors",
305-
":x-pack:plugin:watcher",
306-
":x-pack:plugin:watcher:qa:rest",
307-
":x-pack:plugin:watcher:qa:with-monitoring",
308-
":x-pack:plugin:watcher:qa:with-security",
309-
":x-pack:plugin:wildcard",
310-
":x-pack:qa",
311-
":x-pack:qa:core-rest-tests-with-security",
312-
":x-pack:qa:evil-tests",
313-
":x-pack:qa:full-cluster-restart",
314-
":x-pack:qa:kerberos-tests",
315-
":x-pack:qa:mixed-tier-cluster",
316-
":x-pack:qa:multi-cluster-search-security",
317-
":x-pack:qa:multi-node",
318-
":x-pack:qa:oidc-op-tests",
319-
":x-pack:qa:openldap-tests",
320-
":x-pack:qa:password-protected-keystore",
321-
":x-pack:qa:reindex-tests-with-security",
322-
":x-pack:qa:rolling-upgrade",
323-
":x-pack:qa:rolling-upgrade-multi-cluster",
324-
":x-pack:qa:runtime-fields:core-with-mapped",
325-
":x-pack:qa:runtime-fields:core-with-search",
326-
":x-pack:qa:runtime-fields:with-security",
327-
":x-pack:qa:saml-idp-tests",
328-
":x-pack:qa:security-example-spi-extension",
329-
":x-pack:qa:security-setup-password-tests",
330-
":x-pack:qa:security-tools-tests",
331-
":x-pack:qa:smoke-test-plugins",
332-
":x-pack:qa:smoke-test-plugins-ssl",
333-
":x-pack:qa:smoke-test-security-with-mustache",
334-
":x-pack:qa:third-party:active-directory",
335-
":x-pack:qa:third-party:jira",
336-
":x-pack:qa:third-party:pagerduty",
337-
":x-pack:qa:third-party:slack",
338-
":x-pack:test:idp-fixture",
339-
":x-pack:test:smb-fixture"
91+
":distribution:bwc:staged"
34092
);
34193
}

client/benchmark/src/main/java/org/elasticsearch/client/benchmark/AbstractBenchmark.java

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ public final void run(String[] args) throws Exception {
5353
@SuppressForbidden(reason = "system out is ok for a command line tool")
5454
private void runBulkIndexBenchmark(String[] args) throws Exception {
5555
if (args.length != 7) {
56-
System.err.println(
57-
"usage: 'bulk' benchmarkTargetHostIp indexFilePath indexName typeName numberOfDocuments bulkSize");
56+
System.err.println("usage: 'bulk' benchmarkTargetHostIp indexFilePath indexName typeName numberOfDocuments bulkSize");
5857
System.exit(1);
5958
}
6059
String benchmarkTargetHost = args[1];
@@ -71,9 +70,11 @@ private void runBulkIndexBenchmark(String[] args) throws Exception {
7170

7271
T client = client(benchmarkTargetHost);
7372

74-
BenchmarkRunner benchmark = new BenchmarkRunner(warmupIterations, iterations,
75-
new BulkBenchmarkTask(
76-
bulkRequestExecutor(client, indexName, typeName), indexFilePath, warmupIterations, iterations, bulkSize));
73+
BenchmarkRunner benchmark = new BenchmarkRunner(
74+
warmupIterations,
75+
iterations,
76+
new BulkBenchmarkTask(bulkRequestExecutor(client, indexName, typeName), indexFilePath, warmupIterations, iterations, bulkSize)
77+
);
7778

7879
try {
7980
runTrials(() -> {
@@ -89,8 +90,7 @@ private void runBulkIndexBenchmark(String[] args) throws Exception {
8990
@SuppressForbidden(reason = "system out is ok for a command line tool")
9091
private void runSearchBenchmark(String[] args) throws Exception {
9192
if (args.length != 5) {
92-
System.err.println(
93-
"usage: 'search' benchmarkTargetHostIp indexName searchRequestBody throughputRates");
93+
System.err.println("usage: 'search' benchmarkTargetHostIp indexName searchRequestBody throughputRates");
9494
System.exit(1);
9595
}
9696
String benchmarkTargetHost = args[1];
@@ -103,12 +103,19 @@ private void runSearchBenchmark(String[] args) throws Exception {
103103
try {
104104
runTrials(() -> {
105105
for (int throughput : throughputRates) {
106-
//GC between trials to reduce the likelihood of a GC occurring in the middle of a trial.
106+
// GC between trials to reduce the likelihood of a GC occurring in the middle of a trial.
107107
runGc();
108-
BenchmarkRunner benchmark = new BenchmarkRunner(SEARCH_BENCHMARK_ITERATIONS, SEARCH_BENCHMARK_ITERATIONS,
108+
BenchmarkRunner benchmark = new BenchmarkRunner(
109+
SEARCH_BENCHMARK_ITERATIONS,
110+
SEARCH_BENCHMARK_ITERATIONS,
109111
new SearchBenchmarkTask(
110-
searchRequestExecutor(client, indexName), searchBody, SEARCH_BENCHMARK_ITERATIONS,
111-
SEARCH_BENCHMARK_ITERATIONS, throughput));
112+
searchRequestExecutor(client, indexName),
113+
searchBody,
114+
SEARCH_BENCHMARK_ITERATIONS,
115+
SEARCH_BENCHMARK_ITERATIONS,
116+
throughput
117+
)
118+
);
112119
System.out.printf("Target throughput = %d ops / s%n", throughput);
113120
benchmark.run();
114121
}

client/benchmark/src/main/java/org/elasticsearch/client/benchmark/BenchmarkRunner.java

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ public BenchmarkRunner(int warmupIterations, int iterations, BenchmarkTask task)
3131
@SuppressForbidden(reason = "system out is ok for a command line tool")
3232
public void run() {
3333
SampleRecorder recorder = new SampleRecorder(iterations);
34-
System.out.printf("Running %s with %d warmup iterations and %d iterations.%n",
35-
task.getClass().getSimpleName(), warmupIterations, iterations);
34+
System.out.printf(
35+
"Running %s with %d warmup iterations and %d iterations.%n",
36+
task.getClass().getSimpleName(),
37+
warmupIterations,
38+
iterations
39+
);
3640

3741
try {
3842
task.setUp(recorder);
@@ -54,14 +58,26 @@ public void run() {
5458

5559
for (Metrics metrics : summaryMetrics) {
5660
String throughput = String.format(Locale.ROOT, "Throughput [ops/s]: %f", metrics.throughput);
57-
String serviceTimes = String.format(Locale.ROOT,
61+
String serviceTimes = String.format(
62+
Locale.ROOT,
5863
"Service time [ms]: p50 = %f, p90 = %f, p95 = %f, p99 = %f, p99.9 = %f, p99.99 = %f",
59-
metrics.serviceTimeP50, metrics.serviceTimeP90, metrics.serviceTimeP95,
60-
metrics.serviceTimeP99, metrics.serviceTimeP999, metrics.serviceTimeP9999);
61-
String latencies = String.format(Locale.ROOT,
64+
metrics.serviceTimeP50,
65+
metrics.serviceTimeP90,
66+
metrics.serviceTimeP95,
67+
metrics.serviceTimeP99,
68+
metrics.serviceTimeP999,
69+
metrics.serviceTimeP9999
70+
);
71+
String latencies = String.format(
72+
Locale.ROOT,
6273
"Latency [ms]: p50 = %f, p90 = %f, p95 = %f, p99 = %f, p99.9 = %f, p99.99 = %f",
63-
metrics.latencyP50, metrics.latencyP90, metrics.latencyP95,
64-
metrics.latencyP99, metrics.latencyP999, metrics.latencyP9999);
74+
metrics.latencyP50,
75+
metrics.latencyP90,
76+
metrics.latencyP95,
77+
metrics.latencyP99,
78+
metrics.latencyP999,
79+
metrics.latencyP9999
80+
);
6581

6682
int lineLength = Math.max(serviceTimes.length(), latencies.length());
6783

0 commit comments

Comments
 (0)