You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by tk...@apache.org on 2025/10/20 09:56:39 UTC
(ignite-3) 01/01: IGNITE-26721 wip
This is an automated email from the ASF dual-hosted git repository.
tkalkirill pushed a commit to branch ignite-26721
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit dfd878d523139542f73d485274317753f8a326c6
Author: Kirill Tkalenko <tk...@yandex.ru>
AuthorDate: Mon Oct 20 12:56:21 2025 +0300
IGNITE-26721 wip
---
.../ignite/internal/raft/RaftGroupServiceImpl.java | 21 +++++++++++++++++----
.../apache/ignite/internal/raft/RetryContext.java | 16 +++++++++++++++-
2 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/modules/raft/src/main/java/org/apache/ignite/internal/raft/RaftGroupServiceImpl.java b/modules/raft/src/main/java/org/apache/ignite/internal/raft/RaftGroupServiceImpl.java
index 27b8873491d..7ca0971886f 100644
--- a/modules/raft/src/main/java/org/apache/ignite/internal/raft/RaftGroupServiceImpl.java
+++ b/modules/raft/src/main/java/org/apache/ignite/internal/raft/RaftGroupServiceImpl.java
@@ -500,7 +500,7 @@ public class RaftGroupServiceImpl implements RaftGroupService {
.forced(forced)
.build();
- return sendWithRetry(peer, requestFactory, false)
+ return sendWithRetry(peer, -1, Long.MAX_VALUE, NO_DESCRIPTION, requestFactory, false)
.thenAccept(resp -> {});
}
@@ -604,7 +604,7 @@ public class RaftGroupServiceImpl implements RaftGroupService {
Function<Peer, ? extends NetworkMessage> requestFactory,
boolean throttleOnOverload
) {
- return sendWithRetry(peer, defaultTimeout(), NO_DESCRIPTION, requestFactory, throttleOnOverload);
+ return sendWithRetry(peer, defaultTimeout(), -1, NO_DESCRIPTION, requestFactory, throttleOnOverload);
}
private <R extends NetworkMessage> CompletableFuture<R> sendWithRetry(
@@ -613,6 +613,17 @@ public class RaftGroupServiceImpl implements RaftGroupService {
Supplier<String> originDescription,
Function<Peer, ? extends NetworkMessage> requestFactory,
boolean throttleOnOverload
+ ) {
+ return sendWithRetry(peer, timeoutMillis, -1, originDescription, requestFactory, throttleOnOverload);
+ }
+
+ private <R extends NetworkMessage> CompletableFuture<R> sendWithRetry(
+ Peer peer,
+ long timeoutMillis,
+ long responseTimeoutMillis,
+ Supplier<String> originDescription,
+ Function<Peer, ? extends NetworkMessage> requestFactory,
+ boolean throttleOnOverload
) {
var future = new CompletableFuture<R>();
@@ -636,7 +647,7 @@ public class RaftGroupServiceImpl implements RaftGroupService {
}
long stopTime = timeoutMillis >= 0 ? currentTimeMillis() + timeoutMillis : Long.MAX_VALUE;
- var context = new RetryContext(groupId, peer, originDescription, requestFactory, stopTime);
+ var context = new RetryContext(groupId, peer, originDescription, requestFactory, stopTime, responseTimeoutMillis);
sendWithRetry(future, context, peerThrottlingContextHolder);
@@ -689,7 +700,9 @@ public class RaftGroupServiceImpl implements RaftGroupService {
}
peerThrottlingContextHolder.beforeRequest();
- long responseTimeout = peerThrottlingContextHolder.peerRequestTimeoutMillis();
+
+ long responseTimeout = retryContext.responseTimeoutMillis() == -1
+ ? peerThrottlingContextHolder.peerRequestTimeoutMillis() : retryContext.responseTimeoutMillis();
resolvePeer(retryContext.targetPeer())
.thenCompose(node -> cluster.messagingService()
diff --git a/modules/raft/src/main/java/org/apache/ignite/internal/raft/RetryContext.java b/modules/raft/src/main/java/org/apache/ignite/internal/raft/RetryContext.java
index e1974cf1301..fe2a7dfbad3 100644
--- a/modules/raft/src/main/java/org/apache/ignite/internal/raft/RetryContext.java
+++ b/modules/raft/src/main/java/org/apache/ignite/internal/raft/RetryContext.java
@@ -92,6 +92,8 @@ class RetryContext {
private long attemptStartTime;
+ private final long responseTimeoutMillis;
+
/**
* Creates a context.
*
@@ -101,13 +103,16 @@ class RetryContext {
* this request is independent.
* @param requestFactory Factory for creating requests to the target peer.
* @param stopTime Timestamp that denotes the point in time up to which retry attempts will be made.
+ * @param responseTimeoutMillis Response timeout for each attempt (up to {@code stopTime}) in milliseconds, {@code -1} if using
+ * {@link ThrottlingContextHolder#peerRequestTimeoutMillis} (default).
*/
RetryContext(
String groupId,
Peer targetPeer,
Supplier<String> originDescription,
Function<Peer, ? extends NetworkMessage> requestFactory,
- long stopTime
+ long stopTime,
+ long responseTimeoutMillis
) {
this.groupId = groupId;
this.targetPeer = targetPeer;
@@ -118,6 +123,7 @@ class RetryContext {
this.startTime = System.currentTimeMillis();
this.attemptScheduleTime = this.startTime;
this.attemptStartTime = this.startTime;
+ this.responseTimeoutMillis = responseTimeoutMillis;
}
Peer targetPeer() {
@@ -241,4 +247,12 @@ class RetryContext {
return "[time=" + timestamp + ", msg=" + reason + "]";
}
}
+
+ /**
+ * Returns response timeout for each attempt (up to {@code stopTime}) in milliseconds, {@code -1} if using
+ * {@link ThrottlingContextHolder#peerRequestTimeoutMillis} (default).
+ */
+ long responseTimeoutMillis() {
+ return responseTimeoutMillis;
+ }
}