You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by sz...@apache.org on 2024/08/22 18:35:46 UTC
(ratis) 18/25: RATIS-2135. The leader keeps sending inconsistent entries repeatedly to followers. (#1132)
This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a commit to branch branch-3.1.1_review
in repository https://gitbox.apache.org/repos/asf/ratis.git
commit a78e6e2df822eea2bb534fdca3c55c1e77465232
Author: Tsz-Wo Nicholas Sze <sz...@apache.org>
AuthorDate: Mon Aug 12 09:22:51 2024 -0700
RATIS-2135. The leader keeps sending inconsistent entries repeatedly to followers. (#1132)
---
.../org/apache/ratis/grpc/server/GrpcService.java | 23 ++++++++--------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcService.java b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcService.java
index 097900a0f..5997c5429 100644
--- a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcService.java
+++ b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcService.java
@@ -63,8 +63,7 @@ public final class GrpcService extends RaftServerRpcWithProxy<GrpcServerProtocol
class AsyncService implements RaftServerAsynchronousProtocol {
@Override
- public CompletableFuture<AppendEntriesReplyProto> appendEntriesAsync(AppendEntriesRequestProto request)
- throws IOException {
+ public CompletableFuture<AppendEntriesReplyProto> appendEntriesAsync(AppendEntriesRequestProto request) {
throw new UnsupportedOperationException("This method is not supported");
}
@@ -97,7 +96,6 @@ public final class GrpcService extends RaftServerRpcWithProxy<GrpcServerProtocol
public static final class Builder {
private RaftServer server;
- private GrpcTlsConfig tlsConfig;
private GrpcTlsConfig adminTlsConfig;
private GrpcTlsConfig clientTlsConfig;
private GrpcTlsConfig serverTlsConfig;
@@ -113,11 +111,6 @@ public final class GrpcService extends RaftServerRpcWithProxy<GrpcServerProtocol
return new GrpcService(server, adminTlsConfig, clientTlsConfig, serverTlsConfig);
}
- public Builder setTlsConfig(GrpcTlsConfig tlsConfig) {
- this.tlsConfig = tlsConfig;
- return this;
- }
-
public Builder setAdminTlsConfig(GrpcTlsConfig config) {
this.adminTlsConfig = config;
return this;
@@ -132,10 +125,6 @@ public final class GrpcService extends RaftServerRpcWithProxy<GrpcServerProtocol
this.serverTlsConfig = config;
return this;
}
-
- public GrpcTlsConfig getTlsConfig() {
- return tlsConfig;
- }
}
public static Builder newBuilder() {
@@ -188,10 +177,14 @@ public final class GrpcService extends RaftServerRpcWithProxy<GrpcServerProtocol
super(idSupplier, id -> new PeerProxyMap<>(id.toString(),
p -> new GrpcServerProtocolClient(p, flowControlWindow.getSizeInt(),
requestTimeoutDuration, serverTlsConfig, useSeparateHBChannel)));
- if (appenderBufferSize.getSize() > grpcMessageSizeMax.getSize()) {
+
+ final SizeInBytes gap = SizeInBytes.ONE_MB;
+ final long diff = grpcMessageSizeMax.getSize() - appenderBufferSize.getSize();
+ if (diff < gap.getSize()) {
throw new IllegalArgumentException("Illegal configuration: "
- + RaftServerConfigKeys.Log.Appender.BUFFER_BYTE_LIMIT_KEY + " = " + appenderBufferSize
- + " > " + GrpcConfigKeys.MESSAGE_SIZE_MAX_KEY + " = " + grpcMessageSizeMax);
+ + GrpcConfigKeys.MESSAGE_SIZE_MAX_KEY + "(= " + grpcMessageSizeMax
+ + ") must be " + gap + " larger than "
+ + RaftServerConfigKeys.Log.Appender.BUFFER_BYTE_LIMIT_KEY + "(= " + appenderBufferSize + ").");
}
final RaftProperties properties = raftServer.getProperties();