Skip to content

Commit ee0e3e2

Browse files
Merge branch 'main' into threadpool-merge-scheduler-sort-all-merges-take-2
2 parents feed4ca + 5b90305 commit ee0e3e2

File tree

23 files changed

+586
-256
lines changed

23 files changed

+586
-256
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchBuildCompletePlugin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ private List<File> resolveProjectLogs(File projectDir) {
110110
projectDirFiles.include("**/build/testrun/*/temp/**");
111111
projectDirFiles.include("**/build/**/hs_err_pid*.log");
112112
projectDirFiles.include("**/build/**/replay_pid*.log");
113+
// core dump files are in the working directory of the installation, which is not project specific
114+
projectDirFiles.include("distribution/**/build/install/*/core.*");
113115
projectDirFiles.exclude("**/build/testclusters/**/data/**");
114116
projectDirFiles.exclude("**/build/testclusters/**/distro/**");
115117
projectDirFiles.exclude("**/build/testclusters/**/repo/**");

docs/changelog/121392.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 121392
2+
summary: Include data streams when converting an existing resource to a system resource
3+
area: Infra/Core
4+
type: bug
5+
issues: []

docs/changelog/122390.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122390
2+
summary: Add health indicator impact to `HealthPeriodicLogger`
3+
area: Health
4+
type: enhancement
5+
issues: []

docs/changelog/123155.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 123155
2+
summary: Add `ElasticInferenceServiceCompletionServiceSettings`
3+
area: Machine Learning
4+
type: bug
5+
issues: []

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTree.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,24 @@ private FileAccessTree(FilesEntitlement filesEntitlement, PathLookup pathLookup)
4949
readPaths.sort(String::compareTo);
5050
writePaths.sort(String::compareTo);
5151

52-
this.readPaths = readPaths.toArray(new String[0]);
53-
this.writePaths = writePaths.toArray(new String[0]);
52+
this.readPaths = pruneSortedPaths(readPaths).toArray(new String[0]);
53+
this.writePaths = pruneSortedPaths(writePaths).toArray(new String[0]);
54+
}
55+
56+
private static List<String> pruneSortedPaths(List<String> paths) {
57+
List<String> prunedReadPaths = new ArrayList<>();
58+
if (paths.isEmpty() == false) {
59+
String currentPath = paths.get(0);
60+
prunedReadPaths.add(currentPath);
61+
for (int i = 1; i < paths.size(); ++i) {
62+
String nextPath = paths.get(i);
63+
if (nextPath.startsWith(currentPath) == false) {
64+
prunedReadPaths.add(nextPath);
65+
currentPath = nextPath;
66+
}
67+
}
68+
}
69+
return prunedReadPaths;
5470
}
5571

