Skip to content

Commit 0ee4c18

Browse files
authored
Fix BulkInferenceExecutorTests timeout caused by a race condition. (#130991)
1 parent 2f364bf commit 0ee4c18

File tree

3 files changed

+303
-185
lines changed

3 files changed

+303
-185
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/inference/bulk/BulkInferenceExecutionState.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public class BulkInferenceExecutionState {
2727
private final Map<Long, InferenceAction.Response> bufferedResponses;
2828
private final AtomicBoolean finished = new AtomicBoolean(false);
2929

30-
public BulkInferenceExecutionState(int bufferSize) {
31-
this.bufferedResponses = new ConcurrentHashMap<>(bufferSize);
30+
public BulkInferenceExecutionState() {
31+
this.bufferedResponses = new ConcurrentHashMap<>();
3232
}
3333

3434
/**
@@ -125,7 +125,7 @@ public void addFailure(Exception e) {
125125
* Indicates whether the entire bulk execution is marked as finished and all responses have been successfully persisted.
126126
*/
127127
public boolean finished() {
128-
return finished.get() && getMaxSeqNo() == getPersistedCheckpoint();
128+
return hasFailure() || (finished.get() && getMaxSeqNo() == getPersistedCheckpoint());
129129
}
130130

131131
/**

0 commit comments

Comments
 (0)