Skip to content

Migrate from HLRC to elasticsearch-java 8.x client - #1

Merged
yeikel merged 8 commits into
masterfrom
migrate-java-client
Jul 9, 2026
Merged

Migrate from HLRC to elasticsearch-java 8.x client#1
yeikel merged 8 commits into
masterfrom
migrate-java-client

Conversation

@yeikel

@yeikel yeikel commented May 6, 2026

Copy link
Copy Markdown
Owner

Same as confluentinc#920 but CI runs here

@yeikel yeikel changed the title Upgrade TestContainers to 1.21.4 to fix Docker Engine 29.x incompatib… Migrate to Java client May 6, 2026
@yeikel yeikel closed this May 6, 2026
@yeikel yeikel reopened this May 6, 2026
@yeikel
yeikel force-pushed the migrate-java-client branch 3 times, most recently from f43efd9 to 024302d Compare May 6, 2026 22:56
Repository owner deleted a comment from github-actions Bot May 7, 2026
@yeikel
yeikel force-pushed the migrate-java-client branch 3 times, most recently from 34a8f3f to 7633ea6 Compare May 14, 2026 01:25
Comment thread src/test/java/io/confluent/connect/elasticsearch/ElasticsearchClientTest.java Outdated
Comment thread src/test/java/io/confluent/connect/elasticsearch/ElasticsearchClientTest.java Outdated
@yeikel
yeikel force-pushed the migrate-java-client branch 7 times, most recently from 57a7517 to 4a6d2ce Compare May 15, 2026 06:41
Repository owner deleted a comment from github-actions Bot May 15, 2026
@yeikel
yeikel force-pushed the migrate-java-client branch 10 times, most recently from 2be24cc to 643eada Compare May 15, 2026 21:22
@yeikel yeikel changed the title Migrate to Java client Migrate from HLRC to elasticsearch-java 8.x client May 15, 2026
@yeikel
yeikel force-pushed the migrate-java-client branch 10 times, most recently from 6157170 to 5bee901 Compare May 19, 2026 21:01
@yeikel
yeikel force-pushed the migrate-java-client branch 4 times, most recently from ee4e127 to 83888d1 Compare May 29, 2026 03:48
yeikel added 7 commits May 28, 2026 23:50
Replace the deprecated High Level REST Client with the new
elasticsearch-java 8.x client.
…ntainer

throwIfFailed() was calling close() before propagating the error. close()
calls BulkIngester.close() with a flushTimeoutMs=3min timeout waiting for
in-flight requests to drain. With ES down, this blocked the task thread for
up to 3 minutes, preventing the task from transitioning to FAILED until after
the test's 2-minute await window expired.

The Connect framework calls task.stop() -> client.close() immediately after
put() throws, so the defensive close inside throwIfFailed() was redundant.
Removing it lets the task fail fast via the standard task lifecycle.
…eadlock

BulkIngester submits afterBulk callbacks to bulkScheduler via scheduler.submit().
Its single scheduler thread can block inside FnCondition.awaitUninterruptibly()
while waiting for a concurrency slot (requestsInFlightCount < maxConcurrentRequests).

When DispatchingTransport shared bulkScheduler for retry tasks (introduced in the
previous commit), that created a deadlock:

  1. bulkScheduler thread blocks in sendRequestCondition.awaitUninterruptibly()
     waiting for an in-flight slot to free up.
  2. Freeing a slot requires result.completeExceptionally() to fire, which requires
     the retry task to run.
  3. The retry task is queued in bulkScheduler, but bulkScheduler is blocked.
  4. Neither side can proceed — the connector task stays RUNNING indefinitely.

Fix: give DispatchingTransport its own dedicated single-threaded retryScheduler so
retry tasks are never blocked by BulkIngester's flush tasks.
@yeikel
yeikel force-pushed the migrate-java-client branch from 83888d1 to 80672d1 Compare May 29, 2026 03:50
BulkIngester.backoffPolicy and DispatchingTransport both used
config.maxRetries(), causing up to (maxRetries+1)^2 HTTP requests per
document: each BulkIngester per-item 429 retry issued a new bulk request
that re-entered DispatchingTransport with a fresh retry budget.

Removing backoffPolicy gives DispatchingTransport sole ownership of the
retry budget. HTTP-level 429s (whole-request) continue to be retried as
exceptions by DispatchingTransport; per-item 429s in a 200 response go
to the listener's error path (DLQ + task failure), matching pre-migration
HLRC behavior.
@yeikel
yeikel force-pushed the migrate-java-client branch 4 times, most recently from 30294de to 4c357d9 Compare June 1, 2026 01:42
@yeikel
yeikel marked this pull request as ready for review July 9, 2026 18:18
@yeikel
yeikel merged commit 5b27429 into master Jul 9, 2026
37 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant