Skip to content

Commit

Permalink
RATIS-2135. The leader keeps sending inconsistent entries repeatedly …
Browse files Browse the repository at this point in the history
…to followers.
  • Loading branch information
szetszwo committed Aug 9, 2024
1 parent ebeab93 commit cc2d49e
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,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");
}

Expand Down Expand Up @@ -99,7 +98,6 @@ public void onCompleted() {

public static final class Builder {
private RaftServer server;
private GrpcTlsConfig tlsConfig;
private GrpcTlsConfig adminTlsConfig;
private GrpcTlsConfig clientTlsConfig;
private GrpcTlsConfig serverTlsConfig;
Expand All @@ -115,11 +113,6 @@ public GrpcService build() {
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;
Expand All @@ -134,10 +127,6 @@ public Builder setServerTlsConfig(GrpcTlsConfig config) {
this.serverTlsConfig = config;
return this;
}

public GrpcTlsConfig getTlsConfig() {
return tlsConfig;
}
}

public static Builder newBuilder() {
Expand Down Expand Up @@ -192,10 +181,14 @@ private GrpcService(RaftServer raftServer, Supplier<RaftPeerId> idSupplier,
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();
Expand Down

0 comments on commit cc2d49e

Please sign in to comment.