Skip to content

Commit d358511

Browse files
committed
Merge branch 'main' into entitlements/test_refactor3
2 parents c43b2b8 + c3f7520 commit d358511

File tree

55 files changed

+1813
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1813
-381
lines changed

docs/changelog/117176.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 117176
2+
summary: Integrate IBM watsonx to Inference API for re-ranking task
3+
area: Experiences
4+
type: enhancement
5+
issues: []

docs/changelog/121260.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 121260
2+
summary: Introduce a pre-mapping logical plan processing step
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/src/yamlRestTest/java/org/elasticsearch/smoketest/DocsClientYamlTestSuiteIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ protected boolean isWatcherTest() {
286286

287287
/**
288288
* Compares the results of running two analyzers against many random
289-
* strings. The goal is to figure out if two anlayzers are "the same" by
289+
* strings. The goal is to figure out if two analyzers are "the same" by
290290
* comparing their results. This is far from perfect but should be fairly
291291
* accurate, especially for gross things like missing {@code decimal_digit}
292292
* token filters, and should be fairly fast because it compares a fairly

libs/entitlement/src/main/java/org/elasticsearch/entitlement/bootstrap/EntitlementBootstrap.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,22 @@
3131

3232
public class EntitlementBootstrap {
3333

34-
public record BootstrapArgs(Map<String, Policy> pluginPolicies, Function<Class<?>, String> pluginResolver) {
34+
public record BootstrapArgs(
35+
Map<String, Policy> pluginPolicies,
36+
Function<Class<?>, String> pluginResolver,
37+
Path[] dataDirs,
38+
Path configDir,
39+
Path tempDir
40+
) {
3541
public BootstrapArgs {
3642
requireNonNull(pluginPolicies);
3743
requireNonNull(pluginResolver);
44+
requireNonNull(dataDirs);
45+
if (dataDirs.length == 0) {
46+
throw new IllegalArgumentException("must provide at least one data directory");
47+
}
48+
requireNonNull(configDir);
49+
requireNonNull(tempDir);
3850
}
3951
}
4052

@@ -50,13 +62,22 @@ public static BootstrapArgs bootstrapArgs() {
5062
*
5163
* @param pluginPolicies a map holding policies for plugins (and modules), by plugin (or module) name.
5264
* @param pluginResolver a functor to map a Java Class to the plugin it belongs to (the plugin name).
65+
* @param dataDirs data directories for Elasticsearch
66+
* @param configDir the config directory for Elasticsearch
67+
* @param tempDir the temp directory for Elasticsearch
5368
*/
54-
public static void bootstrap(Map<String, Policy> pluginPolicies, Function<Class<?>, String> pluginResolver) {
69+
public static void bootstrap(
70+
Map<String, Policy> pluginPolicies,
71+
Function<Class<?>, String> pluginResolver,
72+
Path[] dataDirs,
73+
Path configDir,
74+
Path tempDir
75+
) {
5576
logger.debug("Loading entitlement agent");
5677
if (EntitlementBootstrap.bootstrapArgs != null) {
5778
throw new IllegalStateException("plugin data is already set");
5879
}
59-
EntitlementBootstrap.bootstrapArgs = new BootstrapArgs(pluginPolicies, pluginResolver);
80+
EntitlementBootstrap.bootstrapArgs = new BootstrapArgs(pluginPolicies, pluginResolver, dataDirs, configDir, tempDir);
6081
exportInitializationToAgent();
6182
loadAgent(findAgentJar());
6283
selfTest();

muted-tests.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,6 @@ tests:
231231
- class: org.elasticsearch.datastreams.DataStreamsClientYamlTestSuiteIT
232232
method: test {p0=data_stream/140_data_stream_aliases/Create data stream aliases using wildcard expression}
233233
issue: https://github.com/elastic/elasticsearch/issues/120890
234-
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
235-
method: test {p0=ml/inference_crud/*}
236-
issue: https://github.com/elastic/elasticsearch/issues/120816
237234
- class: org.elasticsearch.xpack.security.authc.service.ServiceAccountIT
238235
method: testAuthenticateShouldNotFallThroughInCaseOfFailure
239236
issue: https://github.com/elastic/elasticsearch/issues/120902
@@ -330,6 +327,10 @@ tests:
330327
method: testCrossClusterAsyncQueryStop
331328
issue: https://github.com/elastic/elasticsearch/issues/121249
332329
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
330+
method: test {p0=transform/*}
331+
issue: https://github.com/elastic/elasticsearch/issues/120816
332+
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
333+
method: test {p0=ml/*}
333334
issue: https://github.com/elastic/elasticsearch/issues/120816
334335
- class: org.elasticsearch.upgrades.VectorSearchIT
335336
method: testBBQVectorSearch {upgradedNodes=0}
@@ -359,12 +360,6 @@ tests:
359360
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
360361
method: test {yaml=indices.get_alias/10_basic/Get aliases via /*/_alias/}
361362
issue: https://github.com/elastic/elasticsearch/issues/121290
362-
- class: org.elasticsearch.xpack.inference.action.TransportInferenceActionTests
363-
method: testRerouting_HandlesTransportException_FromOtherNode
364-
issue: https://github.com/elastic/elasticsearch/issues/121292
365-
- class: org.elasticsearch.xpack.inference.action.TransportInferenceActionTests
366-
method: testRerouting_ToOtherNode
367-
issue: https://github.com/elastic/elasticsearch/issues/121293
368363
- class: org.elasticsearch.xpack.inference.common.InferenceServiceNodeLocalRateLimitCalculatorTests
369364
issue: https://github.com/elastic/elasticsearch/issues/121294
370365
- class: org.elasticsearch.env.NodeEnvironmentTests
@@ -391,6 +386,9 @@ tests:
391386
- class: org.elasticsearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT
392387
method: test {yaml=search.vectors/42_knn_search_int4_flat/Vector similarity with filter only}
393388
issue: https://github.com/elastic/elasticsearch/issues/121350
389+
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
390+
method: test {p0=search.vectors/42_knn_search_int4_flat/KNN Vector similarity search only}
391+
issue: https://github.com/elastic/elasticsearch/issues/121395
394392

395393
# Examples:
396394
#
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.action.admin.indices.mapping.put;
11+
12+
import org.apache.logging.log4j.Level;
13+
import org.elasticsearch.action.support.master.AcknowledgedResponse;
14+
import org.elasticsearch.test.ESSingleNodeTestCase;
15+
import org.elasticsearch.test.MockLog;
16+
import org.elasticsearch.test.junit.annotations.TestLogging;
17+
18+
import static org.hamcrest.Matchers.equalTo;
19+
20+
public class PutMappingIT extends ESSingleNodeTestCase {
21+
22+
@TestLogging(
23+
reason = "testing DEBUG logging",
24+
value = "org.elasticsearch.action.admin.indices.mapping.put.TransportPutMappingAction:DEBUG"
25+
)
26+
public void testFailureLogging() {
27+
final var indexName = randomIdentifier();
28+
createIndex(indexName);
29+
final var fieldName = randomIdentifier();
30+
safeGet(client().execute(TransportPutMappingAction.TYPE, new PutMappingRequest(indexName).source(fieldName, "type=keyword")));
31+
MockLog.assertThatLogger(
32+
() -> assertThat(
33+
asInstanceOf(
34+
IllegalArgumentException.class,
35+
safeAwaitFailure(
36+
AcknowledgedResponse.class,
37+
l -> client().execute(
38+
TransportPutMappingAction.TYPE,
39+
new PutMappingRequest(indexName).source(fieldName, "type=long"),
40+
l
41+
)
42+
)
43+
).getMessage(),
44+
equalTo("mapper [" + fieldName + "] cannot be changed from type [keyword] to [long]")
45+
),
46+
TransportPutMappingAction.class,
47+
new MockLog.SeenEventExpectation(
48+
"failure message",
49+
TransportPutMappingAction.class.getCanonicalName(),
50+
Level.DEBUG,
51+
"failed to put mappings on indices [[" + indexName
52+
)
53+
);
54+
}
55+
}

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ static TransportVersion def(int id) {
171171
public static final TransportVersion LINEAR_RETRIEVER_SUPPORT = def(8_837_00_0);
172172
public static final TransportVersion TIMEOUT_GET_PARAM_FOR_RESOLVE_CLUSTER = def(8_838_00_0);
173173
public static final TransportVersion INFERENCE_REQUEST_ADAPTIVE_RATE_LIMITING = def(8_839_00_0);
174+
public static final TransportVersion ML_INFERENCE_IBM_WATSONX_RERANK_ADDED = def(8_840_00_0);
174175

175176
/*
176177
* STOP! READ THIS FIRST! No, really,

server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import org.elasticsearch.threadpool.ThreadPool;
3737
import org.elasticsearch.transport.TransportService;
3838

39-
import java.io.IOException;
4039
import java.util.ArrayList;
4140
import java.util.Arrays;
4241
import java.util.List;
@@ -126,7 +125,7 @@ protected void masterOperation(
126125

127126
performMappingUpdate(concreteIndices, request, listener, metadataMappingService, false);
128127
} catch (IndexNotFoundException ex) {
129-
logger.debug(() -> "failed to put mappings on indices [" + Arrays.asList(request.indices() + "]"), ex);
128+
logger.debug(() -> "failed to put mappings on indices " + Arrays.toString(request.indices()), ex);
130129
throw ex;
131130
}
132131
}
@@ -162,25 +161,21 @@ static void performMappingUpdate(
162161
MetadataMappingService metadataMappingService,
163162
boolean autoUpdate
164163
) {
165-
final ActionListener<AcknowledgedResponse> wrappedListener = listener.delegateResponse((l, e) -> {
166-
logger.debug(() -> "failed to put mappings on indices [" + Arrays.asList(concreteIndices) + "]", e);
164+
ActionListener.run(listener.delegateResponse((l, e) -> {
165+
logger.debug(() -> "failed to put mappings on indices " + Arrays.toString(concreteIndices), e);
167166
l.onFailure(e);
168-
});
169-
final PutMappingClusterStateUpdateRequest updateRequest;
170-
try {
171-
updateRequest = new PutMappingClusterStateUpdateRequest(
172-
request.masterNodeTimeout(),
173-
request.ackTimeout(),
174-
request.source(),
175-
autoUpdate,
176-
concreteIndices
177-
);
178-
} catch (IOException e) {
179-
wrappedListener.onFailure(e);
180-
return;
181-
}
182-
183-
metadataMappingService.putMapping(updateRequest, wrappedListener);
167+
}),
168+
wrappedListener -> metadataMappingService.putMapping(
169+
new PutMappingClusterStateUpdateRequest(
170+
request.masterNodeTimeout(),
171+
request.ackTimeout(),
172+
request.source(),
173+
autoUpdate,
174+
concreteIndices
175+
),
176+
wrappedListener
177+
)
178+
);
184179
}
185180

186181
static String checkForFailureStoreViolations(ClusterState clusterState, Index[] concreteIndices, PutMappingRequest request) {

server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,13 @@ private static void initPhase2(Bootstrap bootstrap) throws IOException {
242242
pluginsLoader = PluginsLoader.createPluginsLoader(modulesBundles, pluginsBundles, findPluginsWithNativeAccess(pluginPolicies));
243243

244244
var pluginsResolver = PluginsResolver.create(pluginsLoader);
245-
EntitlementBootstrap.bootstrap(pluginPolicies, pluginsResolver::resolveClassToPluginName);
245+
EntitlementBootstrap.bootstrap(
246+
pluginPolicies,
247+
pluginsResolver::resolveClassToPluginName,
248+
nodeEnv.dataFiles(),
249+
nodeEnv.configFile(),
250+
nodeEnv.tmpFile()
251+
);
246252
} else if (RuntimeVersionFeature.isSecurityManagerAvailable()) {
247253
// no need to explicitly enable native access for legacy code
248254
pluginsLoader = PluginsLoader.createPluginsLoader(modulesBundles, pluginsBundles, Map.of());

server/src/main/java/org/elasticsearch/cluster/metadata/MetadataMappingService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class MetadataMappingService {
5656
public MetadataMappingService(ClusterService clusterService, IndicesService indicesService) {
5757
this.clusterService = clusterService;
5858
this.indicesService = indicesService;
59-
taskQueue = clusterService.createTaskQueue("put-mapping", Priority.HIGH, new PutMappingExecutor());
59+
this.taskQueue = clusterService.createTaskQueue("put-mapping", Priority.HIGH, new PutMappingExecutor());
6060
}
6161

6262
record PutMappingClusterStateUpdateTask(PutMappingClusterStateUpdateRequest request, ActionListener<AcknowledgedResponse> listener)

0 commit comments

Comments
 (0)