Skip to content

Commit 554537e

Browse files
author
Andrey Ershov
committed
Merge branch 'zen2' into zen2_storage_fix
2 parents 0d8b842 + 93bb24e commit 554537e

File tree

1,887 files changed

+50293
-20482
lines changed

Some content is hidden

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

1,887 files changed

+50293
-20482
lines changed

.ci/java-versions.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
# build and test Elasticsearch for this branch. Valid Java versions
55
# are 'java' or 'openjdk' followed by the major release number.
66

7-
ES_BUILD_JAVA=java10
7+
ES_BUILD_JAVA=java11
88
ES_RUNTIME_JAVA=java8
9+
GRADLE_TASK=build
10+

.ci/matrix-build-javas.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
# or 'openjdk' followed by the major release number.
77

88
ES_BUILD_JAVA:
9-
- java10
109
- java11

.ci/matrix-runtime-javas.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@
88
ES_RUNTIME_JAVA:
99
- java8
1010
- java8fips
11-
- java10
1211
- java11

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Please follow these formatting guidelines:
161161
* Line width is 140 characters
162162
* The rest is left to Java coding standards
163163
* Disable “auto-format on save” to prevent unnecessary format changes. This makes reviews much harder as it generates unnecessary formatting changes. If your IDE supports formatting only modified chunks that is fine to do.
164-
* Wildcard imports (`import foo.bar.baz.*`) are forbidden and will cause the build to fail. Please attempt to tame your IDE so it doesn't make them and please send a PR against this document with instructions for your IDE if it doesn't contain them.
164+
* Wildcard imports (`import foo.bar.baz.*`) are forbidden and will cause the build to fail. This can be done automatically by your IDE:
165165
* Eclipse: `Preferences->Java->Code Style->Organize Imports`. There are two boxes labeled "`Number of (static )? imports needed for .*`". Set their values to 99999 or some other absurdly high value.
166166
* IntelliJ: `Preferences/Settings->Editor->Code Style->Java->Imports`. There are two configuration options: `Class count to use import with '*'` and `Names count to use static import with '*'`. Set their values to 99999 or some other absurdly high value.
167167
* Don't worry too much about import order. Try not to change it but don't worry about fighting your IDE to stop it from doing so.
@@ -320,7 +320,7 @@ have to test Elasticsearch.
320320
#### Configurations
321321

322322
Gradle organizes dependencies and build artifacts into "configurations" and
323-
allows you to use these configurations arbitrarilly. Here are some of the most
323+
allows you to use these configurations arbitrarily. Here are some of the most
324324
common configurations in our build and how we use them:
325325

326326
<dl>

TESTING.asciidoc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[[Testing Framework Cheatsheet]]
1+
[[TestingFrameworkCheatsheet]]
22
= Testing
33

44
[partintro]
@@ -250,7 +250,7 @@ Pass arbitrary jvm arguments.
250250

251251
Running backwards compatibility tests is disabled by default since it
252252
requires a release version of elasticsearch to be present on the test system.
253-
To run backwards compatibilty tests untar or unzip a release and run the tests
253+
To run backwards compatibility tests untar or unzip a release and run the tests
254254
with the following command:
255255

256256
---------------------------------------------------------------------------
@@ -350,26 +350,26 @@ and running elasticsearch distributions works correctly on supported operating s
350350
These tests should really only be run in vagrant vms because they're destructive.
351351

352352
. Install Virtual Box and Vagrant.
353-
353+
+
354354
. (Optional) Install https://github.com/fgrehm/vagrant-cachier[vagrant-cachier] to squeeze
355355
a bit more performance out of the process:
356-
356+
+
357357
--------------------------------------
358358
vagrant plugin install vagrant-cachier
359359
--------------------------------------
360-
360+
+
361361
. Validate your installed dependencies:
362-
362+
+
363363
-------------------------------------
364364
./gradlew :qa:vagrant:vagrantCheckVersion
365365
-------------------------------------
366-
366+
+
367367
. Download and smoke test the VMs with `./gradlew vagrantSmokeTest` or
368368
`./gradlew -Pvagrant.boxes=all vagrantSmokeTest`. The first time you run this it will
369369
download the base images and provision the boxes and immediately quit. Downloading all
370370
the images may take a long time. After the images are already on your machine, they won't
371371
be downloaded again unless they have been updated to a new version.
372-
372+
+
373373
. Run the tests with `./gradlew packagingTest`. This will cause Gradle to build
374374
the tar, zip, and deb packages and all the plugins. It will then run the tests
375375
on ubuntu-1404 and centos-7. We chose those two distributions as the default
@@ -402,6 +402,7 @@ These are the linux flavors supported, all of which we provide images for
402402

403403
* ubuntu-1404 aka trusty
404404
* ubuntu-1604 aka xenial
405+
* ubuntu-1804 aka bionic beaver
405406
* debian-8 aka jessie
406407
* debian-9 aka stretch, the current debian stable distribution
407408
* centos-6

Vagrantfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ Vagrant.configure(2) do |config|
6161
SHELL
6262
end
6363
end
64+
'ubuntu-1804'.tap do |box|
65+
config.vm.define box, define_opts do |config|
66+
config.vm.box = 'elastic/ubuntu-18.04-x86_64'
67+
deb_common config, box, extra: <<-SHELL
68+
# Install Jayatana so we can work around it being present.
69+
[ -f /usr/share/java/jayatanaag.jar ] || install jayatana
70+
SHELL
71+
end
72+
end
6473
# Wheezy's backports don't contain Openjdk 8 and the backflips
6574
# required to get the sun jdk on there just aren't worth it. We have
6675
# jessie and stretch for testing debian and it works fine.

