This is an automated email from the ASF dual-hosted git repository. tanxinyu pushed a commit to branch snapshot-3 in repository https://gitbox.apache.org/repos/asf/ratis.git
commit 8d0b50b2b49fe23758dc2ee9fa03e983067a14d3 Author: Tsz-Wo Nicholas Sze <[email protected]> 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();
