Skip to content

Commit a35c667

Browse files
authored
Merge branch 'main' into opex-product-fix-490
2 parents 383c976 + 56becc5 commit a35c667

File tree

9 files changed

+113
-29
lines changed

9 files changed

+113
-29
lines changed

muted-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ tests:
213213
- class: org.elasticsearch.cluster.service.MasterServiceTests
214214
method: testThreadContext
215215
issue: https://github.com/elastic/elasticsearch/issues/118914
216-
- class: org.elasticsearch.repositories.blobstore.testkit.analyze.SecureHdfsRepositoryAnalysisRestIT
217-
issue: https://github.com/elastic/elasticsearch/issues/118970
218216
- class: org.elasticsearch.aggregations.bucket.SearchCancellationIT
219217
method: testCancellationDuringTimeSeriesAggregation
220218
issue: https://github.com/elastic/elasticsearch/issues/118992

rest-api-spec/build.gradle

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,5 @@ tasks.named("yamlRestCompatTestTransform").configure ({ task ->
5959
task.replaceValueInMatch("profile.shards.0.dfs.knn.0.query.0.description", "DocAndScoreQuery[0,...][0.009673266,...],0.009673266", "dfs knn vector profiling with vector_operations_count")
6060
task.skipTest("cat.aliases/10_basic/Deprecated local parameter", "CAT APIs not covered by compatibility policy")
6161
task.skipTest("cat.shards/10_basic/Help", "sync_id is removed in 9.0")
62-
task.skipTest("tsdb/20_mapping/exact match object type", "skip until pr/116687 gets backported")
63-
task.skipTest("tsdb/25_id_generation/delete over _bulk", "skip until pr/116687 gets backported")
64-
task.skipTest("tsdb/80_index_resize/split", "skip until pr/116687 gets backported")
65-
task.skipTest("tsdb/90_unsupported_operations/noop update", "skip until pr/116687 gets backported")
66-
task.skipTest("tsdb/90_unsupported_operations/regular update", "skip until pr/116687 gets backported")
67-
task.skipTest("tsdb/90_unsupported_operations/search with routing", "skip until pr/116687 gets backported")
68-
task.skipTest("tsdb/90_unsupported_operations/index with routing over _bulk", "skip until pr/116687 gets backported")
69-
task.skipTest("tsdb/90_unsupported_operations/update over _bulk", "skip until pr/116687 gets backported")
70-
task.skipTest("tsdb/90_unsupported_operations/index with routing", "skip until pr/116687 gets backported")
7162
task.skipTest("search/500_date_range/from, to, include_lower, include_upper deprecated", "deprecated parameters are removed in 9.0")
72-
task.skipTest("tsdb/20_mapping/stored source is supported", "no longer serialize source_mode")
73-
task.skipTest("tsdb/20_mapping/Synthetic source", "no longer serialize source_mode")
74-
task.skipTest("logsdb/10_settings/create logs index", "no longer serialize source_mode")
75-
task.skipTest("logsdb/20_source_mapping/stored _source mode is supported", "no longer serialize source_mode")
76-
task.skipTest("logsdb/20_source_mapping/include/exclude is supported with stored _source", "no longer serialize source_mode")
77-
task.skipTest("logsdb/20_source_mapping/synthetic _source is default", "no longer serialize source_mode")
78-
task.skipTest("search/520_fetch_fields/fetch _seq_no via fields", "error code is changed from 5xx to 400 in 9.0")
79-
task.skipTest("search.vectors/41_knn_search_bbq_hnsw/Test knn search", "Scoring has changed in latest versions")
80-
task.skipTest("search.vectors/42_knn_search_bbq_flat/Test knn search", "Scoring has changed in latest versions")
81-
task.skipTest("synonyms/90_synonyms_reloading_for_synset/Reload analyzers for specific synonym set", "Can't work until auto-expand replicas is 0-1 for synonyms index")
82-
task.skipTest("search/90_search_after/_shard_doc sort", "restriction has been lifted in latest versions")
8363
})

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/changepoint/ChangeDetector.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private TestStats testTrendVs(TestStats H0, double[] values, double[] weights) {
189189
private TestStats testStepChangeVs(TestStats H0, double[] values, double[] weights, int[] candidateChangePoints) {
190190

191191
double vStep = Double.MAX_VALUE;
192-
int changePoint = -1;
192+
int changePoint = ChangeType.NO_CHANGE_POINT;
193193

194194
// Initialize running stats so that they are only missing the individual changepoint values
195195
RunningStats lowerRange = new RunningStats();
@@ -226,7 +226,7 @@ private TestStats testStepChangeVs(TestStats H0, double[] values, double[] weigh
226226
private TestStats testTrendChangeVs(TestStats H0, double[] values, double[] weights, int[] candidateChangePoints) {
227227

228228
double vChange = Double.MAX_VALUE;
229-
int changePoint = -1;
229+
int changePoint = ChangeType.NO_CHANGE_POINT;
230230

231231
// Initialize running stats so that they are only missing the individual changepoint values
232232
RunningStats lowerRange = new RunningStats();
@@ -349,7 +349,7 @@ private TestStats testDistributionChange(
349349
) {
350350

351351
double maxDiff = 0.0;
352-
int changePoint = -1;
352+
int changePoint = ChangeType.NO_CHANGE_POINT;
353353

354354
// Initialize running stats so that they are only missing the individual changepoint values
355355
RunningStats lowerRange = new RunningStats();
@@ -378,10 +378,12 @@ private TestStats testDistributionChange(
378378
// before we run the tests.
379379
SampleData sampleData = sample(values, weights, discoveredChangePoints);
380380
final double[] sampleValues = sampleData.values();
381-
final double[] sampleWeights = sampleData.weights();
382381

383382
double pValue = 1;
384383
for (int cp : sampleData.changePoints()) {
384+
if (cp == ChangeType.NO_CHANGE_POINT) {
385+
continue;
386+
}
385387
double[] x = Arrays.copyOfRange(sampleValues, 0, cp);
386388
double[] y = Arrays.copyOfRange(sampleValues, cp, sampleValues.length);
387389
double statistic = KOLMOGOROV_SMIRNOV_TEST.kolmogorovSmirnovStatistic(x, y);
@@ -451,7 +453,7 @@ private record TestStats(Type type, double pValue, double var, double nParams, i
451453
}
452454

453455
TestStats(Type type, double pValue, double var, double nParams, DataStats dataStats) {
454-
this(type, pValue, var, nParams, -1, dataStats);
456+
this(type, pValue, var, nParams, ChangeType.NO_CHANGE_POINT, dataStats);
455457
}
456458

457459
boolean accept(double pValueThreshold) {

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/changepoint/ChangePointAggregator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public InternalAggregation doReduce(InternalAggregations aggregations, Aggregati
4747
ChangeType change = ChangePointDetector.getChangeType(bucketValues);
4848

4949
ChangePointBucket changePointBucket = null;
50-
if (change.changePoint() >= 0) {
50+
if (change.changePoint() != ChangeType.NO_CHANGE_POINT) {
5151
changePointBucket = extractBucket(bucketsPaths()[0], aggregations, change.changePoint()).map(
5252
b -> new ChangePointBucket(b.getKey(), b.getDocCount(), b.getAggregations())
5353
).orElse(null);

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/changepoint/ChangeType.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
*/
2222
public interface ChangeType extends NamedWriteable, NamedXContentObject {
2323

24+
int NO_CHANGE_POINT = -1;
25+
2426
default int changePoint() {
25-
return -1;
27+
return NO_CHANGE_POINT;
2628
}
2729

2830
default double pValue() {

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/aggs/changepoint/ChangeDetectorTests.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.concurrent.atomic.AtomicInteger;
1818
import java.util.stream.DoubleStream;
1919

20+
import static org.hamcrest.Matchers.equalTo;
2021
import static org.hamcrest.Matchers.greaterThan;
2122
import static org.hamcrest.Matchers.instanceOf;
2223
import static org.hamcrest.Matchers.lessThan;
@@ -243,4 +244,14 @@ public void testProblemDistributionChange() {
243244
ChangeType type = new ChangeDetector(bucketValues).detect(0.05);
244245
assertThat(type, instanceOf(ChangeType.DistributionChange.class));
245246
}
247+
248+
public void testUncertainNonStationary() {
249+
MlAggsHelper.DoubleBucketValues bucketValues = new MlAggsHelper.DoubleBucketValues(
250+
null,
251+
new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 700, 735, 715 }
252+
);
253+
ChangeType type = new ChangeDetector(bucketValues).detect(0.01);
254+
assertThat(type, instanceOf(ChangeType.NonStationary.class));
255+
assertThat(((ChangeType.NonStationary) type).getTrend(), equalTo("increasing"));
256+
}
246257
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
package org.elasticsearch.oldrepos.searchablesnapshot;
9+
10+
import org.elasticsearch.test.cluster.util.Version;
11+
12+
public class MountFromVersion5IT extends SearchableSnapshotTestCase {
13+
14+
public MountFromVersion5IT(Version version) {
15+
super(version);
16+
}
17+
18+
public void testSearchableSnapshot() throws Exception {
19+
verifyCompatibility("5");
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
package org.elasticsearch.oldrepos.searchablesnapshot;
9+
10+
import org.elasticsearch.test.cluster.util.Version;
11+
12+
public class MountFromVersion6IT extends SearchableSnapshotTestCase {
13+
14+
public MountFromVersion6IT(Version version) {
15+
super(version);
16+
}
17+
18+
public void testSearchableSnapshot() throws Exception {
19+
verifyCompatibility("6");
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
package org.elasticsearch.oldrepos.searchablesnapshot;
9+
10+
import org.elasticsearch.client.Request;
11+
import org.elasticsearch.client.RestClient;
12+
import org.elasticsearch.common.Strings;
13+
import org.elasticsearch.oldrepos.AbstractUpgradeCompatibilityTestCase;
14+
import org.elasticsearch.test.cluster.util.Version;
15+
16+
import static org.elasticsearch.test.rest.ObjectPath.createFromResponse;
17+
18+
/**
19+
* Test suite for Archive indices backward compatibility with N-2 versions.
20+
* The test suite creates a cluster in the N-1 version, where N is the current version.
21+
* Restores snapshots from old-clusters (version 5/6) and upgrades it to the current version.
22+
* Test methods are executed after each upgrade.
23+
*/
24+
public class SearchableSnapshotTestCase extends AbstractUpgradeCompatibilityTestCase {
25+
26+
static {
27+
clusterConfig = config -> config.setting("xpack.license.self_generated.type", "trial");
28+
}
29+
30+
public SearchableSnapshotTestCase(Version version) {
31+
super(version);
32+
}
33+
34+
/**
35+
* Overrides the snapshot-restore operation for archive-indices scenario.
36+
*/
37+
@Override
38+
public void recover(RestClient client, String repository, String snapshot, String index) throws Exception {
39+
var request = new Request("POST", "/_snapshot/" + repository + "/" + snapshot + "/_mount");
40+
request.addParameter("wait_for_completion", "true");
41+
request.addParameter("storage", "full_copy");
42+
request.setJsonEntity(Strings.format("""
43+
{
44+
"index": "%s",
45+
"renamed_index": "%s"
46+
}""", index, index));
47+
createFromResponse(client.performRequest(request));
48+
}
49+
}

0 commit comments

Comments
 (0)