benchmarks/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-u
4444
// needs to be added separately otherwise Gradle will quote it and javac will fail
4545
compileJava.options.compilerArgs.addAll(["-processor", "org.openjdk.jmh.generators.BenchmarkProcessor"])
4646

47+
run.executable = new File(project.runtimeJavaHome, 'bin/java')
48+
4749
// classes generated by JMH can use all sorts of forbidden APIs but we have no influence at all and cannot exclude these classes
4850
forbiddenApisMain.enabled = false
4951

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.elasticsearch.benchmark.fs;
20+
21+
import org.elasticsearch.common.logging.LogConfigurator;
22+
import org.elasticsearch.common.settings.Settings;
23+
import org.elasticsearch.env.Environment;
24+
import org.elasticsearch.env.NodeEnvironment;
25+
import org.openjdk.jmh.annotations.Benchmark;
26+
import org.openjdk.jmh.annotations.BenchmarkMode;
27+
import org.openjdk.jmh.annotations.Fork;
28+
import org.openjdk.jmh.annotations.Measurement;
29+
import org.openjdk.jmh.annotations.Mode;
30+
import org.openjdk.jmh.annotations.OutputTimeUnit;
31+
import org.openjdk.jmh.annotations.Scope;
32+
import org.openjdk.jmh.annotations.Setup;
33+
import org.openjdk.jmh.annotations.State;
34+
import org.openjdk.jmh.annotations.Warmup;
35+
36+
import java.io.IOException;
37+
import java.nio.file.Files;
38+
import java.nio.file.Path;
39+
import java.util.HashSet;
40+
import java.util.Set;
41+
import java.util.concurrent.TimeUnit;
42+
43+
@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
44+
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
45+
@Fork(3)
46+
@BenchmarkMode(Mode.AverageTime)
47+
@OutputTimeUnit(TimeUnit.NANOSECONDS)
48+
@State(Scope.Benchmark)
49+
public class AvailableIndexFoldersBenchmark {
50+
51+
private NodeEnvironment.NodePath nodePath;
52+
private NodeEnvironment nodeEnv;
53+
private Set<String> excludedDirs;
54+
55+
@Setup
56+
public void setup() throws IOException {
57+
Path path = Files.createTempDirectory("test");
58+
String[] paths = new String[] {path.toString()};
59+
nodePath = new NodeEnvironment.NodePath(path);
60+
61+
LogConfigurator.setNodeName("test");
62+
Settings settings = Settings.builder()
63+
.put(Environment.PATH_HOME_SETTING.getKey(), path)
64+
.putList(Environment.PATH_DATA_SETTING.getKey(), paths).build();
65+
nodeEnv = new NodeEnvironment(settings, new Environment(settings, null));
66+
67+
Files.createDirectories(nodePath.indicesPath);
68+
excludedDirs = new HashSet<>();
69+
int numIndices = 5000;
70+
for (int i = 0; i < numIndices; i++) {
71+
String dirName = "dir" + i;
72+
Files.createDirectory(nodePath.indicesPath.resolve(dirName));
73+
excludedDirs.add(dirName);
74+
}
75+
if (nodeEnv.availableIndexFoldersForPath(nodePath).size() != numIndices) {
76+
throw new IllegalStateException("bad size");
77+
}
78+
if (nodeEnv.availableIndexFoldersForPath(nodePath, excludedDirs::contains).size() != 0) {
79+
throw new IllegalStateException("bad size");
80+
}
81+
}
82+
83+
84+
@Benchmark
85+
public Set<String> availableIndexFolderNaive() throws IOException {
86+
return nodeEnv.availableIndexFoldersForPath(nodePath);
87+
}
88+
89+
@Benchmark
90+
public Set<String> availableIndexFolderOptimized() throws IOException {
91+
return nodeEnv.availableIndexFoldersForPath(nodePath, excludedDirs::contains);
92+
}
93+
94+
}

buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,11 @@ class RandomizedTestingTask extends DefaultTask {
264264
throw new InvalidUserDataException('Seed should be ' +
265265
'set on the project instead of a system property')
266266
}
267-
sysproperty key: prop.getKey(), value: prop.getValue().toString()
267+
if (prop.getValue() instanceof Closure) {
268+
sysproperty key: prop.getKey(), value: (prop.getValue() as Closure).call().toString()
269+
} else {
270+
sysproperty key: prop.getKey(), value: prop.getValue().toString()
271+
}
268272
}
269273
systemProperty 'tests.seed', project.testSeed
270274
for (Map.Entry<String, Object> envvar : environmentVariables) {

buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionCollection.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class VersionCollection {
122122
if (isReleased(version) == false) {
123123
// caveat 1 - This should only ever contain 2 non released branches in flight. An example is 6.x is frozen,
124124
// and 6.2 is cut but not yet released there is some simple logic to make sure that in the case of more than 2,
125-
// it will bail. The order is that the minor snapshot is fufilled first, and then the staged minor snapshot
125+
// it will bail. The order is that the minor snapshot is fulfilled first, and then the staged minor snapshot
126126
if (nextMinorSnapshot == null) {
127127
// it has not been set yet
128128
nextMinorSnapshot = replaceAsSnapshot(version)

0 commit comments

Comments
 (0)