Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…111712_fix
  • Loading branch information
astefan committed Aug 22, 2024
2 parents e5eb5fc + 615e084 commit 83bc2dd
Show file tree
Hide file tree
Showing 62 changed files with 1,759 additions and 251 deletions.
1 change: 1 addition & 0 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies {
// us to invoke the JMH uberjar as usual.
exclude group: 'net.sf.jopt-simple', module: 'jopt-simple'
}
api(project(':libs:elasticsearch-h3'))
api(project(':modules:aggregations'))
api(project(':x-pack:plugin:esql-core'))
api(project(':x-pack:plugin:esql'))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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.benchmark.h3;

import org.elasticsearch.h3.H3;
import org.openjdk.jmh.Main;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.Blackhole;

import java.util.concurrent.TimeUnit;

@OutputTimeUnit(TimeUnit.SECONDS)
@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
@Measurement(iterations = 25, time = 1, timeUnit = TimeUnit.SECONDS)
@Fork(1)
public class H3Benchmark {

@Benchmark
public void pointToH3(H3State state, Blackhole bh) {
for (int i = 0; i < state.points.length; i++) {
for (int res = 0; res <= 15; res++) {
bh.consume(H3.geoToH3(state.points[i][0], state.points[i][1], res));
}
}
}

@Benchmark
public void h3Boundary(H3State state, Blackhole bh) {
for (int i = 0; i < state.h3.length; i++) {
bh.consume(H3.h3ToGeoBoundary(state.h3[i]));
}
}

public static void main(String[] args) throws Exception {
Main.main(args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.benchmark.h3;

import org.elasticsearch.h3.H3;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;

import java.io.IOException;
import java.util.Random;

@State(Scope.Benchmark)
public class H3State {

double[][] points = new double[1000][2];
long[] h3 = new long[1000];

@Setup(Level.Trial)
public void setupTrial() throws IOException {
Random random = new Random(1234);
for (int i = 0; i < points.length; i++) {
points[i][0] = random.nextDouble() * 180 - 90; // lat
points[i][1] = random.nextDouble() * 360 - 180; // lon
int res = random.nextInt(16); // resolution
h3[i] = H3.geoToH3(points[i][0], points[i][1], res);
}
}
}
4 changes: 2 additions & 2 deletions build-tools-internal/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=258e722ec21e955201e31447b0aed14201765a3bfbae296a46cf60b70e66db70
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
distributionSha256Sum=682b4df7fe5accdca84a4d1ef6a3a6ab096b3efd5edf7de2bd8c758d95a93703
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.9
8.10
5 changes: 5 additions & 0 deletions docs/changelog/110524.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 110524
summary: Introduce mode `subobjects=auto` for objects
area: Mapping
type: enhancement
issues: []
5 changes: 5 additions & 0 deletions docs/changelog/111690.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 111690
summary: "ESQL: Support INLINESTATS grouped on expressions"
area: ES|QL
type: enhancement
issues: []
6 changes: 6 additions & 0 deletions docs/changelog/112090.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 112090
summary: Always check `crsType` when folding spatial functions
area: Geo
type: bug
issues:
- 112089
14 changes: 13 additions & 1 deletion docs/reference/modules/cluster/remote-clusters-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ mode are described separately.

`cluster.remote.<cluster_alias>.mode`::
The mode used for a remote cluster connection. The only supported modes are
`sniff` and `proxy`.
`sniff` and `proxy`. The default is `sniff`. See <<sniff-proxy-modes>> for
further information about these modes, and <<remote-cluster-sniff-settings>>
and <<remote-cluster-proxy-settings>> for further information about their
settings.

`cluster.remote.initial_connect_timeout`::

Expand Down Expand Up @@ -97,6 +100,11 @@ you configure the remotes.
[[remote-cluster-sniff-settings]]
==== Sniff mode remote cluster settings

To use <<sniff-mode,sniff mode>> to connect to a remote cluster, set
`cluster.remote.<cluster_alias>.mode: sniff` and then configure the following
settings. You may also leave `cluster.remote.<cluster_alias>.mode` unset since
`sniff` is the default mode.

`cluster.remote.<cluster_alias>.seeds`::

The list of seed nodes used to sniff the remote cluster state.
Expand All @@ -117,6 +125,10 @@ you configure the remotes.
[[remote-cluster-proxy-settings]]
==== Proxy mode remote cluster settings

To use <<proxy-mode,proxy mode>> to connect to a remote cluster, set
`cluster.remote.<cluster_alias>.mode: proxy` and then configure the following
settings.

`cluster.remote.<cluster_alias>.proxy_address`::

The address used for all remote connections.
Expand Down
55 changes: 31 additions & 24 deletions docs/reference/modules/remote-clusters.asciidoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[[remote-clusters]]
== Remote clusters
You can connect a local cluster to other {es} clusters, known as _remote
clusters_. Remote clusters can be located in different datacenters or
clusters_. Remote clusters can be located in different datacenters or
geographic regions, and contain indices or data streams that can be replicated
with {ccr} or searched by a local cluster using {ccs}.

Expand Down Expand Up @@ -30,9 +30,9 @@ capabilities, the local and remote cluster must be on the same
[discrete]
=== Add remote clusters

NOTE: The instructions that follow describe how to create a remote connection from a
self-managed cluster. You can also set up {ccs} and {ccr} from an
link:https://www.elastic.co/guide/en/cloud/current/ec-enable-ccs.html[{ess} deployment]
NOTE: The instructions that follow describe how to create a remote connection from a
self-managed cluster. You can also set up {ccs} and {ccr} from an
link:https://www.elastic.co/guide/en/cloud/current/ec-enable-ccs.html[{ess} deployment]
or from an link:https://www.elastic.co/guide/en/cloud-enterprise/current/ece-enable-ccs.html[{ece} deployment].

To add remote clusters, you can choose between
Expand All @@ -52,7 +52,7 @@ controls. <<remote-clusters-api-key>>.

Certificate based security model::
Uses mutual TLS authentication for cross-cluster operations. User authentication
is performed on the local cluster and a user's role names are passed to the
is performed on the local cluster and a user's role names are passed to the
remote cluster. In this model, a superuser on the local cluster gains total read
access to the remote cluster, so it is only suitable for clusters that are in
the same security domain. <<remote-clusters-cert>>.
Expand All @@ -63,15 +63,17 @@ the same security domain. <<remote-clusters-cert>>.

[[sniff-mode]]
Sniff mode::
In sniff mode, a cluster is registered with a name of your choosing and a list
of addresses of _seed_ nodes. When you register a remote cluster using sniff
mode, {es} retrieves from one of the seed nodes the addresses of up to three
_gateway nodes_. Each `remote_cluster_client` node in the local {es} cluster
then opens several TCP connections to the publish addresses of the gateway
nodes. This mode therefore requires that the gateway nodes' publish addresses
are accessible to nodes in the local cluster.
In sniff mode, a cluster alias is registered with a name of your choosing and a
list of addresses of _seed_ nodes specified with the
`cluster.remote.<cluster_alias>.seeds` setting. When you register a remote
cluster using sniff mode, {es} retrieves from one of the seed nodes the
addresses of up to three _gateway nodes_. Each `remote_cluster_client` node in
the local {es} cluster then opens several TCP connections to the publish
addresses of the gateway nodes. This mode therefore requires that the gateway
nodes' publish addresses are accessible to nodes in the local cluster.
+
Sniff mode is the default connection mode.
Sniff mode is the default connection mode. See <<remote-cluster-sniff-settings>>
for more information about configuring sniff mode.
+
[[gateway-nodes-selection]]
The _gateway nodes_ selection depends on the following criteria:
Expand All @@ -86,18 +88,23 @@ However, such nodes still have to satisfy the two above requirements.

[[proxy-mode]]
Proxy mode::
In proxy mode, a cluster is registered with a name of your choosing and the
address of a TCP (layer 4) reverse proxy which you must configure to route
connections to the nodes of the remote cluster. When you register a remote
cluster using proxy mode, {es} opens several TCP connections to the proxy
address and uses these connections to communicate with the remote cluster. In
proxy mode {es} disregards the publish addresses of the remote cluster nodes
which means that the publish addresses of the remote cluster nodes need not be
accessible to the local cluster.
In proxy mode, a cluster alias is registered with a name of your choosing and
the address of a TCP (layer 4) reverse proxy specified with the
`cluster.remote.<cluster_alias>.proxy_address` setting. You must configure this
proxy to route connections to one or more nodes of the remote cluster. When you
register a remote cluster using proxy mode, {es} opens several TCP connections
to the proxy address and uses these connections to communicate with the remote
cluster. In proxy mode {es} disregards the publish addresses of the remote
cluster nodes which means that the publish addresses of the remote cluster
nodes need not be accessible to the local cluster.
+
Proxy mode is not the default connection mode, so you must configure it
explicitly if desired. Proxy mode has the same <<gateway-nodes-selection,
version compatibility requirements>> as sniff mode.
Proxy mode is not the default connection mode, so you must set
`cluster.remote.<cluster_alias>.mode: proxy` to use it. See
<<remote-cluster-proxy-settings>> for more information about configuring proxy
mode.
+
Proxy mode has the same <<gateway-nodes-selection, version compatibility
requirements>> as sniff mode.

include::cluster/remote-clusters-api-key.asciidoc[]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ For more information, see <<security-privileges>>.
==== {api-description-title}

This API mounts a snapshot as a searchable snapshot index.
Note that manually mounting {ilm-init}-managed snapshots can <<manually-mounting-snapshots,interfere>> with <<index-lifecycle-management,{ilm-init} processes>>.

Don't use this API for snapshots managed by {ilm-init}. Manually mounting
{ilm-init}-managed snapshots can <<manually-mounting-snapshots,interfere>> with
<<index-lifecycle-management,{ilm-init} processes>>.

[[searchable-snapshots-api-mount-path-params]]
==== {api-path-parms-title}
Expand Down
9 changes: 6 additions & 3 deletions docs/reference/searchable-snapshots/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,12 @@ nodes that have a shared cache.
====
Manually mounting snapshots captured by an Index Lifecycle Management ({ilm-init}) policy can
interfere with {ilm-init}'s automatic management. This may lead to issues such as data loss
or complications with snapshot handling. For optimal results, allow {ilm-init} to manage
snapshots automatically. If manual mounting is necessary, be aware of its potential
impact on {ilm-init} processes. For more information, learn about <<index-lifecycle-management,{ilm-init} snapshot management>>.
or complications with snapshot handling.
For optimal results, allow {ilm-init} to manage
snapshots automatically.
<<ilm-searchable-snapshot,Learn more about {ilm-init} snapshot management>>.
====

[[searchable-snapshots-shared-cache]]
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=258e722ec21e955201e31447b0aed14201765a3bfbae296a46cf60b70e66db70
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
distributionSha256Sum=682b4df7fe5accdca84a4d1ef6a3a6ab096b3efd5edf7de2bd8c758d95a93703
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.elasticsearch.common.time.DateFormatter;
import org.elasticsearch.common.time.FormatNames;
import org.elasticsearch.index.mapper.ObjectMapper;
import org.elasticsearch.logsdb.datageneration.DataGenerator;
import org.elasticsearch.logsdb.datageneration.DataGeneratorSpecification;
import org.elasticsearch.logsdb.datageneration.FieldType;
Expand All @@ -32,17 +33,17 @@
*/
public class StandardVersusLogsIndexModeRandomDataChallengeRestIT extends StandardVersusLogsIndexModeChallengeRestIT {
private final boolean fullyDynamicMapping;
private final boolean subobjectsDisabled;
private final ObjectMapper.Subobjects subobjects;

private final DataGenerator dataGenerator;

public StandardVersusLogsIndexModeRandomDataChallengeRestIT() {
super();
this.fullyDynamicMapping = randomBoolean();
this.subobjectsDisabled = randomBoolean();
this.subobjects = randomFrom(ObjectMapper.Subobjects.values());

var specificationBuilder = DataGeneratorSpecification.builder();
if (subobjectsDisabled) {
if (subobjects != ObjectMapper.Subobjects.ENABLED) {
specificationBuilder = specificationBuilder.withNestedFieldsLimit(0);
}
this.dataGenerator = new DataGenerator(specificationBuilder.withDataSourceHandlers(List.of(new DataSourceHandler() {
Expand All @@ -60,7 +61,7 @@ public DataSourceResponse.FieldTypeGenerator handle(DataSourceRequest.FieldTypeG
}

public DataSourceResponse.ObjectMappingParametersGenerator handle(DataSourceRequest.ObjectMappingParametersGenerator request) {
if (subobjectsDisabled == false) {
if (subobjects == ObjectMapper.Subobjects.ENABLED) {
// Use default behavior
return null;
}
Expand All @@ -71,13 +72,13 @@ public DataSourceResponse.ObjectMappingParametersGenerator handle(DataSourceRequ
// "dynamic: false/strict/runtime" is not compatible with subobjects: false
return new DataSourceResponse.ObjectMappingParametersGenerator(() -> {
var parameters = new HashMap<String, Object>();
parameters.put("subobjects", subobjects.toString());
if (ESTestCase.randomBoolean()) {
parameters.put("dynamic", "true");
}
if (ESTestCase.randomBoolean()) {
parameters.put("enabled", "true");
}

return parameters;
});
}
Expand Down Expand Up @@ -106,15 +107,15 @@ public void baselineMappings(XContentBuilder builder) throws IOException {
@Override
public void contenderMappings(XContentBuilder builder) throws IOException {
if (fullyDynamicMapping == false) {
if (subobjectsDisabled) {
dataGenerator.writeMapping(builder, b -> builder.field("subobjects", false));
if (subobjects != ObjectMapper.Subobjects.ENABLED) {
dataGenerator.writeMapping(builder, b -> builder.field("subobjects", subobjects.toString()));
} else {
dataGenerator.writeMapping(builder);
}
} else {
builder.startObject();
if (subobjectsDisabled) {
builder.field("subobjects", false);
if (subobjects != ObjectMapper.Subobjects.ENABLED) {
builder.field("subobjects", subobjects.toString());
}
builder.endObject();
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/examples/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=258e722ec21e955201e31447b0aed14201765a3bfbae296a46cf60b70e66db70
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
distributionSha256Sum=682b4df7fe5accdca84a4d1ef6a3a6ab096b3efd5edf7de2bd8c758d95a93703
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading

0 comments on commit 83bc2dd

Please sign in to comment.