Skip to content

Commit 89f3497

Browse files
author
elasticsearchmachine
committed
Merge remote-tracking branch 'origin/main' into lucene_snapshot
2 parents b305e4e + 60de8ed commit 89f3497

File tree

8 files changed

+37
-95
lines changed

8 files changed

+37
-95
lines changed

docs/reference/esql/functions/kibana/definition/repeat.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/esql/functions/kibana/docs/repeat.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

muted-tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ tests:
299299
- class: org.elasticsearch.xpack.logsdb.qa.StandardVersusLogsIndexModeRandomDataDynamicMappingChallengeRestIT
300300
method: testMatchAllQuery
301301
issue: https://github.com/elastic/elasticsearch/issues/116536
302+
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
303+
method: test {p0=ml/inference_crud/Test force delete given model referenced by pipeline}
304+
issue: https://github.com/elastic/elasticsearch/issues/116555
305+
- class: org.elasticsearch.search.basic.SearchWithRandomIOExceptionsIT
306+
method: testRandomDirectoryIOExceptions
307+
issue: https://github.com/elastic/elasticsearch/issues/114824
302308

303309
# Examples:
304310
#

server/src/internalClusterTest/java/org/elasticsearch/indexing/IndexActionIT.java

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.elasticsearch.index.mapper.DocumentParsingException;
1818
import org.elasticsearch.indices.InvalidIndexNameException;
1919
import org.elasticsearch.test.ESIntegTestCase;
20-
import org.elasticsearch.test.hamcrest.ElasticsearchAssertions;
2120

2221
import java.util.ArrayList;
2322
import java.util.List;
@@ -28,7 +27,7 @@
2827
import java.util.concurrent.Executors;
2928
import java.util.concurrent.atomic.AtomicIntegerArray;
3029

