mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 02:14:54 +00:00
parent
7257345db9
commit
65b9a94baa
@ -437,7 +437,7 @@ def smoke_test_release(release, files, expected_hash, plugins):
|
|||||||
else:
|
else:
|
||||||
background = '-d'
|
background = '-d'
|
||||||
print(' Starting elasticsearch deamon from [%s]' % os.path.join(tmp_dir, 'elasticsearch-%s' % release))
|
print(' Starting elasticsearch deamon from [%s]' % os.path.join(tmp_dir, 'elasticsearch-%s' % release))
|
||||||
run('%s; %s -Des.node.name=smoke_tester -Des.cluster.name=prepare_release -Des.discovery.zen.ping.multicast.enabled=false -Des.node.bench=true -Des.script.disable_dynamic=false %s'
|
run('%s; %s -Des.node.name=smoke_tester -Des.cluster.name=prepare_release -Des.discovery.zen.ping.multicast.enabled=false -Des.script.disable_dynamic=false %s'
|
||||||
% (java_exe(), es_run_path, background))
|
% (java_exe(), es_run_path, background))
|
||||||
conn = HTTPConnection('127.0.0.1', 9200, 20);
|
conn = HTTPConnection('127.0.0.1', 9200, 20);
|
||||||
wait_for_node_startup()
|
wait_for_node_startup()
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
/*
|
|
||||||
* Licensed to Elasticsearch under one or more contributor
|
|
||||||
* license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright
|
|
||||||
* ownership. Elasticsearch licenses this file to you under
|
|
||||||
* the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
* not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
package org.elasticsearch.cluster.metadata;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import org.elasticsearch.ElasticsearchIllegalArgumentException;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
|
||||||
import org.elasticsearch.common.xcontent.ToXContent;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Meta data about benchmarks that are currently executing
|
|
||||||
*/
|
|
||||||
public class BenchmarkMetaData implements MetaData.Custom {
|
|
||||||
public static final String TYPE = "benchmark";
|
|
||||||
|
|
||||||
public static final Factory FACTORY = new Factory();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
|
|
||||||
BenchmarkMetaData that = (BenchmarkMetaData) o;
|
|
||||||
|
|
||||||
if (!entries.equals(that.entries)) return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return entries.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Entry {
|
|
||||||
private final State state;
|
|
||||||
private final String benchmarkId;
|
|
||||||
private final String[] nodeids;
|
|
||||||
|
|
||||||
public Entry(Entry e, State state) {
|
|
||||||
this(e.benchmarkId(), state, e.nodes());
|
|
||||||
}
|
|
||||||
|
|
||||||
public Entry(String benchmarkId, State state, String[] nodeIds) {
|
|
||||||
this.state = state;
|
|
||||||
this.benchmarkId = benchmarkId;
|
|
||||||
this.nodeids = nodeIds;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String benchmarkId() {
|
|
||||||
return this.benchmarkId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public State state() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] nodes() {
|
|
||||||
return nodeids;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
|
|
||||||
Entry entry = (Entry) o;
|
|
||||||
|
|
||||||
if (!benchmarkId.equals(entry.benchmarkId)) return false;
|
|
||||||
if (state != entry.state) return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int result = state.hashCode();
|
|
||||||
result = 31 * result + benchmarkId.hashCode();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static enum State {
|
|
||||||
STARTED((byte) 0),
|
|
||||||
SUCCESS((byte) 1),
|
|
||||||
FAILED((byte) 2),
|
|
||||||
ABORTED((byte) 3);
|
|
||||||
|
|
||||||
private static final State[] STATES = new State[State.values().length];
|
|
||||||
|
|
||||||
static {
|
|
||||||
for (State state : State.values()) {
|
|
||||||
assert state.id() < STATES.length && state.id() >= 0;
|
|
||||||
STATES[state.id()] = state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final byte id;
|
|
||||||
|
|
||||||
State(byte id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte id() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean completed() {
|
|
||||||
return this == SUCCESS || this == FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static State fromId(byte id) {
|
|
||||||
if (id < 0 || id >= State.values().length) {
|
|
||||||
throw new ElasticsearchIllegalArgumentException("No benchmark state for value [" + id + "]");
|
|
||||||
}
|
|
||||||
return STATES[id];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final ImmutableList<Entry> entries;
|
|
||||||
|
|
||||||
|
|
||||||
public BenchmarkMetaData(ImmutableList<Entry> entries) {
|
|
||||||
this.entries = entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BenchmarkMetaData(Entry... entries) {
|
|
||||||
this.entries = ImmutableList.copyOf(entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImmutableList<Entry> entries() {
|
|
||||||
return this.entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static class Factory extends MetaData.Custom.Factory<BenchmarkMetaData> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String type() {
|
|
||||||
return TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BenchmarkMetaData readFrom(StreamInput in) throws IOException {
|
|
||||||
Entry[] entries = new Entry[in.readVInt()];
|
|
||||||
for (int i = 0; i < entries.length; i++) {
|
|
||||||
String benchmarkId = in.readString();
|
|
||||||
State state = State.fromId(in.readByte());
|
|
||||||
String[] nodes = in.readStringArray();
|
|
||||||
entries[i] = new Entry(benchmarkId, state, nodes);
|
|
||||||
}
|
|
||||||
return new BenchmarkMetaData(entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(BenchmarkMetaData repositories, StreamOutput out) throws IOException {
|
|
||||||
out.writeVInt(repositories.entries().size());
|
|
||||||
for (Entry entry : repositories.entries()) {
|
|
||||||
out.writeString(entry.benchmarkId());
|
|
||||||
out.writeByte(entry.state().id());
|
|
||||||
out.writeStringArray(entry.nodes());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BenchmarkMetaData fromXContent(XContentParser parser) throws IOException {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void toXContent(BenchmarkMetaData customIndexMetaData, XContentBuilder builder, ToXContent.Params params) throws IOException {
|
|
||||||
builder.startArray("benchmarks");
|
|
||||||
for (Entry entry : customIndexMetaData.entries()) {
|
|
||||||
toXContent(entry, builder, params);
|
|
||||||
}
|
|
||||||
builder.endArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toXContent(Entry entry, XContentBuilder builder, ToXContent.Params params) throws IOException {
|
|
||||||
builder.startObject();
|
|
||||||
builder.field("id", entry.benchmarkId());
|
|
||||||
builder.field("state", entry.state());
|
|
||||||
builder.startArray("on_nodes");
|
|
||||||
for (String nodeid : entry.nodes()) {
|
|
||||||
builder.value(nodeid);
|
|
||||||
}
|
|
||||||
builder.endArray();
|
|
||||||
builder.endObject();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean contains(String benchmarkId) {
|
|
||||||
for (Entry e : entries) {
|
|
||||||
if (e.benchmarkId.equals(benchmarkId)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -102,7 +102,6 @@ public class MetaData implements Iterable<IndexMetaData> {
|
|||||||
registerFactory(RepositoriesMetaData.TYPE, RepositoriesMetaData.FACTORY);
|
registerFactory(RepositoriesMetaData.TYPE, RepositoriesMetaData.FACTORY);
|
||||||
registerFactory(SnapshotMetaData.TYPE, SnapshotMetaData.FACTORY);
|
registerFactory(SnapshotMetaData.TYPE, SnapshotMetaData.FACTORY);
|
||||||
registerFactory(RestoreMetaData.TYPE, RestoreMetaData.FACTORY);
|
registerFactory(RestoreMetaData.TYPE, RestoreMetaData.FACTORY);
|
||||||
registerFactory(BenchmarkMetaData.TYPE, BenchmarkMetaData.FACTORY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,7 +78,6 @@ public class ThreadPool extends AbstractComponent {
|
|||||||
public static final String WARMER = "warmer";
|
public static final String WARMER = "warmer";
|
||||||
public static final String SNAPSHOT = "snapshot";
|
public static final String SNAPSHOT = "snapshot";
|
||||||
public static final String OPTIMIZE = "optimize";
|
public static final String OPTIMIZE = "optimize";
|
||||||
public static final String BENCH = "bench";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String THREADPOOL_GROUP = "threadpool.";
|
public static final String THREADPOOL_GROUP = "threadpool.";
|
||||||
@ -126,7 +125,6 @@ public class ThreadPool extends AbstractComponent {
|
|||||||
.put(Names.WARMER, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", halfProcMaxAt5).build())
|
.put(Names.WARMER, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", halfProcMaxAt5).build())
|
||||||
.put(Names.SNAPSHOT, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", halfProcMaxAt5).build())
|
.put(Names.SNAPSHOT, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", halfProcMaxAt5).build())
|
||||||
.put(Names.OPTIMIZE, settingsBuilder().put("type", "fixed").put("size", 1).build())
|
.put(Names.OPTIMIZE, settingsBuilder().put("type", "fixed").put("size", 1).build())
|
||||||
.put(Names.BENCH, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", halfProcMaxAt5).build())
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Map<String, ExecutorHolder> executors = Maps.newHashMap();
|
Map<String, ExecutorHolder> executors = Maps.newHashMap();
|
||||||
|
@ -216,11 +216,6 @@ public class CompositeTestCluster extends TestCluster {
|
|||||||
return runningNodes().size() + cluster.numDataAndMasterNodes();
|
return runningNodes().size() + cluster.numDataAndMasterNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int numBenchNodes() {
|
|
||||||
return cluster.numBenchNodes();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InetSocketAddress[] httpAddresses() {
|
public InetSocketAddress[] httpAddresses() {
|
||||||
return cluster.httpAddresses();
|
return cluster.httpAddresses();
|
||||||
|
@ -1485,12 +1485,6 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||||||
*/
|
*/
|
||||||
int numClientNodes() default InternalTestCluster.DEFAULT_NUM_CLIENT_NODES;
|
int numClientNodes() default InternalTestCluster.DEFAULT_NUM_CLIENT_NODES;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the ability to randomly have benchmark (client) nodes as part of the cluster needs to be enabled.
|
|
||||||
* Default is {@link InternalTestCluster#DEFAULT_ENABLE_RANDOM_BENCH_NODES}.
|
|
||||||
*/
|
|
||||||
boolean enableRandomBenchNodes() default InternalTestCluster.DEFAULT_ENABLE_RANDOM_BENCH_NODES;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the transport client ratio. By default this returns <code>-1</code> which means a random
|
* Returns the transport client ratio. By default this returns <code>-1</code> which means a random
|
||||||
* ratio in the interval <code>[0..1]</code> is used.
|
* ratio in the interval <code>[0..1]</code> is used.
|
||||||
@ -1597,11 +1591,6 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||||||
return annotation == null ? InternalTestCluster.DEFAULT_NUM_CLIENT_NODES : annotation.numClientNodes();
|
return annotation == null ? InternalTestCluster.DEFAULT_NUM_CLIENT_NODES : annotation.numClientNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean enableRandomBenchNodes() {
|
|
||||||
ClusterScope annotation = getAnnotation(this.getClass());
|
|
||||||
return annotation == null ? InternalTestCluster.DEFAULT_ENABLE_RANDOM_BENCH_NODES : annotation.enableRandomBenchNodes();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean randomDynamicTemplates() {
|
private boolean randomDynamicTemplates() {
|
||||||
ClusterScope annotation = getAnnotation(this.getClass());
|
ClusterScope annotation = getAnnotation(this.getClass());
|
||||||
return annotation == null || annotation.randomDynamicTemplates();
|
return annotation == null || annotation.randomDynamicTemplates();
|
||||||
@ -1696,7 +1685,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||||||
|
|
||||||
return new InternalTestCluster(seed, minNumDataNodes, maxNumDataNodes,
|
return new InternalTestCluster(seed, minNumDataNodes, maxNumDataNodes,
|
||||||
clusterName(scope.name(), Integer.toString(CHILD_JVM_ID), seed), settingsSource, getNumClientNodes(),
|
clusterName(scope.name(), Integer.toString(CHILD_JVM_ID), seed), settingsSource, getNumClientNodes(),
|
||||||
enableRandomBenchNodes(), InternalTestCluster.DEFAULT_ENABLE_HTTP_PIPELINING, CHILD_JVM_ID, nodePrefix);
|
InternalTestCluster.DEFAULT_ENABLE_HTTP_PIPELINING, CHILD_JVM_ID, nodePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +63,6 @@ public final class ExternalTestCluster extends TestCluster {
|
|||||||
|
|
||||||
private final int numDataNodes;
|
private final int numDataNodes;
|
||||||
private final int numMasterAndDataNodes;
|
private final int numMasterAndDataNodes;
|
||||||
private final int numBenchNodes;
|
|
||||||
|
|
||||||
public ExternalTestCluster(TransportAddress... transportAddresses) {
|
public ExternalTestCluster(TransportAddress... transportAddresses) {
|
||||||
super(0);
|
super(0);
|
||||||
@ -79,7 +78,6 @@ public final class ExternalTestCluster extends TestCluster {
|
|||||||
httpAddresses = new InetSocketAddress[nodeInfos.getNodes().length];
|
httpAddresses = new InetSocketAddress[nodeInfos.getNodes().length];
|
||||||
this.clusterName = nodeInfos.getClusterName().value();
|
this.clusterName = nodeInfos.getClusterName().value();
|
||||||
int dataNodes = 0;
|
int dataNodes = 0;
|
||||||
int benchNodes = 0;
|
|
||||||
int masterAndDataNodes = 0;
|
int masterAndDataNodes = 0;
|
||||||
for (int i = 0; i < nodeInfos.getNodes().length; i++) {
|
for (int i = 0; i < nodeInfos.getNodes().length; i++) {
|
||||||
NodeInfo nodeInfo = nodeInfos.getNodes()[i];
|
NodeInfo nodeInfo = nodeInfos.getNodes()[i];
|
||||||
@ -90,12 +88,8 @@ public final class ExternalTestCluster extends TestCluster {
|
|||||||
} else if (DiscoveryNode.masterNode(nodeInfo.getSettings())) {
|
} else if (DiscoveryNode.masterNode(nodeInfo.getSettings())) {
|
||||||
masterAndDataNodes++;
|
masterAndDataNodes++;
|
||||||
}
|
}
|
||||||
if (nodeInfo.getSettings().getAsBoolean("node.bench", false)) {
|
|
||||||
benchNodes++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.numDataNodes = dataNodes;
|
this.numDataNodes = dataNodes;
|
||||||
this.numBenchNodes = benchNodes;
|
|
||||||
this.numMasterAndDataNodes = masterAndDataNodes;
|
this.numMasterAndDataNodes = masterAndDataNodes;
|
||||||
logger.info("Setup ExternalTestCluster [{}] made of [{}] nodes", nodeInfos.getClusterName().value(), size());
|
logger.info("Setup ExternalTestCluster [{}] made of [{}] nodes", nodeInfos.getClusterName().value(), size());
|
||||||
}
|
}
|
||||||
@ -125,11 +119,6 @@ public final class ExternalTestCluster extends TestCluster {
|
|||||||
return numMasterAndDataNodes;
|
return numMasterAndDataNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int numBenchNodes() {
|
|
||||||
return numBenchNodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InetSocketAddress[] httpAddresses() {
|
public InetSocketAddress[] httpAddresses() {
|
||||||
return httpAddresses;
|
return httpAddresses;
|
||||||
|
@ -161,7 +161,6 @@ public final class InternalTestCluster extends TestCluster {
|
|||||||
static final int DEFAULT_MIN_NUM_CLIENT_NODES = 0;
|
static final int DEFAULT_MIN_NUM_CLIENT_NODES = 0;
|
||||||
static final int DEFAULT_MAX_NUM_CLIENT_NODES = 1;
|
static final int DEFAULT_MAX_NUM_CLIENT_NODES = 1;
|
||||||
|
|
||||||
static final boolean DEFAULT_ENABLE_RANDOM_BENCH_NODES = true;
|
|
||||||
static final boolean DEFAULT_ENABLE_HTTP_PIPELINING = true;
|
static final boolean DEFAULT_ENABLE_HTTP_PIPELINING = true;
|
||||||
|
|
||||||
public static final String NODE_MODE = nodeMode();
|
public static final String NODE_MODE = nodeMode();
|
||||||
@ -188,8 +187,6 @@ public final class InternalTestCluster extends TestCluster {
|
|||||||
|
|
||||||
private final int numSharedClientNodes;
|
private final int numSharedClientNodes;
|
||||||
|
|
||||||
private final boolean enableRandomBenchNodes;
|
|
||||||
|
|
||||||
private final SettingsSource settingsSource;
|
private final SettingsSource settingsSource;
|
||||||
|
|
||||||
private final ExecutorService executor;
|
private final ExecutorService executor;
|
||||||
@ -201,15 +198,14 @@ public final class InternalTestCluster extends TestCluster {
|
|||||||
|
|
||||||
private ServiceDisruptionScheme activeDisruptionScheme;
|
private ServiceDisruptionScheme activeDisruptionScheme;
|
||||||
|
|
||||||
public InternalTestCluster(long clusterSeed, int minNumDataNodes, int maxNumDataNodes, String clusterName, int numClientNodes, boolean enableRandomBenchNodes,
|
public InternalTestCluster(long clusterSeed, int minNumDataNodes, int maxNumDataNodes, String clusterName, int numClientNodes,
|
||||||
boolean enableHttpPipelining, int jvmOrdinal, String nodePrefix) {
|
boolean enableHttpPipelining, int jvmOrdinal, String nodePrefix) {
|
||||||
this(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName, DEFAULT_SETTINGS_SOURCE, numClientNodes, enableRandomBenchNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
this(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName, DEFAULT_SETTINGS_SOURCE, numClientNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InternalTestCluster(long clusterSeed,
|
public InternalTestCluster(long clusterSeed,
|
||||||
int minNumDataNodes, int maxNumDataNodes, String clusterName, SettingsSource settingsSource, int numClientNodes,
|
int minNumDataNodes, int maxNumDataNodes, String clusterName, SettingsSource settingsSource, int numClientNodes,
|
||||||
boolean enableRandomBenchNodes, boolean enableHttpPipelining,
|
boolean enableHttpPipelining, int jvmOrdinal, String nodePrefix) {
|
||||||
int jvmOrdinal, String nodePrefix) {
|
|
||||||
super(clusterSeed);
|
super(clusterSeed);
|
||||||
this.clusterName = clusterName;
|
this.clusterName = clusterName;
|
||||||
|
|
||||||
@ -238,8 +234,6 @@ public final class InternalTestCluster extends TestCluster {
|
|||||||
}
|
}
|
||||||
assert this.numSharedClientNodes >= 0;
|
assert this.numSharedClientNodes >= 0;
|
||||||
|
|
||||||
this.enableRandomBenchNodes = enableRandomBenchNodes;
|
|
||||||
|
|
||||||
this.nodePrefix = nodePrefix;
|
this.nodePrefix = nodePrefix;
|
||||||
|
|
||||||
assert nodePrefix != null;
|
assert nodePrefix != null;
|
||||||
@ -938,10 +932,6 @@ public final class InternalTestCluster extends TestCluster {
|
|||||||
if (nodeAndClient == null) {
|
if (nodeAndClient == null) {
|
||||||
changed = true;
|
changed = true;
|
||||||
Builder clientSettingsBuilder = ImmutableSettings.builder().put("node.client", true);
|
Builder clientSettingsBuilder = ImmutableSettings.builder().put("node.client", true);
|
||||||
if (enableRandomBenchNodes && usually(random)) {
|
|
||||||
//client nodes might also be bench nodes
|
|
||||||
clientSettingsBuilder.put("node.bench", true);
|
|
||||||
}
|
|
||||||
nodeAndClient = buildNode(i, sharedNodesSeeds[i], clientSettingsBuilder.build(), Version.CURRENT);
|
nodeAndClient = buildNode(i, sharedNodesSeeds[i], clientSettingsBuilder.build(), Version.CURRENT);
|
||||||
nodeAndClient.node.start();
|
nodeAndClient.node.start();
|
||||||
logger.info("Start Shared Node [{}] not shared", nodeAndClient.name);
|
logger.info("Start Shared Node [{}] not shared", nodeAndClient.name);
|
||||||
@ -1486,11 +1476,6 @@ public final class InternalTestCluster extends TestCluster {
|
|||||||
return dataAndMasterNodes().size();
|
return dataAndMasterNodes().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int numBenchNodes() {
|
|
||||||
return benchNodeAndClients().size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDisruptionScheme(ServiceDisruptionScheme scheme) {
|
public void setDisruptionScheme(ServiceDisruptionScheme scheme) {
|
||||||
clearDisruptionScheme();
|
clearDisruptionScheme();
|
||||||
scheme.applyToCluster(this);
|
scheme.applyToCluster(this);
|
||||||
@ -1576,17 +1561,6 @@ public final class InternalTestCluster extends TestCluster {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized Collection<NodeAndClient> benchNodeAndClients() {
|
|
||||||
return Collections2.filter(nodes.values(), new BenchNodePredicate());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final class BenchNodePredicate implements Predicate<NodeAndClient> {
|
|
||||||
@Override
|
|
||||||
public boolean apply(NodeAndClient nodeAndClient) {
|
|
||||||
return nodeAndClient.node.settings().getAsBoolean("node.bench", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final class EntryNodePredicate implements Predicate<Map.Entry<String, NodeAndClient>> {
|
private static final class EntryNodePredicate implements Predicate<Map.Entry<String, NodeAndClient>> {
|
||||||
private final Predicate<NodeAndClient> delegateNodePredicate;
|
private final Predicate<NodeAndClient> delegateNodePredicate;
|
||||||
|
|
||||||
|
@ -111,11 +111,6 @@ public abstract class TestCluster implements Iterable<Client>, Closeable {
|
|||||||
*/
|
*/
|
||||||
public abstract int numDataAndMasterNodes();
|
public abstract int numDataAndMasterNodes();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of bench nodes in the cluster.
|
|
||||||
*/
|
|
||||||
public abstract int numBenchNodes();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the http addresses of the nodes within the cluster.
|
* Returns the http addresses of the nodes within the cluster.
|
||||||
* Can be used to run REST tests against the test cluster.
|
* Can be used to run REST tests against the test cluster.
|
||||||
|
@ -45,9 +45,6 @@ public final class Features {
|
|||||||
*/
|
*/
|
||||||
public static boolean areAllSupported(List<String> features) {
|
public static boolean areAllSupported(List<String> features) {
|
||||||
for (String feature : features) {
|
for (String feature : features) {
|
||||||
if ("benchmark".equals(feature) && ElasticsearchIntegrationTest.cluster().numBenchNodes() > 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ("requires_replica".equals(feature) && ElasticsearchIntegrationTest.cluster().numDataNodes() >= 2) {
|
if ("requires_replica".equals(feature) && ElasticsearchIntegrationTest.cluster().numDataNodes() >= 2) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,8 @@ public class InternalTestClusterTests extends ElasticsearchTestCase {
|
|||||||
int jvmOrdinal = randomIntBetween(0, 10);
|
int jvmOrdinal = randomIntBetween(0, 10);
|
||||||
String nodePrefix = randomRealisticUnicodeOfCodepointLengthBetween(1, 10);
|
String nodePrefix = randomRealisticUnicodeOfCodepointLengthBetween(1, 10);
|
||||||
|
|
||||||
InternalTestCluster cluster0 = new InternalTestCluster(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName, settingsSource, numClientNodes, enableRandomBenchNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
InternalTestCluster cluster0 = new InternalTestCluster(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName, settingsSource, numClientNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
||||||
InternalTestCluster cluster1 = new InternalTestCluster(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName, settingsSource, numClientNodes, enableRandomBenchNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
InternalTestCluster cluster1 = new InternalTestCluster(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName, settingsSource, numClientNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
||||||
assertClusters(cluster0, cluster1, true);
|
assertClusters(cluster0, cluster1, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -65,7 +65,6 @@ public class InternalTestClusterTests extends ElasticsearchTestCase {
|
|||||||
Settings defaultSettings1 = cluster1.getDefaultSettings();
|
Settings defaultSettings1 = cluster1.getDefaultSettings();
|
||||||
assertSettings(defaultSettings0, defaultSettings1, assertClusterName);
|
assertSettings(defaultSettings0, defaultSettings1, assertClusterName);
|
||||||
assertThat(cluster0.numDataNodes(), equalTo(cluster1.numDataNodes()));
|
assertThat(cluster0.numDataNodes(), equalTo(cluster1.numDataNodes()));
|
||||||
assertThat(cluster0.numBenchNodes(), equalTo(cluster1.numBenchNodes()));
|
|
||||||
if (assertClusterName) {
|
if (assertClusterName) {
|
||||||
assertThat(cluster0.getClusterName(), equalTo(cluster1.getClusterName()));
|
assertThat(cluster0.getClusterName(), equalTo(cluster1.getClusterName()));
|
||||||
}
|
}
|
||||||
@ -99,8 +98,8 @@ public class InternalTestClusterTests extends ElasticsearchTestCase {
|
|||||||
int jvmOrdinal = randomIntBetween(0, 10);
|
int jvmOrdinal = randomIntBetween(0, 10);
|
||||||
String nodePrefix = "foobar";
|
String nodePrefix = "foobar";
|
||||||
|
|
||||||
InternalTestCluster cluster0 = new InternalTestCluster(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName, settingsSource, numClientNodes, enableRandomBenchNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
InternalTestCluster cluster0 = new InternalTestCluster(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName, settingsSource, numClientNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
||||||
InternalTestCluster cluster1 = new InternalTestCluster(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName1, settingsSource, numClientNodes, enableRandomBenchNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
InternalTestCluster cluster1 = new InternalTestCluster(clusterSeed, minNumDataNodes, maxNumDataNodes, clusterName1, settingsSource, numClientNodes, enableHttpPipelining, jvmOrdinal, nodePrefix);
|
||||||
|
|
||||||
assertClusters(cluster0, cluster1, false);
|
assertClusters(cluster0, cluster1, false);
|
||||||
long seed = randomLong();
|
long seed = randomLong();
|
||||||
|
@ -58,7 +58,6 @@ public class ActionNamesTests extends ElasticsearchIntegrationTest {
|
|||||||
for (String action : transportService.serverHandlers.keySet()) {
|
for (String action : transportService.serverHandlers.keySet()) {
|
||||||
assertThat("action doesn't belong to known category", action, either(startsWith("indices:admin")).or(startsWith("indices:monitor"))
|
assertThat("action doesn't belong to known category", action, either(startsWith("indices:admin")).or(startsWith("indices:monitor"))
|
||||||
.or(startsWith("indices:data/read")).or(startsWith("indices:data/write"))
|
.or(startsWith("indices:data/read")).or(startsWith("indices:data/write"))
|
||||||
.or(startsWith("indices:data/benchmark"))
|
|
||||||
.or(startsWith("cluster:admin")).or(startsWith("cluster:monitor"))
|
.or(startsWith("cluster:admin")).or(startsWith("cluster:monitor"))
|
||||||
.or(startsWith("internal:")));
|
.or(startsWith("internal:")));
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
|||||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
|
|
||||||
@ClusterScope(scope = Scope.SUITE, numDataNodes = 1, enableRandomBenchNodes = false, numClientNodes = 0)
|
@ClusterScope(scope = Scope.SUITE, numDataNodes = 1, numClientNodes = 0)
|
||||||
public class NettyTransportMultiPortIntegrationTests extends ElasticsearchIntegrationTest {
|
public class NettyTransportMultiPortIntegrationTests extends ElasticsearchIntegrationTest {
|
||||||
|
|
||||||
private static int randomPort = -1;
|
private static int randomPort = -1;
|
||||||
|
@ -69,7 +69,7 @@ public class TribeTests extends ElasticsearchIntegrationTest {
|
|||||||
public static void setupSecondCluster() throws Exception {
|
public static void setupSecondCluster() throws Exception {
|
||||||
ElasticsearchIntegrationTest.beforeClass();
|
ElasticsearchIntegrationTest.beforeClass();
|
||||||
// create another cluster
|
// create another cluster
|
||||||
cluster2 = new InternalTestCluster(randomLong(), 2, 2, Strings.randomBase64UUID(getRandom()), 0, false, false, CHILD_JVM_ID, SECOND_CLUSTER_NODE_PREFIX);
|
cluster2 = new InternalTestCluster(randomLong(), 2, 2, Strings.randomBase64UUID(getRandom()), 0, false, CHILD_JVM_ID, SECOND_CLUSTER_NODE_PREFIX);
|
||||||
cluster2.beforeTest(getRandom(), 0.1);
|
cluster2.beforeTest(getRandom(), 0.1);
|
||||||
cluster2.ensureAtLeastNumDataNodes(2);
|
cluster2.ensureAtLeastNumDataNodes(2);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user