dpol1 commented on issue #3009:
URL: https://github.com/apache/hugegraph/issues/3009#issuecomment-4321577019
## Proposed Fix Approaches
Two implementation strategies are under consideration to add retry support
to `commitAsync()`.
---
### Option A — Synchronous fallback
**Estimated effort:** Easy but to refine later
Reuse the existing `executeWithRetry()` for each statement in the async path,
collecting results synchronously. This eliminates the need for any new
infrastructure
and guarantees consistent retry semantics with `commit()`.
for (Statement s : statements) {
this.executeWithRetry(s);
}
**Pros**
- Minimal code change — reuses tested, reviewed retry logic
- No new dependencies
- Immediately consistent with `commit()` behaviour
**Cons**
- Loses batched-async throughput; `commitAsync()` becomes semantically
equivalent to per-statement `commit()` calls
---
### Option B — True async retry with `ListenableFuture`
**Estimated effort:** High complexity but solid + tests
Wrap each `ResultSetFuture` in a retry chain using `Futures.catching()` from
Guava
(already a transitive dependency via Datastax). Preserves async throughput
and
adds retry semantics without blocking the calling thread.
**Pros**
- Correct long-term solution — maintains true async throughput
- Consistent retry semantics across both write paths
**Cons**
- Must handle interrupt, thread-pool selection, and retry-counter propagation
- Requires dedicated unit and integration tests
---
### Recommended path
Ship **Option A** as a short-term fix, then follow up with **Option B** once
the async retry implementation is validated.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]