Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into rename-resize-reque…
Browse files Browse the repository at this point in the history
…st-variables

* origin/master:
  Test: Switch painless test to 1 shard
  CCS: Drop http address from remote cluster info (elastic#29568)
  Reindex: Fold "from old" tests into reindex module (elastic#30142)
  Convert FieldCapabilitiesResponse to a ToXContentObject. (elastic#30182)
  [DOCS] Added 'on a single shard' to description of max_thread_count. Closes 28518 (elastic#29686)
  [TEST] Redirect links to new locations (elastic#30179)
  • Loading branch information
jasontedor committed Apr 27, 2018
2 parents 4e64275 + 8401eac commit 36bb0d1
Show file tree
Hide file tree
Showing 26 changed files with 158 additions and 321 deletions.
3 changes: 0 additions & 3 deletions docs/reference/cluster/remote-info.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ the configured remote cluster alias.
`seeds`::
The configured initial seed transport addresses of the remote cluster.

`http_addresses`::
The published http addresses of all connected remote nodes.

`connected`::
True if there is at least one connection to the remote cluster.

Expand Down
3 changes: 2 additions & 1 deletion docs/reference/index-modules/merge.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ The merge scheduler supports the following _dynamic_ setting:

`index.merge.scheduler.max_thread_count`::

The maximum number of threads that may be merging at once. Defaults to
The maximum number of threads on a single shard that may be merging at once.
Defaults to
`Math.max(1, Math.min(4, Runtime.getRuntime().availableProcessors() / 2))`
which works well for a good solid-state-disk (SSD). If your index is on
spinning platter drives instead, decrease this to 1.
Expand Down
4 changes: 4 additions & 0 deletions docs/reference/release-notes/7.0.0-alpha1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ The changes listed below have been released for the first time in Elasticsearch
Core::
* Tribe node has been removed in favor of Cross-Cluster-Search

Cross-Cluster-Search::
* `http_addresses` has been removed from the <<cluster-remote-info>> API
because it is expensive to fetch and no longer needed by Kibana.

Rest API::
* The Clear Cache API only supports `POST` as HTTP method
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ setup:
indices.create:
index: test
body:
settings:
number_of_shards: 1
mappings:
test:
properties:
Expand Down
62 changes: 62 additions & 0 deletions modules/reindex/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
* under the License.
*/

import org.apache.tools.ant.taskdefs.condition.Os

import static org.elasticsearch.gradle.BuildPlugin.getJavaHome

apply plugin: 'elasticsearch.test-with-dependencies'

esplugin {
Expand Down Expand Up @@ -60,3 +64,61 @@ thirdPartyAudit.excludes = [
'org.apache.log.Hierarchy',
'org.apache.log.Logger',
]

// Support for testing reindex-from-remote against old Elaticsearch versions
configurations {
oldesFixture
es2
es1
es090
}

dependencies {
oldesFixture project(':test:fixtures:old-elasticsearch')
/* Right now we just test against the latest version of each major we expect
* reindex-from-remote to work against. We could randomize the versions but
* that doesn't seem worth it at this point. */
es2 'org.elasticsearch.distribution.zip:elasticsearch:2.4.5@zip'
es1 'org.elasticsearch:elasticsearch:1.7.6@zip'
es090 'org.elasticsearch:elasticsearch:0.90.13@zip'
}

if (Os.isFamily(Os.FAMILY_WINDOWS)) {
// we can't get the pid files in windows so we skip reindex-from-old
integTestRunner.systemProperty "tests.fromOld", "false"
} else {
integTestRunner.systemProperty "tests.fromOld", "true"
/* Set up tasks to unzip and run the old versions of ES before running the
* integration tests. */
for (String version : ['2', '1', '090']) {
Task unzip = task("unzipEs${version}", type: Sync) {
Configuration oldEsDependency = configurations['es' + version]
dependsOn oldEsDependency
/* Use a closure here to delay resolution of the dependency until we need
* it */
from {
oldEsDependency.collect { zipTree(it) }
}
into temporaryDir
}
Task fixture = task("oldEs${version}Fixture",
type: org.elasticsearch.gradle.test.AntFixture) {
dependsOn project.configurations.oldesFixture
dependsOn unzip
executable = new File(project.runtimeJavaHome, 'bin/java')
env 'CLASSPATH', "${ -> project.configurations.oldesFixture.asPath }"
env 'JAVA_HOME', getJavaHome(it, 7)
args 'oldes.OldElasticsearch',
baseDir,
unzip.temporaryDir,
version == '090'
}
integTest.dependsOn fixture
integTestRunner {
/* Use a closure on the string to delay evaluation until right before we
* run the integration tests so that we can be sure that the file is
* ready. */
systemProperty "es${version}.port", "${ -> fixture.addressAndPort }"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

package org.elasticsearch.smoketest;
package org.elasticsearch.index.reindex.remote;

import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
Expand All @@ -27,6 +27,7 @@
import org.elasticsearch.client.Response;
import org.elasticsearch.client.ResponseException;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.common.Booleans;
import org.elasticsearch.test.rest.ESRestTestCase;

import java.io.IOException;
Expand All @@ -38,6 +39,9 @@

public class ReindexFromOldRemoteIT extends ESRestTestCase {
private void oldEsTestCase(String portPropertyName, String requestsPerSecond) throws IOException {
boolean enabled = Booleans.parseBoolean(System.getProperty("tests.fromOld"));
assumeTrue("test is disabled, probably because this is windows", enabled);

int oldEsPort = Integer.parseInt(System.getProperty(portPropertyName));
try (RestClient oldEs = RestClient.builder(new HttpHost("127.0.0.1", oldEsPort)).build()) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
- match: { my_remote_cluster.num_nodes_connected: 1}
- match: { my_remote_cluster.max_connections_per_cluster: 1}
- match: { my_remote_cluster.initial_connect_timeout: "30s" }
- is_true: my_remote_cluster.http_addresses.0

---
"Add transient remote cluster based on the preset cluster and check remote info":
Expand Down Expand Up @@ -38,9 +37,6 @@

- do:
cluster.remote_info: {}
- set: { my_remote_cluster.http_addresses.0: remote_http }
- match: { test_remote_cluster.http_addresses.0: $remote_http }

- match: { test_remote_cluster.connected: true }
- match: { my_remote_cluster.connected: true }

Expand Down Expand Up @@ -132,4 +128,3 @@
transient:
search.remote.remote1.seeds: null
search.remote.remote1.skip_unavailable: null

94 changes: 0 additions & 94 deletions qa/reindex-from-old/build.gradle

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;

import static java.util.stream.Collectors.toList;

public final class TransportRemoteInfoAction extends HandledTransportAction<RemoteInfoRequest, RemoteInfoResponse> {

private final RemoteClusterService remoteClusterService;
Expand All @@ -45,7 +47,6 @@ public TransportRemoteInfoAction(Settings settings, ThreadPool threadPool, Trans

@Override
protected void doExecute(RemoteInfoRequest remoteInfoRequest, ActionListener<RemoteInfoResponse> listener) {
remoteClusterService.getRemoteConnectionInfos(ActionListener.wrap(remoteConnectionInfos
-> listener.onResponse(new RemoteInfoResponse(remoteConnectionInfos)), listener::onFailure));
listener.onResponse(new RemoteInfoResponse(remoteClusterService.getRemoteConnectionInfos().collect(toList())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.ToXContentFragment;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentParserUtils;
Expand All @@ -41,7 +41,7 @@
/**
* Response for {@link FieldCapabilitiesRequest} requests.
*/
public class FieldCapabilitiesResponse extends ActionResponse implements ToXContentFragment {
public class FieldCapabilitiesResponse extends ActionResponse implements ToXContentObject {
private static final ParseField FIELDS_FIELD = new ParseField("fields");

private Map<String, Map<String, FieldCapabilities>> responseMap;
Expand Down Expand Up @@ -123,8 +123,9 @@ private static void writeField(StreamOutput out,

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.field(FIELDS_FIELD.getPreferredName(), responseMap);
return builder;
return builder.startObject()
.field(FIELDS_FIELD.getPreferredName(), responseMap)
.endObject();
}

public static FieldCapabilitiesResponse fromXContent(XContentParser parser) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request,
fieldRequest.indicesOptions(
IndicesOptions.fromRequest(request, fieldRequest.indicesOptions())
);
return channel -> client.fieldCaps(fieldRequest,
new RestBuilderListener<FieldCapabilitiesResponse>(channel) {
@Override
public RestResponse buildResponse(FieldCapabilitiesResponse response,
XContentBuilder builder) throws Exception {
RestStatus status = OK;
builder.startObject();
response.toXContent(builder, request);
builder.endObject();
return new BytesRestResponse(status, builder);
}
});
return channel -> client.fieldCaps(fieldRequest, new RestToXContentListener<>(channel));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.rest.action.RestBuilderListener;
import org.elasticsearch.rest.action.RestToXContentListener;

import java.io.IOException;

Expand All @@ -50,16 +51,8 @@ public String getName() {
}

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client)
throws IOException {
return channel -> client.execute(RemoteInfoAction.INSTANCE, new RemoteInfoRequest(),
new RestBuilderListener<RemoteInfoResponse>(channel) {
@Override
public RestResponse buildResponse(RemoteInfoResponse response, XContentBuilder builder) throws Exception {
response.toXContent(builder, request);
return new BytesRestResponse(RestStatus.OK, builder);
}
});
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
return channel -> client.execute(RemoteInfoAction.INSTANCE, new RemoteInfoRequest(), new RestToXContentListener<>(channel));
}
@Override
public boolean canTripCircuitBreaker() {
Expand Down
Loading

0 comments on commit 36bb0d1

Please sign in to comment.