Skip to content

Commit 6e4defd

Browse files
Relax Overly Strict Assertion in TransportShardBulkAction (#40940)
* Remove Overly Strict Assertion in TransportShardBulkAction * In #39793 this assertion was added under the assumption that no exceptions would be thrown in this method, which turned out not to be correct and at the very least `org.elasticsearch.index.shard.IndexShardClosedException` can be thrown by `org.elasticsearch.index.shard.IndexShard.sync` * Closes #40933
1 parent 97247e1 commit 6e4defd

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

server/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public static void performOnPrimary(
147147
Consumer<ActionListener<Void>> waitForMappingUpdate,
148148
ActionListener<PrimaryResult<BulkShardRequest, BulkShardResponse>> listener,
149149
ThreadPool threadPool) {
150-
new ActionRunnable<PrimaryResult<BulkShardRequest, BulkShardResponse>>(listener) {
150+
new ActionRunnable<>(listener) {
151151

152152
private final Executor executor = threadPool.executor(ThreadPool.Names.WRITE);
153153

@@ -189,11 +189,11 @@ public void onRejection(Exception e) {
189189
}
190190

191191
private void finishRequest() {
192-
listener.onResponse(
193-
new WritePrimaryResult<>(context.getBulkShardRequest(), context.buildShardResponse(), context.getLocationToSync(),
194-
null, context.getPrimary(), logger));
192+
ActionListener.completeWith(listener,
193+
() -> new WritePrimaryResult<>(
194+
context.getBulkShardRequest(), context.buildShardResponse(), context.getLocationToSync(), null,
195+
context.getPrimary(), logger));
195196
}
196-
197197
}.run();
198198
}
199199

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/AnnotationIndexIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public void testNotCreatedWhenNoOtherMlIndices() {
5151
}
5252
}
5353

54-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/40933")
5554
public void testCreatedWhenAfterOtherMlIndex() throws Exception {
5655

5756
Auditor auditor = new Auditor(client(), "node_1");

0 commit comments

Comments
 (0)