Skip to content

Commit a0874ee

Browse files
Merge branch 'main' into threadpool-merge-scheduler-sort-all-merges-take-2
2 parents 091dcba + 54eab9d commit a0874ee

File tree

15 files changed

+195
-164
lines changed

15 files changed

+195
-164
lines changed

muted-tests.yml

Lines changed: 57 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -213,41 +213,14 @@ tests:
213213
- class: org.elasticsearch.action.search.SearchProgressActionListenerIT
214214
method: testSearchProgressWithQuery
215215
issue: https://github.com/elastic/elasticsearch/issues/120994
216-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
217-
method: testSuggestProfilesWithName
218-
issue: https://github.com/elastic/elasticsearch/issues/121022
219-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
220-
method: testProfileAPIsWhenIndexNotCreated
221-
issue: https://github.com/elastic/elasticsearch/issues/121096
222-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
223-
method: testGetProfiles
224-
issue: https://github.com/elastic/elasticsearch/issues/121101
225-
- class: org.elasticsearch.xpack.security.authc.service.ServiceAccountSingleNodeTests
226-
method: testAuthenticateWithServiceFileToken
227-
issue: https://github.com/elastic/elasticsearch/issues/120988
228-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
229-
method: testUpdateProfileData
230-
issue: https://github.com/elastic/elasticsearch/issues/121108
231216
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
232217
method: test {p0=nodes.stats/11_indices_metrics/indices mappings exact count test for indices level}
233218
issue: https://github.com/elastic/elasticsearch/issues/120950
234-
- class: org.elasticsearch.xpack.security.authc.jwt.JwtRealmSingleNodeTests
235-
method: testActivateProfileForJWT
236-
issue: https://github.com/elastic/elasticsearch/issues/120983
237-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
238-
method: testProfileIndexAutoCreation
239-
issue: https://github.com/elastic/elasticsearch/issues/120987
240219
- class: org.elasticsearch.xpack.security.FileSettingsRoleMappingsRestartIT
241220
method: testFileSettingsReprocessedOnRestartWithoutVersionChange
242221
issue: https://github.com/elastic/elasticsearch/issues/120964
243-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
244-
method: testGetUsersWithProfileUidWhenProfileIndexDoesNotExists
245-
issue: https://github.com/elastic/elasticsearch/issues/121179
246222
- class: org.elasticsearch.xpack.ml.integration.PyTorchModelIT
247223
issue: https://github.com/elastic/elasticsearch/issues/121165
248-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
249-
method: testSetEnabled
250-
issue: https://github.com/elastic/elasticsearch/issues/121183
251224
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
252225
method: test {p0=transform/*}
253226
issue: https://github.com/elastic/elasticsearch/issues/120816
@@ -286,29 +259,8 @@ tests:
286259
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
287260
method: test {yaml=reference/snapshot-restore/apis/get-snapshot-api/line_751}
288261
issue: https://github.com/elastic/elasticsearch/issues/121345
289-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
290-
method: testHasPrivileges
291-
issue: https://github.com/elastic/elasticsearch/issues/121346
292-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
293-
method: testActivateProfile
294-
issue: https://github.com/elastic/elasticsearch/issues/121151
295262
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
296263
issue: https://github.com/elastic/elasticsearch/issues/121407
297-
- class: org.elasticsearch.xpack.security.authc.jwt.JwtRealmSingleNodeTests
298-
method: testClientSecretRotation
299-
issue: https://github.com/elastic/elasticsearch/issues/120985
300-
- class: org.elasticsearch.xpack.security.authc.jwt.JwtRealmSingleNodeTests
301-
method: testGrantApiKeyForJWT
302-
issue: https://github.com/elastic/elasticsearch/issues/121039
303-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
304-
method: testGetUsersWithProfileUid
305-
issue: https://github.com/elastic/elasticsearch/issues/121483
306-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
307-
method: testSuggestProfilesWithHint
308-
issue: https://github.com/elastic/elasticsearch/issues/121116
309-
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
310-
method: testSuggestProfileWithData
311-
issue: https://github.com/elastic/elasticsearch/issues/121258
312264
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
313265
method: test {yaml=reference/cat/health/cat-health-no-timestamp-example}
314266
issue: https://github.com/elastic/elasticsearch/issues/121867
@@ -397,6 +349,63 @@ tests:
397349
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
398350
method: test {yaml=reference/snapshot-restore/apis/get-snapshot-api/line_408}
399351
issue: https://github.com/elastic/elasticsearch/issues/122681
352+
- class: org.elasticsearch.xpack.autoscaling.storage.ReactiveStorageIT
353+
method: testScaleWhileShrinking
354+
issue: https://github.com/elastic/elasticsearch/issues/122119
355+
- class: org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase
356+
method: testIndexUpgrade {p0=[9.1.0, 8.19.0, 8.19.0]}
357+
issue: https://github.com/elastic/elasticsearch/issues/122688
358+
- class: org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase
359+
method: testRestoreIndex {p0=[9.1.0, 9.1.0, 8.19.0]}
360+
issue: https://github.com/elastic/elasticsearch/issues/122689
361+
- class: org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase
362+
method: testClosedIndexUpgrade {p0=[9.1.0, 8.19.0, 8.19.0]}
363+
issue: https://github.com/elastic/elasticsearch/issues/122690
364+
- class: org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase
365+
method: testRestoreIndex {p0=[9.1.0, 8.19.0, 8.19.0]}
366+
issue: https://github.com/elastic/elasticsearch/issues/122691
367+
- class: org.elasticsearch.xpack.searchablesnapshots.FrozenSearchableSnapshotsIntegTests
368+
method: testCreateAndRestorePartialSearchableSnapshot
369+
issue: https://github.com/elastic/elasticsearch/issues/122693
370+
- class: org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase
371+
method: testClosedIndexUpgrade {p0=[9.1.0, 9.1.0, 8.19.0]}
372+
issue: https://github.com/elastic/elasticsearch/issues/122694
373+
- class: org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase
374+
method: testClosedIndexUpgrade {p0=[9.1.0, 9.1.0, 9.1.0]}
375+
issue: https://github.com/elastic/elasticsearch/issues/122695
376+
- class: org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase
377+
method: testIndexUpgrade {p0=[9.1.0, 9.1.0, 8.19.0]}
378+
issue: https://github.com/elastic/elasticsearch/issues/122696
379+
- class: org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase
380+
method: testIndexUpgrade {p0=[9.1.0, 9.1.0, 9.1.0]}
381+
issue: https://github.com/elastic/elasticsearch/issues/122697
382+
- class: org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase
383+
method: testRestoreIndex {p0=[9.1.0, 9.1.0, 9.1.0]}
384+
issue: https://github.com/elastic/elasticsearch/issues/122698
385+
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
386+
method: testSearchableSnapshotUpgrade {p0=[9.1.0, 8.19.0, 8.19.0]}
387+
issue: https://github.com/elastic/elasticsearch/issues/122700
388+
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
389+
method: testSearchableSnapshotUpgrade {p0=[9.1.0, 9.1.0, 8.19.0]}
390+
issue: https://github.com/elastic/elasticsearch/issues/122701
391+
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
392+
method: testMountSearchableSnapshot {p0=[9.1.0, 8.19.0, 8.19.0]}
393+
issue: https://github.com/elastic/elasticsearch/issues/122702
394+
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
395+
method: testMountSearchableSnapshot {p0=[9.1.0, 9.1.0, 8.19.0]}
396+
issue: https://github.com/elastic/elasticsearch/issues/122703
397+
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
398+
method: testSearchableSnapshotUpgrade {p0=[9.1.0, 9.1.0, 9.1.0]}
399+
issue: https://github.com/elastic/elasticsearch/issues/122704
400+
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
401+
method: testMountSearchableSnapshot {p0=[9.1.0, 9.1.0, 9.1.0]}
402+
issue: https://github.com/elastic/elasticsearch/issues/122705
403+
- class: org.elasticsearch.search.basic.SearchWithRandomDisconnectsIT
404+
method: testSearchWithRandomDisconnects
405+
issue: https://github.com/elastic/elasticsearch/issues/122707
406+
- class: org.elasticsearch.indices.recovery.IndexRecoveryIT
407+
method: testSourceThrottling
408+
issue: https://github.com/elastic/elasticsearch/issues/122712
400409

401410
# Examples:
402411
#

server/src/internalClusterTest/java/org/elasticsearch/cluster/PrevalidateNodeRemovalIT.java

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -179,28 +179,35 @@ public void testNodeRemovalFromRedClusterWithTimeout() throws Exception {
179179
// make it red!
180180
internalCluster().stopNode(node1);
181181
ensureRed(indexName);
182+
CountDownLatch stallPrevalidateShardPathActionLatch = new CountDownLatch(1);
182183
MockTransportService.getInstance(node2)
183184
.addRequestHandlingBehavior(TransportPrevalidateShardPathAction.ACTION_NAME + "[n]", (handler, request, channel, task) -> {
184185
logger.info("drop the check shards request");
186+
safeAwait(stallPrevalidateShardPathActionLatch);
187+
handler.messageReceived(request, channel, task);
185188
});
186-
PrevalidateNodeRemovalRequest req = PrevalidateNodeRemovalRequest.builder()
187-
.setNames(node2)
188-
.build(TEST_REQUEST_TIMEOUT)
189-
.masterNodeTimeout(TimeValue.timeValueSeconds(1))
190-
.timeout(TimeValue.timeValueSeconds(1));
191-
PrevalidateNodeRemovalResponse resp = client().execute(PrevalidateNodeRemovalAction.INSTANCE, req).get();
192-
assertFalse("prevalidation result should return false", resp.getPrevalidation().isSafe());
193-
String node2Id = getNodeId(node2);
194-
assertThat(
195-
resp.getPrevalidation().message(),
196-
equalTo("cannot prevalidate removal of nodes with the following IDs: [" + node2Id + "]")
197-
);
198-
assertThat(resp.getPrevalidation().nodes().size(), equalTo(1));
199-
NodesRemovalPrevalidation.NodeResult nodeResult = resp.getPrevalidation().nodes().get(0);
200-
assertThat(nodeResult.name(), equalTo(node2));
201-
assertFalse(nodeResult.result().isSafe());
202-
assertThat(nodeResult.result().message(), startsWith("failed contacting the node"));
203-
assertThat(nodeResult.result().reason(), equalTo(NodesRemovalPrevalidation.Reason.UNABLE_TO_VERIFY));
189+
try {
190+
PrevalidateNodeRemovalRequest req = PrevalidateNodeRemovalRequest.builder()
191+
.setNames(node2)
192+
.build(TEST_REQUEST_TIMEOUT)
193+
.masterNodeTimeout(TimeValue.timeValueSeconds(1))
194+
.timeout(TimeValue.timeValueSeconds(1));
195+
PrevalidateNodeRemovalResponse resp = client().execute(PrevalidateNodeRemovalAction.INSTANCE, req).get();
196+
assertFalse("prevalidation result should return false", resp.getPrevalidation().isSafe());
197+
String node2Id = getNodeId(node2);
198+
assertThat(
199+
resp.getPrevalidation().message(),
200+
equalTo("cannot prevalidate removal of nodes with the following IDs: [" + node2Id + "]")
201+
);
202+
assertThat(resp.getPrevalidation().nodes().size(), equalTo(1));
203+
NodesRemovalPrevalidation.NodeResult nodeResult = resp.getPrevalidation().nodes().get(0);
204+
assertThat(nodeResult.name(), equalTo(node2));
205+
assertFalse(nodeResult.result().isSafe());
206+
assertThat(nodeResult.result().message(), startsWith("failed contacting the node"));
207+
assertThat(nodeResult.result().reason(), equalTo(NodesRemovalPrevalidation.Reason.UNABLE_TO_VERIFY));
208+
} finally {
209+
stallPrevalidateShardPathActionLatch.countDown();
210+
}
204211
}
205212

206213
private void ensureRed(String indexName) throws Exception {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ static TransportVersion def(int id) {
176176
public static final TransportVersion ML_INFERENCE_IBM_WATSONX_RERANK_ADDED = def(8_840_0_00);
177177
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED_BACKPORT_8_X = def(8_840_0_01);
178178
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_X = def(8_840_0_02);
179+
public static final TransportVersion ESQL_RETRY_ON_SHARD_LEVEL_FAILURE_BACKPORT_8_19 = def(8_840_0_03);
180+
public static final TransportVersion ESQL_SUPPORT_PARTIAL_RESULTS_BACKPORT_8_19 = def(8_840_0_04);
179181
public static final TransportVersion ELASTICSEARCH_9_0 = def(9_000_0_00);
180182
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES_90 = def(9_000_0_01);
181183
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED_90 = def(9_000_0_02);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ public CanMatchNodeRequest.Shard buildShardLevelRequest(SearchShardIterator shar
387387
}
388388

389389
public void start() {
390-
if (shardsIts.size() == 0) {
390+
if (shardsIts.isEmpty()) {
391391
finishPhase();
392392
return;
393393
}

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import org.elasticsearch.action.OriginalIndices;
1313
import org.elasticsearch.cluster.routing.ShardRouting;
14-
import org.elasticsearch.cluster.routing.ShardsIterator;
1514
import org.elasticsearch.common.util.PlainIterator;
1615
import org.elasticsearch.core.Nullable;
1716
import org.elasticsearch.core.TimeValue;
@@ -113,15 +112,6 @@ SearchShardTarget nextOrNull() {
113112
return null;
114113
}
115114

116-
/**
117-
* Return the number of shards remaining in this {@link ShardsIterator}
118-
*
119-
* @return number of shard remaining
120-
*/
121-
int remaining() {
122-
return targetNodesIterator.remaining();
123-
}
124-
125115
/**
126116
* Returns a non-null value if this request should use a specific search context instead of the latest one.
127117
*/

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@
2222
import org.elasticsearch.cluster.service.ClusterService;
2323
import org.elasticsearch.index.Index;
2424
import org.elasticsearch.index.query.Rewriteable;
25-
import org.elasticsearch.index.shard.ShardId;
2625
import org.elasticsearch.injection.guice.Inject;
2726
import org.elasticsearch.search.SearchService;
28-
import org.elasticsearch.search.SearchShardTarget;
2927
import org.elasticsearch.search.builder.SearchSourceBuilder;
3028
import org.elasticsearch.search.internal.AliasFilter;
3129
import org.elasticsearch.tasks.Task;
@@ -172,15 +170,7 @@ public void searchShards(Task task, SearchShardsRequest searchShardsRequest, Act
172170
private static List<SearchShardsGroup> toGroups(List<SearchShardIterator> shardIts) {
173171
List<SearchShardsGroup> groups = new ArrayList<>(shardIts.size());
174172
for (SearchShardIterator shardIt : shardIts) {
175-
boolean skip = shardIt.skip();
176-
shardIt.reset();
177-
List<String> targetNodes = new ArrayList<>();
178-
SearchShardTarget target;
179-
while ((target = shardIt.nextOrNull()) != null) {
180-
targetNodes.add(target.getNodeId());
181-
}
182-
ShardId shardId = shardIt.shardId();
183-
groups.add(new SearchShardsGroup(shardId, targetNodes, skip));
173+
groups.add(new SearchShardsGroup(shardIt.shardId(), shardIt.getTargetNodeIds(), shardIt.skip()));
184174
}
185175
return groups;
186176
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ public void testShardNotAvailableWithDisallowPartialFailures() {
225225
// skip one to avoid the "all shards failed" failure.
226226
SearchShardIterator skipIterator = new SearchShardIterator(null, null, Collections.emptyList(), null);
227227
skipIterator.skip(true);
228-
skipIterator.reset();
229228
action.skipShard(skipIterator);
230229
assertThat(exception.get(), instanceOf(SearchPhaseExecutionException.class));
231230
SearchPhaseExecutionException searchPhaseExecutionException = (SearchPhaseExecutionException) exception.get();

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ public void testAllowPartialResults() throws InterruptedException {
545545

546546
SearchTransportService transportService = new SearchTransportService(null, null, null);
547547
Map<String, Transport.Connection> lookup = new HashMap<>();
548-
Map<ShardId, Boolean> seenShard = new ConcurrentHashMap<>();
548+
Map<ShardId, AtomicInteger> seenShard = new ConcurrentHashMap<>();
549549
lookup.put(primaryNode.getId(), new MockConnection(primaryNode));
550550
lookup.put(replicaNode.getId(), new MockConnection(replicaNode));
551551
Map<String, AliasFilter> aliasFilters = Collections.singletonMap("_na_", AliasFilter.EMPTY);
@@ -581,17 +581,18 @@ protected void executePhaseOnShard(
581581
Transport.Connection connection,
582582
SearchActionListener<TestSearchPhaseResult> listener
583583
) {
584-
seenShard.computeIfAbsent(shardIt.shardId(), (i) -> {
584+
AtomicInteger retries = seenShard.computeIfAbsent(shardIt.shardId(), (i) -> {
585585
numRequests.incrementAndGet(); // only count this once per shard copy
586-
return Boolean.TRUE;
586+
return new AtomicInteger(0);
587587
});
588+
int numRetries = retries.incrementAndGet();
588589
new Thread(() -> {
589590
TestSearchPhaseResult testSearchPhaseResult = new TestSearchPhaseResult(
590591
new ShardSearchContextId(UUIDs.randomBase64UUID(), contextIdGenerator.incrementAndGet()),
591592
connection.getNode()
592593
);
593594
try {
594-
if (shardIt.remaining() > 0) {
595+
if (numRetries < shardIt.size()) {
595596
numFailReplicas.incrementAndGet();
596597
listener.onFailure(new RuntimeException());
597598
} else {
@@ -643,10 +644,8 @@ public void testSkipUnavailableSearchShards() throws InterruptedException {
643644
);
644645
// Skip all the shards
645646
searchShardIterator.skip(true);
646-
searchShardIterator.reset();
647647
searchShardIterators.add(searchShardIterator);
648648
}
649-
List<SearchShardIterator> shardsIter = searchShardIterators;
650649
Map<String, Transport.Connection> lookup = Map.of(primaryNode.getId(), new MockConnection(primaryNode));
651650

652651
CountDownLatch latch = new CountDownLatch(1);
@@ -665,11 +664,11 @@ public void testSkipUnavailableSearchShards() throws InterruptedException {
665664
null,
666665
request,
667666
responseListener,
668-
shardsIter,
667+
searchShardIterators,
669668
new TransportSearchAction.SearchTimeProvider(0, 0, () -> 0),
670669
ClusterState.EMPTY_STATE,
671670
null,
672-
new ArraySearchPhaseResults<>(shardsIter.size()),
671+
new ArraySearchPhaseResults<>(searchShardIterators.size()),
673672
request.getMaxConcurrentShardRequests(),
674673
SearchResponse.Clusters.EMPTY
675674
) {
@@ -702,7 +701,7 @@ protected void run() {
702701
assertNotNull(searchResponse.get());
703702
assertThat(searchResponse.get().getSkippedShards(), equalTo(numUnavailableSkippedShards));
704703
assertThat(searchResponse.get().getFailedShards(), equalTo(0));
705-
assertThat(searchResponse.get().getSuccessfulShards(), equalTo(shardsIter.size()));
704+
assertThat(searchResponse.get().getSuccessfulShards(), equalTo(searchShardIterators.size()));
706705
}
707706

708707
static List<SearchShardIterator> getShardsIter(
@@ -728,7 +727,6 @@ static List<SearchShardIterator> getShardsIter(
728727
for (int i = 0; i < numShards; i++) {
729728
ArrayList<ShardRouting> started = new ArrayList<>();
730729
ArrayList<ShardRouting> initializing = new ArrayList<>();
731-
ArrayList<ShardRouting> unassigned = new ArrayList<>();
732730

733731
ShardRouting routing = ShardRouting.newUnassigned(
734732
new ShardId(index, i),
@@ -758,8 +756,6 @@ static List<SearchShardIterator> getShardsIter(
758756
} else {
759757
initializing.add(routing);
760758
}
761-
} else {
762-
unassigned.add(routing); // unused yet
763759
}
764760
}
765761
Collections.shuffle(started, random());

0 commit comments

Comments
 (0)