Skip to content

Commit 1e08b57

Browse files
Merge branch 'main' into feature/timestamp-doc-values-spars-index-setting
2 parents cc24182 + e8bbf27 commit 1e08b57

File tree

4 files changed

+26
-69
lines changed

4 files changed

+26
-69
lines changed

muted-tests.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,6 @@ tests:
254254
- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT
255255
method: testFileSettingsReprocessedOnRestartWithoutVersionChange
256256
issue: https://github.com/elastic/elasticsearch/issues/120964
257-
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
258-
method: testWithOnlyTrainingRowsAndTrainingPercentIsFifty_DependentVariableIsKeyword
259-
issue: https://github.com/elastic/elasticsearch/issues/120071
260257
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
261258
method: testGetUsersWithProfileUidWhenProfileIndexDoesNotExists
262259
issue: https://github.com/elastic/elasticsearch/issues/121179
@@ -265,9 +262,6 @@ tests:
265262
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
266263
method: testSetEnabled
267264
issue: https://github.com/elastic/elasticsearch/issues/121183
268-
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
269-
method: testWithDatastreams
270-
issue: https://github.com/elastic/elasticsearch/issues/121236
271265
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
272266
method: test {p0=transform/*}
273267
issue: https://github.com/elastic/elasticsearch/issues/120816
@@ -317,9 +311,6 @@ tests:
317311
issue: https://github.com/elastic/elasticsearch/issues/121151
318312
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
319313
issue: https://github.com/elastic/elasticsearch/issues/121407
320-
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
321-
method: testDependentVariableIsAliasToNested
322-
issue: https://github.com/elastic/elasticsearch/issues/121415
323314
- class: org.elasticsearch.xpack.security.authc.jwt.JwtRealmSingleNodeTests
324315
method: testClientSecretRotation
325316
issue: https://github.com/elastic/elasticsearch/issues/120985
@@ -347,9 +338,6 @@ tests:
347338
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
348339
method: test {p0=search.vectors/42_knn_search_int4_flat/Vector similarity with filter only}
349340
issue: https://github.com/elastic/elasticsearch/issues/121412
350-
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
351-
method: testDependentVariableIsAliasToKeyword
352-
issue: https://github.com/elastic/elasticsearch/issues/121492
353341
- class: org.elasticsearch.search.CrossClusterSearchUnavailableClusterIT
354342
method: testSearchSkipUnavailable
355343
issue: https://github.com/elastic/elasticsearch/issues/121497
@@ -372,24 +360,12 @@ tests:
372360
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
373361
method: test {yaml=snapshot.delete/10_basic/Delete a snapshot asynchronously}
374362
issue: https://github.com/elastic/elasticsearch/issues/122102
375-
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
376-
method: testWithOnlyTrainingRowsAndTrainingPercentIsFifty_DependentVariableIsBoolean
377-
issue: https://github.com/elastic/elasticsearch/issues/121680
378363
- class: org.elasticsearch.xpack.downsample.DownsampleActionSingleNodeTests
379364
method: testDuplicateDownsampleRequest
380365
issue: https://github.com/elastic/elasticsearch/issues/122158
381366
- class: org.elasticsearch.search.SearchCancellationIT
382367
method: testCancelFailedSearchWhenPartialResultDisallowed
383368
issue: https://github.com/elastic/elasticsearch/issues/121719
384-
- class: org.elasticsearch.xpack.esql.analysis.VerifierTests
385-
method: testChangePoint
386-
issue: https://github.com/elastic/elasticsearch/issues/122179
387-
- class: org.elasticsearch.xpack.esql.analysis.VerifierTests
388-
method: testChangePoint_keySortable
389-
issue: https://github.com/elastic/elasticsearch/issues/122180
390-
- class: org.elasticsearch.xpack.esql.analysis.VerifierTests
391-
method: testChangePoint_valueNumeric
392-
issue: https://github.com/elastic/elasticsearch/issues/122181
393369
- class: org.elasticsearch.datastreams.TSDBPassthroughIndexingIT
394370
issue: https://github.com/elastic/elasticsearch/issues/121716
395371
- class: org.elasticsearch.smoketest.SmokeTestMonitoringWithSecurityIT

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4313,17 +4313,15 @@ public void resetEngine() {
43134313
assert waitForEngineOrClosedShardListeners.isDone();
43144314
try {
43154315
synchronized (engineMutex) {
4316-
final var currentEngine = getEngine();
4317-
currentEngine.prepareForEngineReset();
4318-
var engineConfig = newEngineConfig(replicationTracker);
43194316
verifyNotClosed();
4320-
IOUtils.close(currentEngine);
4321-
var newEngine = createEngine(engineConfig);
4322-
currentEngineReference.set(newEngine);
4317+
getEngine().prepareForEngineReset();
4318+
var newEngine = createEngine(newEngineConfig(replicationTracker));
4319+
IOUtils.close(currentEngineReference.getAndSet(newEngine));
43234320
onNewEngine(newEngine);
43244321
}
43254322
onSettingsChanged();
43264323
} catch (Exception e) {
4324+
// we want to fail the shard in the case prepareForEngineReset throws
43274325
failShard("unable to reset engine", e);
43284326
}
43294327
}

server/src/main/java/org/elasticsearch/search/aggregations/InternalOrder.java

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.ArrayList;
2727
import java.util.Collections;
2828
import java.util.Comparator;
29+
import java.util.Iterator;
2930
import java.util.LinkedList;
3031
import java.util.List;
3132
import java.util.Objects;
@@ -188,52 +189,35 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
188189

189190
@Override
190191
public <T extends Bucket> Comparator<BucketAndOrd<T>> partiallyBuiltBucketComparator(Aggregator aggregator) {
191-
List<Comparator<BucketAndOrd<T>>> comparators = new ArrayList<>(orderElements.size());
192-
for (BucketOrder order : orderElements) {
193-
comparators.add(order.partiallyBuiltBucketComparator(aggregator));
192+
Iterator<BucketOrder> iterator = orderElements.iterator();
193+
Comparator<BucketAndOrd<T>> comparator = iterator.next().partiallyBuiltBucketComparator(aggregator);
194+
while (iterator.hasNext()) {
195+
comparator = comparator.thenComparing(iterator.next().partiallyBuiltBucketComparator(aggregator));
194196
}
195-
return (lhs, rhs) -> {
196-
for (Comparator<BucketAndOrd<T>> c : comparators) {
197-
int result = c.compare(lhs, rhs);
198-
if (result != 0) {
199-
return result;
200-
}
201-
}
202-
return 0;
203-
};
197+
return comparator;
204198
}
205199

206200
@Override
207201
public Comparator<Bucket> comparator() {
208-
List<Comparator<Bucket>> comparators = orderElements.stream().map(BucketOrder::comparator).toList();
209-
return (lhs, rhs) -> {
210-
for (Comparator<Bucket> c : comparators) {
211-
int result = c.compare(lhs, rhs);
212-
if (result != 0) {
213-
return result;
214-
}
215-
}
216-
return 0;
217-
};
202+
Iterator<BucketOrder> iterator = orderElements.iterator();
203+
Comparator<Bucket> comparator = iterator.next().comparator();
204+
while (iterator.hasNext()) {
205+
comparator = comparator.thenComparing(iterator.next().comparator());
206+
}
207+
return comparator;
218208
}
219209

220210
@Override
221211
<B extends InternalMultiBucketAggregation.InternalBucket> Comparator<DelayedBucket<B>> delayedBucketComparator(
222212
BiFunction<List<B>, AggregationReduceContext, B> reduce,
223213
AggregationReduceContext reduceContext
224214
) {
225-
List<Comparator<DelayedBucket<B>>> comparators = orderElements.stream()
226-
.map(b -> b.delayedBucketComparator(reduce, reduceContext))
227-
.toList();
228-
return (lhs, rhs) -> {
229-
for (Comparator<DelayedBucket<B>> c : comparators) {
230-
int result = c.compare(lhs, rhs);
231-
if (result != 0) {
232-
return result;
233-
}
234-
}
235-
return 0;
236-
};
215+
Iterator<BucketOrder> iterator = orderElements.iterator();
216+
Comparator<DelayedBucket<B>> comparator = iterator.next().delayedBucketComparator(reduce, reduceContext);
217+
while (iterator.hasNext()) {
218+
comparator = comparator.thenComparing(iterator.next().delayedBucketComparator(reduce, reduceContext));
219+
}
220+
return comparator;
237221
}
238222

239223
@Override
@@ -285,12 +269,13 @@ public Comparator<Bucket> comparator() {
285269
return comparator;
286270
}
287271

272+
@SuppressWarnings({ "rawtypes", "unchecked" })
288273
@Override
289274
<B extends InternalMultiBucketAggregation.InternalBucket> Comparator<DelayedBucket<B>> delayedBucketComparator(
290275
BiFunction<List<B>, AggregationReduceContext, B> reduce,
291276
AggregationReduceContext reduceContext
292277
) {
293-
return delayedBucketCompator::compare;
278+
return (Comparator) delayedBucketCompator;
294279
}
295280

296281
@Override

server/src/test/java/org/elasticsearch/index/shard/IndexShardTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4563,11 +4563,9 @@ public void testResetEngine() throws Exception {
45634563
var newEngineCreated = new CountDownLatch(2);
45644564
var indexShard = newStartedShard(true, Settings.EMPTY, config -> {
45654565
try {
4566-
return new ReadOnlyEngine(config, null, null, true, Function.identity(), true, true) {
4566+
return new ReadOnlyEngine(config, null, new TranslogStats(), false, Function.identity(), true, true) {
45674567
@Override
4568-
public void prepareForEngineReset() throws IOException {
4569-
;
4570-
}
4568+
public void prepareForEngineReset() throws IOException {}
45714569
};
45724570
} finally {
45734571
newEngineCreated.countDown();

0 commit comments

Comments
 (0)