5672
public static FileAccessTree of(FilesEntitlement filesEntitlement, PathLookup pathLookup) {

libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy/FileAccessTreeTests.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,27 @@ public void testReadWriteUnderRead() {
9696
assertThat(tree.canWrite(path("foo/bar")), is(true));
9797
}
9898

99+
public void testPrunedPaths() {
100+
var tree = accessTree(entitlement("foo", "read", "foo/baz", "read", "foo/bar", "read"));
101+
assertThat(tree.canRead(path("foo")), is(true));
102+
assertThat(tree.canWrite(path("foo")), is(false));
103+
assertThat(tree.canRead(path("foo/bar")), is(true));
104+
assertThat(tree.canWrite(path("foo/bar")), is(false));
105+
assertThat(tree.canRead(path("foo/baz")), is(true));
106+
assertThat(tree.canWrite(path("foo/baz")), is(false));
107+
// also test a non-existent subpath
108+
assertThat(tree.canRead(path("foo/barf")), is(true));
109+
assertThat(tree.canWrite(path("foo/barf")), is(false));
110+
111+
tree = accessTree(entitlement("foo", "read", "foo/bar", "read_write"));
112+
assertThat(tree.canRead(path("foo")), is(true));
113+
assertThat(tree.canWrite(path("foo")), is(false));
114+
assertThat(tree.canRead(path("foo/bar")), is(true));
115+
assertThat(tree.canWrite(path("foo/bar")), is(true));
116+
assertThat(tree.canRead(path("foo/baz")), is(true));
117+
assertThat(tree.canWrite(path("foo/baz")), is(false));
118+
}
119+
99120
public void testReadWithRelativePath() {
100121
for (var dir : List.of("config", "home")) {
101122
var tree = accessTree(entitlement(Map.of("relative_path", "foo", "mode", "read", "relative_to", dir)));

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/ScaledFloatFieldMapperTests.java

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@
3131
import org.elasticsearch.xcontent.XContentBuilder;
3232
import org.elasticsearch.xcontent.XContentFactory;
3333
import org.elasticsearch.xcontent.XContentType;
34-
import org.hamcrest.Matcher;
3534
import org.junit.AssumptionViolatedException;
3635

3736
import java.io.IOException;
3837
import java.util.Collection;
3938
import java.util.Collections;
4039
import java.util.List;
4140
import java.util.Map;
42-
import java.util.function.Function;
4341
import java.util.function.Supplier;
4442
import java.util.stream.Stream;
4543

@@ -48,7 +46,6 @@
4846
import static org.hamcrest.Matchers.empty;
4947
import static org.hamcrest.Matchers.equalTo;
5048
import static org.hamcrest.Matchers.is;
51-
import static org.hamcrest.Matchers.notANumber;
5249

5350
public class ScaledFloatFieldMapperTests extends NumberFieldMapperTests {
5451

@@ -382,7 +379,7 @@ public SyntheticSourceExample example(int maxValues) {
382379
if (randomBoolean()) {
383380
Value v = generateValue();
384381
if (v.malformedOutput == null) {
385-
return new SyntheticSourceExample(v.input, v.output, roundDocValues(v.output), this::mapping);
382+
return new SyntheticSourceExample(v.input, v.output, this::mapping);
386383
}
387384
return new SyntheticSourceExample(v.input, v.malformedOutput, null, this::mapping);
388385
}
@@ -396,9 +393,7 @@ public SyntheticSourceExample example(int maxValues) {
396393
List<Object> outList = Stream.concat(outputFromDocValues.stream(), malformedOutput).toList();
397394
Object out = outList.size() == 1 ? outList.get(0) : outList;
398395

399-
List<Double> outBlockList = outputFromDocValues.stream().map(this::roundDocValues).sorted().toList();
400-
Object outBlock = outBlockList.size() == 1 ? outBlockList.get(0) : outBlockList;
401-
return new SyntheticSourceExample(in, out, outBlock, this::mapping);
396+
return new SyntheticSourceExample(in, out, this::mapping);
402397
}
403398

404399
private record Value(Object input, Double output, Object malformedOutput) {}
@@ -442,16 +437,6 @@ private double round(double d) {
442437
return decoded;
443438
}
444439

445-
private double roundDocValues(double d) {
446-
// Special case due to rounding, see implementation.
447-
if (Math.abs(d) == Double.MAX_VALUE) {
448-
return d;
449-
}
450-
451-
long encoded = Math.round(d * scalingFactor);
452-
return encoded * (1 / scalingFactor);
453-
}
454-
455440
private void mapping(XContentBuilder b) throws IOException {
456441
b.field("type", "scaled_float");
457442
b.field("scaling_factor", scalingFactor);
@@ -475,14 +460,9 @@ public List<SyntheticSourceInvalidExample> invalidExample() throws IOException {
475460
}
476461
}
477462

478-
@Override
479-
protected Function<Object, Object> loadBlockExpected() {
480-
return v -> (Number) v;
481-
}
482-
483-
@Override
484-
protected Matcher<?> blockItemMatcher(Object expected) {
485-
return "NaN".equals(expected) ? notANumber() : equalTo(expected);
463+
protected BlockReaderSupport getSupportedReaders(MapperService mapper, String loaderFieldName) {
464+
assumeTrue("Disabled, tested by ScaledFloatFieldBlockLoaderTests instead", false);
465+
return null;
486466
}
487467

488468
@Override

muted-tests.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,21 @@ tests:
332332
- class: org.elasticsearch.xpack.esql.action.CrossClusterQueryWithPartialResultsIT
333333
method: testPartialResults
334334
issue: https://github.com/elastic/elasticsearch/issues/123101
335-
- class: org.elasticsearch.index.mapper.extras.ScaledFloatFieldMapperTests
336-
method: testBlockLoaderFromRowStrideReader
337-
issue: https://github.com/elastic/elasticsearch/issues/123126
338-
- class: org.elasticsearch.index.mapper.extras.ScaledFloatFieldMapperTests
339-
method: testBlockLoaderFromRowStrideReaderWithSyntheticSource
340-
issue: https://github.com/elastic/elasticsearch/issues/123145
341335
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT
342336
method: testStopQueryLocal
343337
issue: https://github.com/elastic/elasticsearch/issues/121672
338+
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
339+
method: test {yaml=reference/snapshot-restore/restore-snapshot/line_408}
340+
issue: https://github.com/elastic/elasticsearch/issues/123192
341+
- class: org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT
342+
method: testRestoredIndexManagedByLocalPolicySkipsIllegalActions
343+
issue: https://github.com/elastic/elasticsearch/issues/123202
344+
- class: org.elasticsearch.xpack.ilm.TimeSeriesLifecycleActionsIT
345+
method: testHistoryIsWrittenWithFailure
346+
issue: https://github.com/elastic/elasticsearch/issues/123203
347+
- class: org.elasticsearch.xpack.ilm.TimeSeriesDataStreamsIT
348+
method: testSearchableSnapshotAction
349+
issue: https://github.com/elastic/elasticsearch/issues/123214
344350

345351
# Examples:
346352
#

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ static TransportVersion def(int id) {
187187
public static final TransportVersion REMOVE_DESIRED_NODE_VERSION_90 = def(9_000_0_03);
188188
public static final TransportVersion ESQL_DRIVER_TASK_DESCRIPTION_90 = def(9_000_0_04);
189189
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_9_0 = def(9_000_0_05);
190+
public static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90 = def(9_000_0_06);
190191
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED = def(9_001_0_00);
191192
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES = def(9_002_0_00);
192193
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED = def(9_003_0_00);
@@ -201,6 +202,8 @@ static TransportVersion def(int id) {
201202
public static final TransportVersion REMOVE_REPOSITORY_CONFLICT_MESSAGE = def(9_012_0_00);
202203
public static final TransportVersion RERANKER_FAILURES_ALLOWED = def(9_013_0_00);
203204
public static final TransportVersion VOYAGE_AI_INTEGRATION_ADDED = def(9_014_0_00);
205+
public static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES = def(9_015_0_00);
206+
204207
/*
205208
* STOP! READ THIS FIRST! No, really,
206209
* ____ _____ ___ ____ _ ____ _____ _ ____ _____ _ _ ___ ____ _____ ___ ____ ____ _____ _

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,13 @@ public boolean isFailureStoreIndex(String indexName) {
301301
return failureIndices.containsIndex(indexName);
302302
}
303303

304+
/**
305+
* Returns true if the index name provided belongs to this data stream.
306+
*/
307+
public boolean containsIndex(String indexName) {
308+
return backingIndices.containsIndex(indexName) || failureIndices.containsIndex(indexName);
309+
}
310+
304311
public DataStreamOptions getDataStreamOptions() {
305312
return dataStreamOptions;
306313
}
@@ -782,8 +789,9 @@ public DataStream addBackingIndex(Metadata clusterMetadata, Index index) {
782789
// ensure that no aliases reference index
783790
ensureNoAliasesOnIndex(clusterMetadata, index);
784791

785-
List<Index> backingIndices = new ArrayList<>(this.backingIndices.indices);
786-
backingIndices.add(0, index);
792+
List<Index> backingIndices = new ArrayList<>(this.backingIndices.indices.size() + 1);
793+
backingIndices.add(index);
794+
backingIndices.addAll(this.backingIndices.indices);
787795
assert backingIndices.size() == this.backingIndices.indices.size() + 1;
788796
return copy().setBackingIndices(this.backingIndices.copy().setIndices(backingIndices).build())
789797
.setGeneration(generation + 1)
@@ -808,8 +816,9 @@ public DataStream addFailureStoreIndex(Metadata clusterMetadata, Index index) {
808816

809817
ensureNoAliasesOnIndex(clusterMetadata, index);
810818

811-
List<Index> updatedFailureIndices = new ArrayList<>(failureIndices.indices);
812-
updatedFailureIndices.add(0, index);
819+
List<Index> updatedFailureIndices = new ArrayList<>(failureIndices.indices.size() + 1);
820+
updatedFailureIndices.add(index);
821+
updatedFailureIndices.addAll(failureIndices.indices);
813822
assert updatedFailureIndices.size() == failureIndices.indices.size() + 1;
814823
return copy().setFailureIndices(failureIndices.copy().setIndices(updatedFailureIndices).build())
815824
.setGeneration(generation + 1)
@@ -1039,7 +1048,7 @@ private boolean isIndexOlderThan(
10391048
* we return false.
10401049
*/
10411050
public boolean isIndexManagedByDataStreamLifecycle(Index index, Function<String, IndexMetadata> indexMetadataSupplier) {
1042-
if (backingIndices.containsIndex(index.getName()) == false && failureIndices.containsIndex(index.getName()) == false) {
1051+
if (containsIndex(index.getName()) == false) {
10431052
return false;
10441053
}
10451054
IndexMetadata indexMetadata = indexMetadataSupplier.apply(index.getName());

0 commit comments

Comments
 (0)