Skip to content

Commit 58d8ebf

Browse files
committed
Merge branch '9.1' into backport/9.1/pr-130943
2 parents 94e4a97 + c9ec289 commit 58d8ebf

File tree

10 files changed

+703
-7
lines changed

10 files changed

+703
-7
lines changed

README.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ For the complete Elasticsearch documentation visit
275275
https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html[elastic.co].
276276

277277
For information about our documentation processes, see the
278-
xref:docs/README.asciidoc[docs README].
278+
xref:https://github.com/elastic/elasticsearch/blob/main/docs/README.md[docs README].
279279

280280
[[examples]]
281281
== Examples and guides

docs/changelog/130776.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 130776
2+
summary: Fix msearch request parsing when index expression is null
3+
area: Search
4+
type: bug
5+
issues:
6+
- 129631

docs/reference/elasticsearch/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Elasticsearch and index management
1+
# Elasticsearch
22

33
This section contains reference information for {{es}} and index management features.
44

@@ -7,7 +7,7 @@ To learn more about {{es}} features and how to get started, refer to the [{{es}}
77
For more details about query and scripting languages, check these sections:
88
* [Query languages](../query-languages/index.md)
99
* [Scripting languages](../scripting-languages/index.md)
10-
10+
1111
{{es}} also provides the following REST APIs:
1212

1313
* [{{es}} API](https://www.elastic.co/docs/api/doc/elasticsearch)

docs/reference/elasticsearch/rest-apis/index.md

Lines changed: 664 additions & 0 deletions
Large diffs are not rendered by default.

qa/mixed-cluster/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ buildParams.bwcVersions.withWireCompatible { bwcVersion, baseName ->
8989
setting 'health.master_history.no_master_transitions_threshold', '10'
9090
}
9191
requiresFeature 'es.index_mode_feature_flag_registered', Version.fromString("8.0.0")
92+
requiresFeature 'sub_objects_auto', Version.fromString("8.16.0")
9293
if (bwcVersion.before(Version.fromString("8.18.0"))) {
9394
jvmArgs '-da:org.elasticsearch.index.mapper.DocumentMapper'
9495
jvmArgs '-da:org.elasticsearch.index.mapper.MapperService'

server/src/main/java/org/elasticsearch/common/xcontent/support/XContentMapValues.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,9 @@ public static Map<String, Object> nodeMapValue(Object node, String desc) {
560560
* Otherwise the node is treated as a comma-separated string.
561561
*/
562562
public static String[] nodeStringArrayValue(Object node) {
563+
if (node == null) {
564+
throw new ElasticsearchParseException("Expected a list of strings but got null");
565+
}
563566
if (isArray(node)) {
564567
List<?> list = (List<?>) node;
565568
String[] arr = new String[list.size()];

server/src/main/java/org/elasticsearch/index/shard/IndexShard.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,11 +1366,12 @@ public RefreshStats refreshStats() {
13661366
}
13671367

13681368
public FlushStats flushStats() {
1369+
final Engine engine = getEngineOrNull();
13691370
return new FlushStats(
13701371
flushMetric.count(),
13711372
periodicFlushMetric.count(),
13721373
TimeUnit.NANOSECONDS.toMillis(flushMetric.sum()),
1373-
getEngineOrNull() != null ? getEngineOrNull().getTotalFlushTimeExcludingWaitingOnLockInMillis() : 0L
1374+
engine != null ? engine.getTotalFlushTimeExcludingWaitingOnLockInMillis() : 0L
13741375
);
13751376
}
13761377

server/src/test/java/org/elasticsearch/action/search/MultiSearchRequestTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
package org.elasticsearch.action.search;
1111

12+
import org.elasticsearch.ElasticsearchParseException;
1213
import org.elasticsearch.action.support.IndicesOptions;
1314
import org.elasticsearch.common.CheckedBiConsumer;
1415
import org.elasticsearch.common.Strings;
@@ -537,6 +538,14 @@ public void testFailOnExtraCharacters() throws IOException {
537538
}
538539
}
539540

541+
public void testNullIndex() throws IOException {
542+
ElasticsearchParseException e = expectThrows(ElasticsearchParseException.class, () -> parseMultiSearchRequestFromString("""
543+
{"index": null}
544+
{ "query": {"match_all": {}}}
545+
"""));
546+
assertThat(e.getMessage(), containsString("Expected a list of strings but got null"));
547+
}
548+
540549
private static MultiSearchRequest mutate(MultiSearchRequest searchRequest) throws IOException {
541550
MultiSearchRequest mutation = copyRequest(searchRequest);
542551
List<CheckedRunnable<IOException>> mutators = new ArrayList<>();

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DataStreamDeprecationCheckerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void testOldIndicesCheck() {
7878

7979
public void testOldIndicesCheckWithOnlyNewIndices() {
8080
// This tests what happens when any old indices that we have are closed. We expect no deprecation warning.
81-
int newOpenIndexCount = randomIntBetween(0, 100);
81+
int newOpenIndexCount = randomIntBetween(1, 100);
8282
int newClosedIndexCount = randomIntBetween(0, 100);
8383

8484
Map<String, IndexMetadata> nameToIndexMetadata = new HashMap<>();

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/AbstractPageMappingToIteratorOperator.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ public TransportVersion getMinimalSupportedVersion() {
321321
private static class AppendBlocksIterator implements ReleasableIterator<Page> {
322322
private final Page page;
323323
private final ReleasableIterator<Block[]> next;
324+
private boolean closed = false;
324325

325326
private int positionOffset;
326327

@@ -348,7 +349,15 @@ public final Page next() {
348349
for (int b = 0; b < page.getBlockCount(); b++) {
349350
page.getBlock(b).incRef();
350351
}
351-
return page.appendBlocks(read);
352+
final Page result = page.appendBlocks(read);
353+
// We need to release the blocks of the page in this iteration instead of delaying to the next,
354+
// because the blocks of this page are now shared with the output page. The output page can be
355+
// passed to a separate driver, which may run concurrently with this driver, leading to data races
356+
// of references in AbstractNonThreadSafeRefCounted, which is not thread-safe.
357+
// An alternative would be to make RefCounted for Vectors/Blocks thread-safe when they are about
358+
// to be shared with other drivers via #allowPassingToDifferentDriver.
359+
close();
360+
return result;
352361
}
353362
Block[] newBlocks = new Block[page.getBlockCount() + read.length];
354363
System.arraycopy(read, 0, newBlocks, page.getBlockCount(), read.length);
@@ -368,7 +377,10 @@ public final Page next() {
368377

369378
@Override
370379
public void close() {
371-
Releasables.closeExpectNoException(page::releaseBlocks, next);
380+
if (closed == false) {
381+
closed = true;
382+
Releasables.closeExpectNoException(page::releaseBlocks, next);
383+
}
372384
}
373385
}
374386
}

0 commit comments

Comments
 (0)