Skip to content

Commit a0d06dc

Browse files
committed
Merge remote-tracking branch 'upstream/main' into reindex-double-relocation
* upstream/main: Reindex relocation: store source TaskResult at destination node (elastic#145488) Bump versions after 9.2.8 release [CI] DLMFrozenTransitionServiceTests testCheckForFrozenIndicesReturnsEarlyWhenCapacityExhausted failing [elastic#145778] (elastic#145906) Update branches.json for 9.2.8 release ESQL: Clarify inheriting from Attributes (elastic#145898) Bump versions after 9.3.3 release Update branches.json for 9.3.3 release
2 parents ee9edf1 + 867e120 commit a0d06dc

42 files changed

Lines changed: 462 additions & 115 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.buildkite/pipelines/intake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ steps:
6565
timeout_in_minutes: 300
6666
matrix:
6767
setup:
68-
BWC_VERSION: ["8.19.15", "9.2.8", "9.3.3", "9.4.0"]
68+
BWC_VERSION: ["8.19.15", "9.2.9", "9.3.4", "9.4.0"]
6969
agents:
7070
provider: gcp
7171
image: family/elasticsearch-ubuntu-2404

.buildkite/pipelines/periodic-java-ea.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,8 @@ steps:
424424
- signal_reason: agent_stop
425425
limit: 3
426426

427-
- label: 9.2.8 / bwc
428-
command: .ci/scripts/run-gradle.sh -Druntime.java=$$JAVA_EA_VERSION -Dbwc.checkout.align=true v9.2.8#bwcTest
427+
- label: 9.2.9 / bwc
428+
command: .ci/scripts/run-gradle.sh -Druntime.java=$$JAVA_EA_VERSION -Dbwc.checkout.align=true v9.2.9#bwcTest
429429
timeout_in_minutes: 300
430430
agents:
431431
provider: gcp
@@ -434,7 +434,7 @@ steps:
434434
buildDirectory: /dev/shm/bk
435435
preemptible: true
436436
env:
437-
BWC_VERSION: 9.2.8
437+
BWC_VERSION: 9.2.9
438438
retry:
439439
automatic:
440440
- exit_status: "-1"
@@ -443,8 +443,8 @@ steps:
443443
- signal_reason: agent_stop
444444
limit: 3
445445

446-
- label: 9.3.3 / bwc
447-
command: .ci/scripts/run-gradle.sh -Druntime.java=$$JAVA_EA_VERSION -Dbwc.checkout.align=true v9.3.3#bwcTest
446+
- label: 9.3.4 / bwc
447+
command: .ci/scripts/run-gradle.sh -Druntime.java=$$JAVA_EA_VERSION -Dbwc.checkout.align=true v9.3.4#bwcTest
448448
timeout_in_minutes: 300
449449
agents:
450450
provider: gcp
@@ -453,7 +453,7 @@ steps:
453453
buildDirectory: /dev/shm/bk
454454
preemptible: true
455455
env:
456-
BWC_VERSION: 9.3.3
456+
BWC_VERSION: 9.3.4
457457
retry:
458458
automatic:
459459
- exit_status: "-1"
@@ -558,7 +558,7 @@ steps:
558558
timeout_in_minutes: 300
559559
matrix:
560560
setup:
561-
BWC_VERSION: ["8.19.15", "9.2.8", "9.3.3", "9.4.0"]
561+
BWC_VERSION: ["8.19.15", "9.2.9", "9.3.4", "9.4.0"]
562562
agents:
563563
provider: gcp
564564
image: family/elasticsearch-ubuntu-2404

.buildkite/pipelines/periodic-packaging.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ steps:
387387
env:
388388
BWC_VERSION: 9.1.9
389389

390-
- label: "{{matrix.image}} / 9.2.8 / packaging-tests-upgrade"
391-
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v9.2.8
390+
- label: "{{matrix.image}} / 9.2.9 / packaging-tests-upgrade"
391+
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v9.2.9
392392
timeout_in_minutes: 300
393393
matrix:
394394
setup:
@@ -401,10 +401,10 @@ steps:
401401
machineType: custom-16-32768
402402
buildDirectory: /dev/shm/bk
403403
env:
404-
BWC_VERSION: 9.2.8
404+
BWC_VERSION: 9.2.9
405405

406-
- label: "{{matrix.image}} / 9.3.3 / packaging-tests-upgrade"
407-
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v9.3.3
406+
- label: "{{matrix.image}} / 9.3.4 / packaging-tests-upgrade"
407+
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v9.3.4
408408
timeout_in_minutes: 300
409409
matrix:
410410
setup:
@@ -417,7 +417,7 @@ steps:
417417
machineType: custom-16-32768
418418
buildDirectory: /dev/shm/bk
419419
env:
420-
BWC_VERSION: 9.3.3
420+
BWC_VERSION: 9.3.4
421421

422422
- label: "{{matrix.image}} / 9.4.0 / packaging-tests-upgrade"
423423
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v9.4.0

.buildkite/pipelines/periodic.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ steps:
464464
- exit_status: "1"
465465
limit: 1
466466

467-
- label: 9.2.8 / bwc
468-
command: .ci/scripts/run-gradle.sh --continue -Dbwc.checkout.align=true v9.2.8#bwcTest
467+
- label: 9.2.9 / bwc
468+
command: .ci/scripts/run-gradle.sh --continue -Dbwc.checkout.align=true v9.2.9#bwcTest
469469
timeout_in_minutes: 300
470470
agents:
471471
provider: gcp
@@ -474,7 +474,7 @@ steps:
474474
buildDirectory: /dev/shm/bk
475475
preemptible: true
476476
env:
477-
BWC_VERSION: 9.2.8
477+
BWC_VERSION: 9.2.9
478478
retry:
479479
automatic:
480480
- exit_status: "-1"
@@ -485,8 +485,8 @@ steps:
485485
- exit_status: "1"
486486
limit: 1
487487

488-
- label: 9.3.3 / bwc
489-
command: .ci/scripts/run-gradle.sh --continue -Dbwc.checkout.align=true v9.3.3#bwcTest
488+
- label: 9.3.4 / bwc
489+
command: .ci/scripts/run-gradle.sh --continue -Dbwc.checkout.align=true v9.3.4#bwcTest
490490
timeout_in_minutes: 300
491491
agents:
492492
provider: gcp
@@ -495,7 +495,7 @@ steps:
495495
buildDirectory: /dev/shm/bk
496496
preemptible: true
497497
env:
498-
BWC_VERSION: 9.3.3
498+
BWC_VERSION: 9.3.4
499499
retry:
500500
automatic:
501501
- exit_status: "-1"
@@ -611,7 +611,7 @@ steps:
611611
setup:
612612
ES_RUNTIME_JAVA:
613613
- openjdk21
614-
BWC_VERSION: ["8.19.15", "9.2.8", "9.3.3", "9.4.0"]
614+
BWC_VERSION: ["8.19.15", "9.2.9", "9.3.4", "9.4.0"]
615615
agents:
616616
provider: gcp
617617
image: family/elasticsearch-ubuntu-2404
@@ -678,7 +678,7 @@ steps:
678678
setup:
679679
ES_RUNTIME_JAVA:
680680
- openjdk21
681-
BWC_VERSION: ["8.19.15", "9.2.8", "9.3.3", "9.4.0"]
681+
BWC_VERSION: ["8.19.15", "9.2.9", "9.3.4", "9.4.0"]
682682
agents:
683683
provider: gcp
684684
image: family/elasticsearch-ubuntu-2404
@@ -735,7 +735,7 @@ steps:
735735
ES_RUNTIME_JAVA:
736736
- openjdk21
737737
- openjdk25
738-
BWC_VERSION: ["8.19.15", "9.2.8", "9.3.3", "9.4.0"]
738+
BWC_VERSION: ["8.19.15", "9.2.9", "9.3.4", "9.4.0"]
739739
agents:
740740
provider: gcp
741741
image: family/elasticsearch-ubuntu-2404

.ci/bwcVersions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ BWC_VERSION:
2121
- "8.19.15"
2222
- "9.0.8"
2323
- "9.1.9"
24-
- "9.2.8"
25-
- "9.3.3"
24+
- "9.2.9"
25+
- "9.3.4"
2626
- "9.4.0"

.ci/snapshotBwcVersions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
BWC_VERSION:
22
- "8.19.15"
3-
- "9.2.8"
4-
- "9.3.3"
3+
- "9.2.9"
4+
- "9.3.4"
55
- "9.4.0"

branches.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
},
88
{
99
"branch" : "9.3",
10-
"version" : "9.3.3"
10+
"version" : "9.3.4"
1111
},
1212
{
1313
"branch" : "9.2",
14-
"version" : "9.2.8"
14+
"version" : "9.2.9"
1515
},
1616
{
1717
"branch" : "8.19",

modules/reindex-management/src/internalClusterTest/java/org/elasticsearch/reindex/management/ReindexRelocationIT.java

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,16 @@
1010
package org.elasticsearch.reindex.management;
1111

1212
import org.apache.lucene.util.SetOnce;
13+
import org.elasticsearch.ElasticsearchException;
14+
import org.elasticsearch.action.ActionListener;
15+
import org.elasticsearch.action.ActionRequest;
16+
import org.elasticsearch.action.ActionResponse;
1317
import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskResponse;
18+
import org.elasticsearch.action.bulk.BulkRequest;
19+
import org.elasticsearch.action.bulk.TransportBulkAction;
1420
import org.elasticsearch.action.get.GetResponse;
21+
import org.elasticsearch.action.support.ActionFilter;
22+
import org.elasticsearch.action.support.ActionFilterChain;
1523
import org.elasticsearch.client.Request;
1624
import org.elasticsearch.client.Response;
1725
import org.elasticsearch.client.RestClient;
@@ -25,7 +33,9 @@
2533
import org.elasticsearch.http.HttpServerTransport;
2634
import org.elasticsearch.index.reindex.BulkByScrollTask;
2735
import org.elasticsearch.index.reindex.ReindexAction;
36+
import org.elasticsearch.node.Node;
2837
import org.elasticsearch.node.ShutdownPrepareService;
38+
import org.elasticsearch.plugins.ActionPlugin;
2939
import org.elasticsearch.plugins.Plugin;
3040
import org.elasticsearch.plugins.PluginsService;
3141
import org.elasticsearch.reindex.ReindexMetrics;
@@ -34,6 +44,7 @@
3444
import org.elasticsearch.reindex.TransportReindexAction;
3545
import org.elasticsearch.rest.root.MainRestPlugin;
3646
import org.elasticsearch.tasks.RawTaskStatus;
47+
import org.elasticsearch.tasks.Task;
3748
import org.elasticsearch.tasks.TaskId;
3849
import org.elasticsearch.tasks.TaskInfo;
3950
import org.elasticsearch.tasks.TaskResult;
@@ -97,7 +108,13 @@ public class ReindexRelocationIT extends ESIntegTestCase {
97108

98109
@Override
99110
protected Collection<Class<? extends Plugin>> nodePlugins() {
100-
return Arrays.asList(ReindexPlugin.class, ReindexManagementPlugin.class, MainRestPlugin.class, TestTelemetryPlugin.class);
111+
return Arrays.asList(
112+
ReindexPlugin.class,
113+
ReindexManagementPlugin.class,
114+
MainRestPlugin.class,
115+
TestTelemetryPlugin.class,
116+
BlockTasksWritePlugin.class
117+
);
101118
}
102119

103120
@Override
@@ -230,6 +247,105 @@ private void testReindexRelocation(
230247
assertExpectedNumberOfDocumentsInDestinationIndex();
231248
}
232249

250+
/**
251+
* Verifies that the destination node writes the source task result to {@code .tasks} during relocation, so the chain link is preserved
252+
* even when the source node cannot write. The test uses {@link BlockTasksWritePlugin} to block all {@code .tasks} writes on the source
253+
* node, so only the destination's write (in {@code Reindexer.storeRelocationSourceTaskResult}) succeeds.
254+
*/
255+
public void testDestinationWritesSourceTaskResultToTasksIndex() throws Exception {
256+
assumeTrue("reindex resilience is enabled", ReindexPlugin.REINDEX_RESILIENCE_ENABLED);
257+
final int shards = randomIntBetween(1, 5);
258+
259+
final String nodeAName = internalCluster().startNode(
260+
NodeRoles.onlyRoles(Set.of(DiscoveryNodeRole.DATA_ROLE, DiscoveryNodeRole.MASTER_ROLE))
261+
);
262+
final String nodeAId = nodeIdByName(nodeAName);
263+
final String nodeBName = internalCluster().startNode(
264+
NodeRoles.onlyRoles(Set.of(DiscoveryNodeRole.DATA_ROLE, DiscoveryNodeRole.MASTER_ROLE))
265+
);
266+
ensureStableCluster(2);
267+
268+
createIndexPinnedToNodeName(SOURCE_INDEX, nodeAName, shards);
269+
createIndexPinnedToNodeName(DEST_INDEX, nodeAName, shards);
270+
indexRandom(true, SOURCE_INDEX, numberOfDocumentsThatTakes60SecondsToIngest);
271+
ensureGreen(SOURCE_INDEX, DEST_INDEX);
272+
273+
final TaskId originalTaskId = startAsyncThrottledLocalReindexOnNode(nodeBName, 1);
274+
assertBusy(() -> {
275+
final TaskResult running = getRunningReindex(originalTaskId);
276+
assertThat(running.getTask().taskId().getNodeId(), equalTo(nodeIdByName(nodeBName)));
277+
});
278+
279+
assertFalse(".tasks index should not exist before shutdown", indexExists(TaskResultsService.TASK_INDEX));
280+
281+
// Block .tasks writes on the source node so only the destination's write can succeed.
282+
BlockTasksWritePlugin.blockedNodeName = nodeBName;
283+
try {
284+
shutdownNodeNameAndRelocate(nodeBName);
285+
286+
final TaskId relocatedTaskId = assertOriginalTaskEndStateInTasksIndexAndGetRelocatedTaskId(
287+
originalTaskId,
288+
nodeAId,
289+
localReindexDescription(),
290+
1,
291+
shards
292+
);
293+
294+
unthrottleReindex(relocatedTaskId);
295+
assertRelocatedTaskExpectedEndState(relocatedTaskId, localReindexDescription(), 1, shards);
296+
assertExpectedNumberOfDocumentsInDestinationIndex();
297+
} finally {
298+
BlockTasksWritePlugin.blockedNodeName = null;
299+
}
300+
}
301+
302+
/**
303+
* Test plugin that blocks {@code .tasks} index writes on a specific node.
304+
* Used to verify the destination writes the source task result during relocation.
305+
*/
306+
public static class BlockTasksWritePlugin extends Plugin implements ActionPlugin {
307+
static volatile String blockedNodeName = null;
308+
private volatile String myNodeName;
309+
310+
@Override
311+
public Collection<Object> createComponents(PluginServices services) {
312+
myNodeName = Node.NODE_NAME_SETTING.get(services.environment().settings());
313+
return List.of();
314+
}
315+
316+
@Override
317+
public List<ActionFilter> getActionFilters() {
318+
return List.of(new ActionFilter() {
319+
@Override
320+
public int order() {
321+
return Integer.MIN_VALUE;
322+
}
323+
324+
@Override
325+
public <Request extends ActionRequest, Response extends ActionResponse> void apply(
326+
Task task,
327+
String action,
328+
Request request,
329+
ActionListener<Response> listener,
330+
ActionFilterChain<Request, Response> chain
331+
) {
332+
if (myNodeName != null && myNodeName.equals(blockedNodeName) && isTasksIndexWrite(action, request)) {
333+
listener.onFailure(new ElasticsearchException("blocked .tasks write on [" + myNodeName + "] for testing"));
334+
return;
335+
}
336+
chain.proceed(task, action, request, listener);
337+
}
338+
339+
private boolean isTasksIndexWrite(String action, ActionRequest request) {
340+
if (action.equals(TransportBulkAction.NAME) && request instanceof BulkRequest bulkRequest) {
341+
return bulkRequest.requests().stream().anyMatch(r -> TaskResultsService.TASK_INDEX.equals(r.index()));
342+
}
343+
return false;
344+
}
345+
});
346+
}
347+
}
348+
233349
private void shutdownNodeNameAndRelocate(final String nodeName) throws Exception {
234350
// testing assumption: .tasks should not exist yet — it's created when the task result is stored during relocation
235351
assertFalse(".tasks index should not exist before shutdown", indexExists(TaskResultsService.TASK_INDEX));

modules/reindex-management/src/test/java/org/elasticsearch/reindex/management/TransportGetReindexActionTests.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,7 @@ public void testFollowsSingleRelocation() throws IOException {
289289
final TaskId originalTaskId = taskId;
290290
final TaskId relocatedTaskId = randomValueOtherThan(taskId, () -> new TaskId(randomAlphaOfLength(10), randomIntBetween(1, 1000)));
291291

292-
final TaskRelocatedException relocatedException = new TaskRelocatedException();
293-
relocatedException.setOriginalAndRelocatedTaskIdMetadata(originalTaskId, relocatedTaskId);
292+
final var relocatedException = new TaskRelocatedException(originalTaskId, relocatedTaskId);
294293

295294
final TaskInfo originalInfo = createTaskInfo(originalTaskId, ReindexAction.NAME);
296295
final TaskResult originalResult = new TaskResult(originalInfo, (Exception) relocatedException);
@@ -335,11 +334,9 @@ public void testFollowsTwoRelocations() throws IOException {
335334
() -> new TaskId(randomAlphaOfLength(10), randomIntBetween(1, 1000))
336335
);
337336

338-
final TaskRelocatedException firstRelocation = new TaskRelocatedException();
339-
firstRelocation.setOriginalAndRelocatedTaskIdMetadata(originalTaskId, firstRelocatedTaskId);
337+
final var firstRelocation = new TaskRelocatedException(originalTaskId, firstRelocatedTaskId);
340338

341-
final TaskRelocatedException secondRelocation = new TaskRelocatedException();
342-
secondRelocation.setOriginalAndRelocatedTaskIdMetadata(firstRelocatedTaskId, secondRelocatedTaskId);
339+
final var secondRelocation = new TaskRelocatedException(firstRelocatedTaskId, secondRelocatedTaskId);
343340

344341
final TaskInfo originalInfo = createTaskInfo(originalTaskId, ReindexAction.NAME);
345342
final TaskResult originalResult = new TaskResult(originalInfo, (Exception) firstRelocation);
@@ -385,8 +382,7 @@ public void testWaitForCompletionHandlesRelocationWhileWaiting() throws IOExcept
385382
final TaskId originalTaskId = taskId;
386383
final TaskId relocatedTaskId = randomValueOtherThan(taskId, () -> new TaskId(randomAlphaOfLength(10), randomIntBetween(1, 1000)));
387384

388-
final TaskRelocatedException relocatedException = new TaskRelocatedException();
389-
relocatedException.setOriginalAndRelocatedTaskIdMetadata(originalTaskId, relocatedTaskId);
385+
final var relocatedException = new TaskRelocatedException(originalTaskId, relocatedTaskId);
390386

391387
final TaskInfo originalInfo = createTaskInfo(originalTaskId, ReindexAction.NAME);
392388
final TaskResult originalIncomplete = new TaskResult(false, originalInfo);
@@ -450,8 +446,7 @@ public void testRelocatedTaskNotFound() throws IOException {
450446
final TaskId originalTaskId = taskId;
451447
final TaskId relocatedTaskId = randomValueOtherThan(taskId, () -> new TaskId(randomAlphaOfLength(10), randomIntBetween(1, 1000)));
452448

453-
final TaskRelocatedException relocatedException = new TaskRelocatedException();
454-
relocatedException.setOriginalAndRelocatedTaskIdMetadata(originalTaskId, relocatedTaskId);
449+
final var relocatedException = new TaskRelocatedException(originalTaskId, relocatedTaskId);
455450

456451
final TaskInfo originalInfo = createTaskInfo(originalTaskId, ReindexAction.NAME);
457452
final TaskResult originalResult = new TaskResult(originalInfo, (Exception) relocatedException);

0 commit comments

Comments
 (0)