wenjin272 commented on PR #162:
URL:
https://github.com/apache/flink-connector-elasticsearch/pull/162#issuecomment-5394153822
The CI failure seems to be caused by the existing test relying on the old
`close()` behavior. In `testHandlePartiallyFailedBulk`, the second `write()`
submits an asynchronous bulk request, but the try-with-resources block closes
the writer before `await()` is called. With this change, `close()` actually
closes the transport, so the pending request no longer invokes the result
handler and the test times out.
I reproduced this locally on JDK 17. Reverting only the `close()` change
makes both secured and unsecured variants pass, so this is not JDK 21-specific.
I think the production change should be kept, while the test should wait for
the callback before leaving the try block:
```java
try (Elasticsearch8AsyncWriter<DummyData> writer =
createWriter(maxBatchSize, elementConverter)) {
writer.write(new DummyData("test-1", "test-1-updated"), null);
writer.write(new DummyData("test-2", "test-2-updated"), null);
await();
}
```
It may also be worth replacing the current `Condition`-based signaling with
a `CountDownLatch` to avoid losing the signal if the callback completes before
`await()` starts.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]