Lalant commented on code in PR #7379:
URL: https://github.com/apache/ignite-3/pull/7379#discussion_r2697687990
##########
modules/replicator/src/main/java/org/apache/ignite/internal/replicator/PlacementDriverMessageProcessor.java:
##########
@@ -259,18 +259,51 @@ 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);
+ long timeout = expirationTime - currentTimeMillis();
+
+ LOG.info("Waiting for actual storage state [groupId={},
leaseStartTime={},"
+ + " expirationTime={}, timeoutMs={}]",
+ groupId, startTime, expirationTime, timeout);
replicaReservationClosure.accept(groupId, startTime);
- long timeout = expirationTime - currentTimeMillis();
if (timeout <= 0) {
- return failedFuture(new TimeoutException());
+ LOG.warn("Timeout already expired before starting wait
[groupId={}, expirationTime={}, currentTime={}]",
+ groupId, expirationTime, currentTimeMillis());
+ return failedFuture(new TimeoutException("Timeout expired before
starting wait"));
}
+ long readIndexStartTime = currentTimeMillis();
+
return retryOperationUntilSuccess(raftClient::readIndex, e ->
currentTimeMillis() > expirationTime, executor)
- .orTimeout(timeout, TimeUnit.MILLISECONDS)
- .thenCompose(storageIndexTracker::waitFor);
+ .whenComplete((raftIndex, readIndexError) -> {
+ long readIndexDuration = currentTimeMillis() -
readIndexStartTime;
+
+ if (readIndexError != null) {
+ LOG.warn("Failed to read index from raft leader
[groupId={}, durationMs={}, error={}]",
+ groupId, readIndexDuration, readIndexError);
+ }
+ })
+ .thenCompose(raftIndex -> {
Review Comment:
As we discussed this one possible to implement, but at the end it didn't
look better, moreover with whenComplete we separate error logging from main
flow and make the last one more readable.
--
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]