Merge branch 'master' into ccr

* master:
  [CI] Mute Ml rolling upgrade tests
  Fix license on AcitveDirectorySIDUtil (#30972)
  [Test] Prefer ArrayList over Vector (#30965)
  [CI] Mute HttpSecretsIntegrationTests#testWebhookAction test
  Mute FlushIT tests
  Add “took” timing info to response for _msearch/template API (#30961)
This commit is contained in:
Nhat Nguyen 2018-05-30 21:36:56 -04:00
commit 16402305bb
9 changed files with 50 additions and 11 deletions

View File

@ -20,12 +20,14 @@
package org.elasticsearch.script.mustache;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -107,12 +109,14 @@ public class MultiSearchTemplateResponse extends ActionResponse implements Itera
}
private Item[] items;
private long tookInMillis;
MultiSearchTemplateResponse() {
}
public MultiSearchTemplateResponse(Item[] items) {
public MultiSearchTemplateResponse(Item[] items, long tookInMillis) {
this.items = items;
this.tookInMillis = tookInMillis;
}
@Override
@ -126,6 +130,13 @@ public class MultiSearchTemplateResponse extends ActionResponse implements Itera
public Item[] getResponses() {
return this.items;
}
/**
* How long the msearch_template took.
*/
public TimeValue getTook() {
return new TimeValue(tookInMillis);
}
@Override
public void readFrom(StreamInput in) throws IOException {
@ -134,6 +145,9 @@ public class MultiSearchTemplateResponse extends ActionResponse implements Itera
for (int i = 0; i < items.length; i++) {
items[i] = Item.readItem(in);
}
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
tookInMillis = in.readVLong();
}
}
@Override
@ -143,11 +157,15 @@ public class MultiSearchTemplateResponse extends ActionResponse implements Itera
for (Item item : items) {
item.writeTo(out);
}
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
out.writeVLong(tookInMillis);
}
}
@Override
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException {
builder.startObject();
builder.field("took", tookInMillis);
builder.startArray(Fields.RESPONSES);
for (Item item : items) {
if (item.isFailure()) {

View File

@ -94,7 +94,7 @@ public class TransportMultiSearchTemplateAction extends HandledTransportAction<M
items[originalSlot].getResponse().setResponse(item.getResponse());
}
}
listener.onResponse(new MultiSearchTemplateResponse(items));
listener.onResponse(new MultiSearchTemplateResponse(items, r.getTook().millis()));
}, listener::onFailure));
}
}

View File

@ -37,6 +37,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
import static org.hamcrest.Matchers.arrayWithSize;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.core.Is.is;
@ -140,6 +141,7 @@ public class MultiSearchTemplateIT extends ESIntegTestCase {
MultiSearchTemplateResponse response = client().execute(MultiSearchTemplateAction.INSTANCE, multiRequest).get();
assertThat(response.getResponses(), arrayWithSize(5));
assertThat(response.getTook().millis(), greaterThan(0L));
MultiSearchTemplateResponse.Item response1 = response.getResponses()[0];
assertThat(response1.isFailure(), is(false));

View File

@ -38,7 +38,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Vector;
import static org.elasticsearch.test.EqualsHashCodeTestUtils.checkEqualsAndHashCode;
import static org.elasticsearch.test.XContentTestUtils.insertRandomFields;
@ -146,7 +145,7 @@ public class MeanReciprocalRankTests extends ESTestCase {
public void testCombine() {
MeanReciprocalRank reciprocalRank = new MeanReciprocalRank();
Vector<EvalQueryQuality> partialResults = new Vector<>(3);
List<EvalQueryQuality> partialResults = new ArrayList<>(3);
partialResults.add(new EvalQueryQuality("id1", 0.5));
partialResults.add(new EvalQueryQuality("id2", 1.0));
partialResults.add(new EvalQueryQuality("id3", 0.75));

View File

@ -38,7 +38,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Vector;
import static org.elasticsearch.test.EqualsHashCodeTestUtils.checkEqualsAndHashCode;
import static org.elasticsearch.test.XContentTestUtils.insertRandomFields;
@ -163,7 +162,7 @@ public class PrecisionAtKTests extends ESTestCase {
public void testCombine() {
PrecisionAtK metric = new PrecisionAtK();
Vector<EvalQueryQuality> partialResults = new Vector<>(3);
List<EvalQueryQuality> partialResults = new ArrayList<>(3);
partialResults.add(new EvalQueryQuality("a", 0.1));
partialResults.add(new EvalQueryQuality("b", 0.2));
partialResults.add(new EvalQueryQuality("c", 0.6));

View File

@ -254,6 +254,7 @@ public class FlushIT extends ESIntegTestCase {
result.totalShards(), result.failed(), result.failureReason(), detail);
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/29392")
@TestLogging("_root:DEBUG,org.elasticsearch.indices.flush:TRACE")
public void testSyncedFlushSkipOutOfSyncReplicas() throws Exception {
internalCluster().ensureAtLeastNumDataNodes(between(2, 3));
@ -296,6 +297,7 @@ public class FlushIT extends ESIntegTestCase {
assertThat(fullResult.successfulShards(), equalTo(numberOfReplicas + 1));
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/29392")
@TestLogging("_root:DEBUG,org.elasticsearch.indices.flush:TRACE")
public void testDoNotRenewSyncedFlushWhenAllSealed() throws Exception {
internalCluster().ensureAtLeastNumDataNodes(between(2, 3));

View File

@ -1,7 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF 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.
*/
/*

View File

@ -165,6 +165,7 @@ public class HttpSecretsIntegrationTests extends AbstractWatcherIntegrationTestC
is(ApplicableBasicAuth.headerValue(USERNAME, PASSWORD.toCharArray())));
}
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/30094")
public void testWebhookAction() throws Exception {
WatcherClient watcherClient = watcherClient();
watcherClient.preparePutWatch("_id")

View File

@ -8,7 +8,9 @@ setup:
---
"Test open old jobs":
- skip:
version: "all"
reason: "@AwaitsFix: https://github.com/elastic/elasticsearch/issues/30982"
- do:
xpack.ml.open_job:
job_id: old-cluster-job
@ -75,6 +77,9 @@ setup:
---
"Test job with no model memory limit has established model memory after reopening":
- skip:
version: "all"
reason: "@AwaitsFix: https://github.com/elastic/elasticsearch/issues/30982"
- do:
xpack.ml.open_job:
job_id: no-model-memory-limit-job