Lalant commented on code in PR #7379:
URL: https://github.com/apache/ignite-3/pull/7379#discussion_r2698012019
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/PlacementDriverMessageProcessor.java:
##########
@@ -259,18 +272,137 @@ private CompletableFuture<LeaseGrantedMessageResponse>
proposeLeaseRedirect(Inte
* @return Future that is completed when local storage catches up the
index that is actual for leader on the moment of request.
*/
private CompletableFuture<Void> waitForActualState(HybridTimestamp
startTime, long expirationTime) {
- LOG.info("Waiting for actual storage state, group=" + groupId);
+ LOG.info("Waiting for actual storage state [groupId={},
expirationTime={}, timeoutMs={}, leaseStartTime={}]",
+ groupId, expirationTime, expirationTime -
currentTimeMillis(), startTime);
replicaReservationClosure.accept(groupId, startTime);
- long timeout = expirationTime - currentTimeMillis();
- if (timeout <= 0) {
- return failedFuture(new TimeoutException());
+ TimeTracker readIndexTimeTracker = new TimeTracker(
+ expirationTime,
+ groupId,
+ "Timeout is expired before raft index reading started");
+ if (readIndexTimeTracker.isExpired()) {
+ return readIndexTimeTracker.getFailedFuture();
+ }
+
+ return retryOperationUntilSuccessOrTimeout(raftClient::readIndex,
readIndexTimeTracker.getTimeoutMs(), executor)
+ .whenComplete((raftIndex, readIndexError) -> {
+ if (readIndexError != null) {
+ LOG.warn("Failed to read index from raft leader"
+ + " [groupId={}, , expirationTime={},
timeoutMs={}, durationMs={}]", readIndexError,
Review Comment:
Done
--
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]