31-
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertResponse;
30+
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
3231
import static org.hamcrest.Matchers.containsString;
3332
import static org.hamcrest.Matchers.equalTo;
3433
import static org.hamcrest.Matchers.lessThanOrEqualTo;
@@ -42,7 +41,6 @@ public class IndexActionIT extends ESIntegTestCase {
4241
public void testAutoGenerateIdNoDuplicates() throws Exception {
4342
int numberOfIterations = scaledRandomIntBetween(10, 50);
4443
for (int i = 0; i < numberOfIterations; i++) {
45-
Exception firstError = null;
4644
createIndex("test");
4745
int numOfDocs = randomIntBetween(10, 100);
4846
logger.info("indexing [{}] docs", numOfDocs);
@@ -52,51 +50,9 @@ public void testAutoGenerateIdNoDuplicates() throws Exception {
5250
}
5351
indexRandom(true, builders);
5452
logger.info("verifying indexed content");
55-
int numOfChecks = randomIntBetween(8, 12);
53+
int numOfChecks = randomIntBetween(16, 24);
5654
for (int j = 0; j < numOfChecks; j++) {
57-
try {
58-
logger.debug("running search with all types");
59-
assertResponse(prepareSearch("test"), response -> {
60-
if (response.getHits().getTotalHits().value() != numOfDocs) {
61-
final String message = "Count is "
62-
+ response.getHits().getTotalHits().value()
63-
+ " but "
64-
+ numOfDocs
65-
+ " was expected. "
66-
+ ElasticsearchAssertions.formatShardStatus(response);
67-
logger.error("{}. search response: \n{}", message, response);
68-
fail(message);
69-
}
70-
});
71-
} catch (Exception e) {
72-
logger.error("search for all docs types failed", e);
73-
if (firstError == null) {
74-
firstError = e;
75-
}
76-
}
77-
try {
78-
logger.debug("running search with a specific type");
79-
assertResponse(prepareSearch("test"), response -> {
80-
if (response.getHits().getTotalHits().value() != numOfDocs) {
81-
final String message = "Count is "
82-
+ response.getHits().getTotalHits().value()
83-
+ " but "
84-
+ numOfDocs
85-
+ " was expected. "
86-
+ ElasticsearchAssertions.formatShardStatus(response);
87-
logger.error("{}. search response: \n{}", message, response);
88-
fail(message);
89-
}
90-
});
91-
} catch (Exception e) {
92-
logger.error("search for all docs of a specific type failed", e);
93-
if (firstError == null) {
94-
firstError = e;
95-
}
96-
}
97-
}
98-
if (firstError != null) {
99-
fail(firstError.getMessage());
55+
assertHitCount(prepareSearch("test"), numOfDocs);
10056
}
10157
internalCluster().wipeIndices("test");
10258
}
@@ -147,16 +103,13 @@ public void testCreatedFlagParallelExecution() throws Exception {
147103
List<Callable<Void>> tasks = new ArrayList<>(taskCount);
148104
final Random random = random();
149105
for (int i = 0; i < taskCount; i++) {
150-
tasks.add(new Callable<Void>() {
151-
@Override
152-
public Void call() throws Exception {
153-
int docId = random.nextInt(docCount);
154-
DocWriteResponse indexResponse = indexDoc("test", Integer.toString(docId), "field1", "value");
155-
if (indexResponse.getResult() == DocWriteResponse.Result.CREATED) {
156-
createdCounts.incrementAndGet(docId);
157-
}
158-
return null;
106+
tasks.add(() -> {
107+
int docId = random.nextInt(docCount);
108+
DocWriteResponse indexResponse = indexDoc("test", Integer.toString(docId), "field1", "value");
109+
if (indexResponse.getResult() == DocWriteResponse.Result.CREATED) {
110+
createdCounts.incrementAndGet(docId);
159111
}
112+
return null;
160113
});
161114
}
162115

server/src/main/java/org/elasticsearch/action/search/TransportOpenPointInTimeAction.java

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
2929
import org.elasticsearch.common.io.stream.StreamInput;
3030
import org.elasticsearch.common.io.stream.StreamOutput;
31-
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
3231
import org.elasticsearch.common.util.concurrent.EsExecutors;
3332
import org.elasticsearch.core.TimeValue;
3433
import org.elasticsearch.index.shard.ShardId;
@@ -257,16 +256,17 @@ protected void executePhaseOnShard(
257256
SearchShardTarget shard,
258257
SearchActionListener<SearchPhaseResult> phaseListener
259258
) {
260-
final ShardOpenReaderRequest shardRequest = new ShardOpenReaderRequest(
261-
shardIt.shardId(),
262-
shardIt.getOriginalIndices(),
263-
pitRequest.keepAlive()
264-
);
265-
Transport.Connection connection = connectionLookup.apply(shardIt.getClusterAlias(), shard.getNodeId());
259+
final Transport.Connection connection;
260+
try {
261+
connection = connectionLookup.apply(shardIt.getClusterAlias(), shard.getNodeId());
262+
} catch (Exception e) {
263+
phaseListener.onFailure(e);
264+
return;
265+
}
266266
transportService.sendChildRequest(
267267
connection,
268268
OPEN_SHARD_READER_CONTEXT_NAME,
269-
shardRequest,
269+
new ShardOpenReaderRequest(shardIt.shardId(), shardIt.getOriginalIndices(), pitRequest.keepAlive()),
270270
task,
271271
new ActionListenerResponseHandler<>(
272272
phaseListener,
@@ -279,29 +279,9 @@ protected void executePhaseOnShard(
279279
@Override
280280
protected SearchPhase getNextPhase() {
281281
return new SearchPhase(getName()) {
282-
283-
private void onExecuteFailure(Exception e) {
284-
onPhaseFailure(this, "sending response failed", e);
285-
}
286-
287282
@Override
288283
public void run() {
289-
execute(new AbstractRunnable() {
290-
@Override
291-
public void onFailure(Exception e) {
292-
onExecuteFailure(e);
293-
}
294-
295-
@Override
296-
protected void doRun() {
297-
sendSearchResponse(SearchResponseSections.EMPTY_WITH_TOTAL_HITS, results.getAtomicArray());
298-
}
299-
300-
@Override
301-
public boolean isForceExecution() {
302-
return true; // we already created the PIT, no sense in rejecting the task that sends the response.
303-
}
304-
});
284+
sendSearchResponse(SearchResponseSections.EMPTY_WITH_TOTAL_HITS, results.getAtomicArray());
305285
}
306286
};
307287
}

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,10 @@ Index[] concreteIndices(Context context, String... indexExpressions) {
402402
resolveIndicesForDataStream(context, dataStream, concreteIndicesResult);
403403
}
404404
} else {
405-
for (Index index : indexAbstraction.getIndices()) {
406-
if (shouldTrackConcreteIndex(context, context.getOptions(), index)) {
405+
List<Index> indices = indexAbstraction.getIndices();
406+
for (int i = 0, n = indices.size(); i < n; i++) {
407+
Index index = indices.get(i);
408+
if (shouldTrackConcreteIndex(context, index)) {
407409
concreteIndicesResult.add(index);
408410
}
409411
}
@@ -421,7 +423,7 @@ Index[] concreteIndices(Context context, String... indexExpressions) {
421423
private static void resolveIndicesForDataStream(Context context, DataStream dataStream, Set<Index> concreteIndicesResult) {
422424
if (shouldIncludeRegularIndices(context.getOptions())) {
423425
for (Index index : dataStream.getIndices()) {
424-
if (shouldTrackConcreteIndex(context, context.getOptions(), index)) {
426+
if (shouldTrackConcreteIndex(context, index)) {
425427
concreteIndicesResult.add(index);
426428
}
427429
}
@@ -430,7 +432,7 @@ private static void resolveIndicesForDataStream(Context context, DataStream data
430432
// We short-circuit here, if failure indices are not allowed and they can be skipped
431433
if (context.getOptions().allowFailureIndices() || context.getOptions().ignoreUnavailable() == false) {
432434
for (Index index : dataStream.getFailureIndices().getIndices()) {
433-
if (shouldTrackConcreteIndex(context, context.getOptions(), index)) {
435+
if (shouldTrackConcreteIndex(context, index)) {
434436
concreteIndicesResult.add(index);
435437
}
436438
}
@@ -565,7 +567,7 @@ private static IndexNotFoundException notFoundException(String... indexExpressio
565567
return infe;
566568
}
567569

568-
private static boolean shouldTrackConcreteIndex(Context context, IndicesOptions options, Index index) {
570+
private static boolean shouldTrackConcreteIndex(Context context, Index index) {
569571
if (context.systemIndexAccessLevel == SystemIndexAccessLevel.BACKWARDS_COMPATIBLE_ONLY
570572
&& context.netNewSystemIndexPredicate.test(index.getName())) {
571573
// Exclude this one as it's a net-new system index, and we explicitly don't want those.
@@ -575,7 +577,7 @@ private static boolean shouldTrackConcreteIndex(Context context, IndicesOptions
575577
DataStream parentDataStream = context.getState().metadata().getIndicesLookup().get(index.getName()).getParentDataStream();
576578
if (parentDataStream != null && parentDataStream.isFailureStoreEnabled()) {
577579
if (parentDataStream.isFailureStoreIndex(index.getName())) {
578-
if (options.ignoreUnavailable()) {
580+
if (context.options.ignoreUnavailable()) {
579581
return false;
580582
} else {
581583
throw new FailureIndexNotSupportedException(index);
@@ -585,6 +587,7 @@ private static boolean shouldTrackConcreteIndex(Context context, IndicesOptions
585587
}
586588
final IndexMetadata imd = context.state.metadata().index(index);
587589
if (imd.getState() == IndexMetadata.State.CLOSE) {
590+
IndicesOptions options = context.options;
588591
if (options.forbidClosedIndices() && options.ignoreUnavailable() == false) {
589592
throw new IndexClosedException(index);
590593
} else {

x-pack/plugin/esql/qa/testFixtures/src/main/resources/string.csv-spec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1655,8 +1655,9 @@ repeat
16551655
required_capability: repeat
16561656
// tag::repeat[]
16571657
ROW a = "Hello!"
1658-
| EVAL triple_a = REPEAT(a, 3);
1658+
| EVAL triple_a = REPEAT(a, 3)
16591659
// end::repeat[]
1660+
;
16601661

16611662
// tag::repeat-result[]
16621663
a:keyword | triple_a:keyword

x-pack/plugin/security/qa/security-basic/src/javaRestTest/java/org/elasticsearch/xpack/security/SecurityWithBasicLicenseIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
public class SecurityWithBasicLicenseIT extends SecurityInBasicRestTestCase {
3131

32-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/99169")
3332
public void testWithBasicLicense() throws Exception {
3433
checkLicenseType("basic");
3534
checkSecurityEnabled(false);

0 commit comments

Comments
 (0)