Conversation
Contributor
💥 Breaking changes detected !!Either this PR or a previous PR not released yet introduced breaking changes, be careful when merging. ✔️ Code generated!
📊 Benchmark resultsBenchmarks performed on the method using a mock server, the results might not reflect the real-world performance.
|
eric-zaharia
previously approved these changes
Jul 16, 2026
Fluf22
force-pushed
the
feat/java-async-batch-helpers
branch
from
July 16, 2026 16:09
6c9c70a to
77839a0
Compare
Summary by Aikido
🚀 New Features
⚡ Enhancements
🐛 Bugfixes
🔧 Refactors
|
Adds CompletableFuture-returning batch helpers to the Java v4 SearchClient (chunkedBatchAsync, saveObjectsAsync, partialUpdateObjectsAsync, deleteObjectsAsync), restoring the async surface lost in the v3 -> v4 upgrade (customer escalation CR-11794). All helpers share one private wave-based async core; the sync chunkedBatch is reimplemented on top of it with byte-for-byte equivalent request behavior, and an opt-in maxConcurrency knob (default 1, sequential) is added to ChunkedHelperOptions. - Fixes deleteObjects(indexName, objectIDs, requestOptions) silently dropping the caller's requestOptions. - chunkedBatch now rejects batchSize < 1 with AlgoliaRuntimeException, matching chunkedPush's existing guard. - Java-only by design: 7 of the 11 clients are already async-idiomatic (C#, Kotlin, Scala, JS, Swift, Dart, Python) and Go/PHP/Ruby are idiomatically blocking; Java is the only client with a first-class async idiom whose helpers lacked it.
- Move async helpers into templates/java/async_batch_helpers.mustache partial - Collapse duplicated hazard Javadoc onto chunkedBatchAsync and ChunkedHelperOptions.setMaxConcurrency as canonical homes - Drop the chunkedBatchAsyncInternal pass-through and the unnecessary synchronizedList (waves are strictly sequential) - Run wave continuations on the client executor via ApiClient.getExecutor() instead of ForkJoinPool.commonPool() - Dedup deleteObjects objectID wrapping into objectIDsToDeleteRequests
Sync chunkedBatch drives waves on the calling thread instead of awaiting chunkedBatchAsync, so the Iterable is never consumed on the client executor, iterator exceptions propagate unwrapped, and interrupts stop further waves. chunkedBatchAsync now reports Iterable failures in the first wave through the returned future.
Fluf22
force-pushed
the
feat/java-async-batch-helpers
branch
from
September 25, 2026 08:10
e23baca to
bb330ab
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧭 What and Why
🎟 JIRA Ticket: CR-11794
Customers migrating from Java v3 lost the async batch-indexing helpers (
partialUpdateObjectsAsyncand friends) and now have to block application threads on bulk updates. This restores aCompletableFuturesurface for the batch helpers, backed by the same core the sync helpers use, plus an opt-inmaxConcurrencyknob (default 1 = today's exact sequential semantics). Java-only on purpose: the other ten clients are either already async-idiomatic or idiomatically blocking.Changes included:
chunkedBatchAsync,saveObjectsAsync,partialUpdateObjectsAsync,deleteObjectsAsynconSearchClient. Async variants don't wait for tasks — callwaitForTaskper taskID, or use the sync variant.ChunkedHelperOptions.maxConcurrencyto parallelize chunk uploads, off by default.deleteObjects(indexName, objectIDs, requestOptions)silently dropped itsrequestOptions;batchSize < 1is now rejected.🧪 Test
Hand-written JUnit suite (
com.algolia.manual, runs in CTS) covering chunking math, concurrency bounds, failure propagation, and sync/async request equivalence.Reviewer note: the wave recursion uses
thenComposeAsyncon the client executor deliberately — plainthenComposecan nest on the stack when futures complete before callback registration.