Skip to content

Commit 248ac24

Browse files
committed
Merge branch 'master' into cleanup/transport_bulk
2 parents 14908f8 + 80bae21 commit 248ac24

File tree

1,979 files changed

+43036
-41054
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,979 files changed

+43036
-41054
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ nbactions.xml
2020
.gradle/
2121
build/
2222

23+
# gradle wrapper
24+
/gradle/
25+
gradlew
26+
gradlew.bat
27+
2328
# maven stuff (to be removed when trunk becomes 4.x)
2429
*-execution-hints.log
2530
target/

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ Please follow these formatting guidelines:
120120
* The rest is left to Java coding standards
121121
* 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.
122122
* 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.
123-
* 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.
123+
* 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.
124+
* IntelliJ: `Preferences->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.
124125
* 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.
125126

126127
To create a distribution from the source, simply run:

GRADLE.CHEATSHEET

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ test -> test
44
verify -> check
55
verify -Dskip.unit.tests -> integTest
66
package -DskipTests -> assemble
7-
install -DskipTests -> install
7+
install -DskipTests -> publishToMavenLocal

TESTING.asciidoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,12 @@ These are the linux flavors the Vagrantfile currently supports:
364364
* ubuntu-1204 aka precise
365365
* ubuntu-1404 aka trusty
366366
* ubuntu-1504 aka vivid
367+
* ubuntu-1604 aka xenial
367368
* debian-8 aka jessie, the current debian stable distribution
368369
* centos-6
369370
* centos-7
370-
* fedora-22
371+
* fedora-24
372+
* oel-6 aka Oracle Enterprise Linux 6
371373
* oel-7 aka Oracle Enterprise Linux 7
372374
* sles-12
373375
* opensuse-13
@@ -376,7 +378,6 @@ We're missing the following from the support matrix because there aren't high
376378
quality boxes available in vagrant atlas:
377379

378380
* sles-11
379-
* oel-6
380381

381382
We're missing the follow because our tests are very linux/bash centric:
382383

Vagrantfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ Vagrant.configure(2) do |config|
3737
[ -f /usr/share/java/jayatanaag.jar ] || install jayatana
3838
SHELL
3939
end
40+
config.vm.define "ubuntu-1604" do |config|
41+
config.vm.box = "elastic/ubuntu-16.04-x86_64"
42+
ubuntu_common config, extra: <<-SHELL
43+
# Install Jayatana so we can work around it being present.
44+
[ -f /usr/share/java/jayatanaag.jar ] || install jayatana
45+
SHELL
46+
end
4047
# Wheezy's backports don't contain Openjdk 8 and the backflips required to
4148
# get the sun jdk on there just aren't worth it. We have jessie for testing
4249
# debian and it works fine.
@@ -78,8 +85,8 @@ Vagrant.configure(2) do |config|
7885
config.vm.synced_folder ".", "/vagrant", disabled: true
7986
config.vm.synced_folder ".", "/elasticsearch"
8087
config.vm.provider "virtualbox" do |v|
81-
# Give the boxes 2GB so they can run our tests if they have to.
82-
v.memory = 2048
88+
# Give the boxes 3GB because Elasticsearch defaults to using 2GB
89+
v.memory = 3072
8390
end
8491
if Vagrant.has_plugin?("vagrant-cachier")
8592
config.cache.scope = :box

benchmarks/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ dependencies {
5757
}
5858

5959
compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
60+
// enable the JMH's BenchmarkProcessor to generate the final benchmark classes
61+
// needs to be added separately otherwise Gradle will quote it and javac will fail
62+
compileJava.options.compilerArgs.addAll(["-processor", "org.openjdk.jmh.generators.BenchmarkProcessor"])
6063
compileTestJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
6164

6265
forbiddenApis {

benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/AllocationBenchmark.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.elasticsearch.cluster.routing.RoutingTable;
2828
import org.elasticsearch.cluster.routing.ShardRoutingState;
2929
import org.elasticsearch.cluster.routing.allocation.AllocationService;
30-
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
3130
import org.elasticsearch.common.settings.Settings;
3231
import org.openjdk.jmh.annotations.Benchmark;
3332
import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -160,11 +159,9 @@ private int toInt(String v) {
160159
public ClusterState measureAllocation() {
161160
ClusterState clusterState = initialClusterState;
162161
while (clusterState.getRoutingNodes().hasUnassignedShards()) {
163-
RoutingAllocation.Result result = strategy.applyStartedShards(clusterState, clusterState.getRoutingNodes()
162+
clusterState = strategy.applyStartedShards(clusterState, clusterState.getRoutingNodes()
164163
.shardsWithState(ShardRoutingState.INITIALIZING));
165-
clusterState = ClusterState.builder(clusterState).routingResult(result).build();
166-
result = strategy.reroute(clusterState, "reroute");
167-
clusterState = ClusterState.builder(clusterState).routingResult(result).build();
164+
clusterState = strategy.reroute(clusterState, "reroute");
168165
}
169166
return clusterState;
170167
}

benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/Allocators.java

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
import org.elasticsearch.cluster.ClusterModule;
2323
import org.elasticsearch.cluster.EmptyClusterInfoService;
2424
import org.elasticsearch.cluster.node.DiscoveryNode;
25+
import org.elasticsearch.cluster.routing.ShardRouting;
2526
import org.elasticsearch.cluster.routing.allocation.AllocationService;
26-
import org.elasticsearch.cluster.routing.allocation.FailedRerouteAllocation;
27+
import org.elasticsearch.cluster.routing.allocation.FailedShard;
2728
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
28-
import org.elasticsearch.cluster.routing.allocation.StartedRerouteAllocation;
2929
import org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator;
3030
import org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider;
3131
import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders;
@@ -35,9 +35,9 @@
3535
import org.elasticsearch.common.util.set.Sets;
3636
import org.elasticsearch.gateway.GatewayAllocator;
3737

38-
import java.lang.reflect.Constructor;
3938
import java.lang.reflect.InvocationTargetException;
40-
import java.util.ArrayList;
39+
import java.util.Collection;
40+
import java.util.Collections;
4141
import java.util.List;
4242
import java.util.Map;
4343

@@ -50,12 +50,12 @@ protected NoopGatewayAllocator() {
5050
}
5151

5252
@Override
53-
public void applyStartedShards(StartedRerouteAllocation allocation) {
53+
public void applyStartedShards(RoutingAllocation allocation, List<ShardRouting> startedShards) {
5454
// noop
5555
}
5656

5757
@Override
58-
public void applyFailedShards(FailedRerouteAllocation allocation) {
58+
public void applyFailedShards(RoutingAllocation allocation, List<FailedShard> failedShards) {
5959
// noop
6060
}
6161

@@ -72,7 +72,7 @@ private Allocators() {
7272

7373
public static AllocationService createAllocationService(Settings settings) throws NoSuchMethodException, InstantiationException,
7474
IllegalAccessException, InvocationTargetException {
75-
return createAllocationService(settings, new ClusterSettings(Settings.Builder.EMPTY_SETTINGS, ClusterSettings
75+
return createAllocationService(settings, new ClusterSettings(Settings.EMPTY, ClusterSettings
7676
.BUILT_IN_CLUSTER_SETTINGS));
7777
}
7878

@@ -85,19 +85,9 @@ public static AllocationService createAllocationService(Settings settings, Clust
8585

8686
public static AllocationDeciders defaultAllocationDeciders(Settings settings, ClusterSettings clusterSettings) throws
8787
IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException {
88-
List<AllocationDecider> list = new ArrayList<>();
89-
// Keep a deterministic order of allocation deciders for the benchmark
90-
for (Class<? extends AllocationDecider> deciderClass : ClusterModule.DEFAULT_ALLOCATION_DECIDERS) {
91-
try {
92-
Constructor<? extends AllocationDecider> constructor = deciderClass.getConstructor(Settings.class, ClusterSettings
93-
.class);
94-
list.add(constructor.newInstance(settings, clusterSettings));
95-
} catch (NoSuchMethodException e) {
96-
Constructor<? extends AllocationDecider> constructor = deciderClass.getConstructor(Settings.class);
97-
list.add(constructor.newInstance(settings));
98-
}
99-
}
100-
return new AllocationDeciders(settings, list.toArray(new AllocationDecider[0]));
88+
Collection<AllocationDecider> deciders =
89+
ClusterModule.createAllocationDeciders(settings, clusterSettings, Collections.emptyList());
90+
return new AllocationDeciders(settings, deciders);
10191

10292
}
10393

benchmarks/src/main/resources/log4j.properties

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
appender.console.type = Console
2+
appender.console.name = console
3+
appender.console.layout.type = PatternLayout
4+
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%m%n
5+
6+
# Do not log at all if it is not really critical - we're in a benchmark
7+
rootLogger.level = error
8+
rootLogger.appenderRef.console.ref = console

0 commit comments

Comments
 (0)