forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/data_stream_support_routing
* master: (185 commits) Implement get and containsKey in terms of the wrapped innerMap (elastic#77965) Adjust Lucene version and enable BWC tests (elastic#77933) Disable BWC to upgrade to Lucene-8.10-snapshot Reenable MlDistributedFailureIT [DOCS] Fix typo for `script.painless.regex.enabled` setting value (elastic#77853) Upgrade to Lucene-8.10.0-snapshot-bf2fcb53079 (elastic#77801) [DOCS] Fix ESS install lead-in (elastic#77887) Resolve thirdparty gradle plugin artifacts from mavencentral (elastic#77865) Reduce the number of times that `LifecycleExecutionState` is parsed when running a policy. (elastic#77863) Utility methods to add and remove backing indices from data streams (elastic#77778) Use Objects.equals() instead of == to compare strings (elastic#77840) [ML] prefer least allocated model when a new node is added to the cluster (elastic#77756) Deprecate ignore_throttled parameter (elastic#77479) Improve LifecycleExecutionState parsing. (elastic#77855) [DOCS] Removes deprecated word from HLRC title. (elastic#77851) Remove legacy geo code from AggregationResultUtils (elastic#77702) Adjust SearchableSnapshotsBlobStoreCacheIntegTests.testBlobStoreCache (elastic#77758) Laxify SecureSM to allow creation of the JDK's innocuous threads (elastic#77789) [Test] Reduce concurrency when testing creation of security index (elastic#75293) Refactor metric PipelineAggregation integration test (elastic#77548) ... # Conflicts: # server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java
- Loading branch information
Showing
1,137 changed files
with
24,640 additions
and
10,492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
...ain/java/org/elasticsearch/benchmark/search/fetch/subphase/FetchSourcePhaseBenchmark.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
package org.elasticsearch.benchmark.search.fetch.subphase; | ||
|
||
import org.elasticsearch.common.Strings; | ||
import org.elasticsearch.common.bytes.BytesArray; | ||
import org.elasticsearch.common.bytes.BytesReference; | ||
import org.elasticsearch.common.io.Streams; | ||
import org.elasticsearch.common.io.stream.BytesStreamOutput; | ||
import org.elasticsearch.common.xcontent.DeprecationHandler; | ||
import org.elasticsearch.common.xcontent.NamedXContentRegistry; | ||
import org.elasticsearch.common.xcontent.XContentBuilder; | ||
import org.elasticsearch.common.xcontent.XContentParser; | ||
import org.elasticsearch.common.xcontent.XContentType; | ||
import org.elasticsearch.common.xcontent.support.filtering.FilterPath; | ||
import org.elasticsearch.search.fetch.subphase.FetchSourceContext; | ||
import org.elasticsearch.search.fetch.subphase.FetchSourcePhase; | ||
import org.elasticsearch.search.lookup.SourceLookup; | ||
import org.openjdk.jmh.annotations.Benchmark; | ||
import org.openjdk.jmh.annotations.BenchmarkMode; | ||
import org.openjdk.jmh.annotations.Fork; | ||
import org.openjdk.jmh.annotations.Measurement; | ||
import org.openjdk.jmh.annotations.Mode; | ||
import org.openjdk.jmh.annotations.OutputTimeUnit; | ||
import org.openjdk.jmh.annotations.Param; | ||
import org.openjdk.jmh.annotations.Scope; | ||
import org.openjdk.jmh.annotations.Setup; | ||
import org.openjdk.jmh.annotations.State; | ||
import org.openjdk.jmh.annotations.Warmup; | ||
|
||
import java.io.IOException; | ||
import java.util.Set; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
@Fork(1) | ||
@Warmup(iterations = 5) | ||
@Measurement(iterations = 5) | ||
@BenchmarkMode(Mode.AverageTime) | ||
@OutputTimeUnit(TimeUnit.NANOSECONDS) | ||
@State(Scope.Benchmark) | ||
public class FetchSourcePhaseBenchmark { | ||
private BytesReference sourceBytes; | ||
private FetchSourceContext fetchContext; | ||
private Set<String> includesSet; | ||
private Set<String> excludesSet; | ||
private FilterPath[] includesFilters; | ||
private FilterPath[] excludesFilters; | ||
|
||
@Param({ "tiny", "short", "one_4k_field", "one_4m_field" }) | ||
private String source; | ||
@Param({ "message" }) | ||
private String includes; | ||
@Param({ "" }) | ||
private String excludes; | ||
|
||
@Setup | ||
public void setup() throws IOException { | ||
switch (source) { | ||
case "tiny": | ||
sourceBytes = new BytesArray("{\"message\": \"short\"}"); | ||
break; | ||
case "short": | ||
sourceBytes = read300BytesExample(); | ||
break; | ||
case "one_4k_field": | ||
sourceBytes = buildBigExample("huge".repeat(1024)); | ||
break; | ||
case "one_4m_field": | ||
sourceBytes = buildBigExample("huge".repeat(1024 * 1024)); | ||
break; | ||
default: | ||
throw new IllegalArgumentException("Unknown source [" + source + "]"); | ||
} | ||
fetchContext = new FetchSourceContext( | ||
true, | ||
Strings.splitStringByCommaToArray(includes), | ||
Strings.splitStringByCommaToArray(excludes) | ||
); | ||
includesSet = Set.of(fetchContext.includes()); | ||
excludesSet = Set.of(fetchContext.excludes()); | ||
includesFilters = FilterPath.compile(Set.of(fetchContext.includes())); | ||
excludesFilters = FilterPath.compile(Set.of(fetchContext.excludes())); | ||
} | ||
|
||
private BytesReference read300BytesExample() throws IOException { | ||
return Streams.readFully(FetchSourcePhaseBenchmark.class.getResourceAsStream("300b_example.json")); | ||
} | ||
|
||
private BytesReference buildBigExample(String extraText) throws IOException { | ||
String bigger = read300BytesExample().utf8ToString(); | ||
bigger = "{\"huge\": \"" + extraText + "\"," + bigger.substring(1); | ||
return new BytesArray(bigger); | ||
} | ||
|
||
@Benchmark | ||
public BytesReference filterObjects() throws IOException { | ||
SourceLookup lookup = new SourceLookup(); | ||
lookup.setSource(sourceBytes); | ||
Object value = lookup.filter(fetchContext); | ||
return FetchSourcePhase.objectToBytes(value, XContentType.JSON, Math.min(1024, lookup.internalSourceRef().length())); | ||
} | ||
|
||
@Benchmark | ||
public BytesReference filterXContentOnParser() throws IOException { | ||
BytesStreamOutput streamOutput = new BytesStreamOutput(Math.min(1024, sourceBytes.length())); | ||
XContentBuilder builder = new XContentBuilder(XContentType.JSON.xContent(), streamOutput); | ||
try ( | ||
XContentParser parser = XContentType.JSON.xContent() | ||
.createParser( | ||
NamedXContentRegistry.EMPTY, | ||
DeprecationHandler.THROW_UNSUPPORTED_OPERATION, | ||
sourceBytes.streamInput(), | ||
includesFilters, | ||
excludesFilters | ||
) | ||
) { | ||
builder.copyCurrentStructure(parser); | ||
return BytesReference.bytes(builder); | ||
} | ||
} | ||
|
||
@Benchmark | ||
public BytesReference filterXContentOnBuilder() throws IOException { | ||
BytesStreamOutput streamOutput = new BytesStreamOutput(Math.min(1024, sourceBytes.length())); | ||
XContentBuilder builder = new XContentBuilder( | ||
XContentType.JSON.xContent(), | ||
streamOutput, | ||
includesSet, | ||
excludesSet, | ||
XContentType.JSON.toParsedMediaType() | ||
); | ||
try ( | ||
XContentParser parser = XContentType.JSON.xContent() | ||
.createParser(NamedXContentRegistry.EMPTY, DeprecationHandler.THROW_UNSUPPORTED_OPERATION, sourceBytes.streamInput()) | ||
) { | ||
builder.copyCurrentStructure(parser); | ||
return BytesReference.bytes(builder); | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ks/src/main/resources/org/elasticsearch/benchmark/search/fetch/subphase/300b_example.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"@timestamp": "2099-11-15T14:12:12", | ||
"http": { | ||
"request": { | ||
"method": "get" | ||
}, | ||
"response": { | ||
"bytes": 1070000, | ||
"status_code": 200 | ||
}, | ||
"version": "1.1" | ||
}, | ||
"message": "GET /search HTTP/1.1 200 1070000", | ||
"source": { | ||
"ip": "192.168.0.1" | ||
}, | ||
"user": { | ||
"id": "user" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...ools/src/integTest/groovy/org/elasticsearch/gradle/test/JavaRestTestPluginFuncTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.gradle.test | ||
|
||
import org.elasticsearch.gradle.VersionProperties | ||
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest | ||
import org.gradle.testkit.runner.TaskOutcome | ||
|
||
class JavaRestTestPluginFuncTest extends AbstractGradleFuncTest { | ||
|
||
def "declares default dependencies"() { | ||
given: | ||
buildFile << """ | ||
plugins { | ||
id 'elasticsearch.java-rest-test' | ||
} | ||
""" | ||
|
||
when: | ||
def result = gradleRunner("dependencies").build() | ||
def output = normalized(result.output) | ||
then: | ||
output.contains(normalized(""" | ||
javaRestTestImplementation - Implementation only dependencies for source set 'java rest test'. (n) | ||
/--- org.elasticsearch.test:framework:${VersionProperties.elasticsearch} (n)""")) | ||
} | ||
|
||
def "javaRestTest does nothing when there are no tests"() { | ||
given: | ||
buildFile << """ | ||
plugins { | ||
id 'elasticsearch.java-rest-test' | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
javaRestTestImplementation "org.elasticsearch.test:framework:7.14.0" | ||
} | ||
""" | ||
|
||
when: | ||
def result = gradleRunner("javaRestTest").build() | ||
then: | ||
result.task(':compileJavaRestTestJava').outcome == TaskOutcome.NO_SOURCE | ||
result.task(':javaRestTest').outcome == TaskOutcome.NO_SOURCE | ||
} | ||
|
||
} |
Oops, something went wrong.