133tosakarin commented on code in PR #1154:
URL: https://github.com/apache/ratis/pull/1154#discussion_r1776179935
##########
ratis-server/src/main/java/org/apache/ratis/server/leader/InstallSnapshotRequests.java:
##########
@@ -143,11 +143,9 @@ public InstallSnapshotRequestProto next() {
}
private InstallSnapshotRequestProto
newInstallSnapshotRequest(FileChunkProto chunk, boolean done) {
- synchronized (server) {
- final SnapshotChunkProto.Builder b =
LeaderProtoUtils.toSnapshotChunkProtoBuilder(
- requestId, requestIndex++, snapshot.getTermIndex(), chunk,
totalSize, done);
- return LeaderProtoUtils.toInstallSnapshotRequestProto(server,
followerId, b);
- }
+ final SnapshotChunkProto.Builder b =
LeaderProtoUtils.toSnapshotChunkProtoBuilder(
+ requestId, requestIndex++, snapshot.getTermIndex(), chunk,
totalSize, done);
+ return LeaderProtoUtils.toInstallSnapshotRequestProto(server,
followerId, b);
Review Comment:
Thanks for the review, I will make changes
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RoleInfo.java:
##########
@@ -47,7 +47,7 @@ class RoleInfo {
public static final Logger LOG = LoggerFactory.getLogger(RoleInfo.class);
private final RaftPeerId id;
- private volatile RaftPeerRole role;
+ private final AtomicReference<RaftPeerRole> role = new AtomicReference<>();
Review Comment:
Thanks for the review, I will make changes
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerState.java:
##########
@@ -58,7 +58,7 @@
* Common states of a raft peer. Protected by RaftServer's lock.
*/
class ServerState {
- private final RaftGroupMemberId memberId;
+ private final AtomicReference<RaftGroupMemberId> memberId = new
AtomicReference<>();
Review Comment:
Thanks for the review, I will make changes
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderStateImpl.java:
##########
@@ -219,11 +219,11 @@ void addAll(Collection<LogAppender> newSenders) {
Preconditions.assertTrue(changed);
}
- boolean removeAll(Collection<LogAppender> c) {
+ synchronized boolean removeAll(Collection<LogAppender> c) {
return senders.removeAll(c);
}
- CompletableFuture<Void> stopAll() {
+ synchronized CompletableFuture<Void> stopAll() {
Review Comment:
Thanks for the review, I will make changes
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/ConfigurationManager.java:
##########
@@ -78,7 +78,7 @@ private void addRaftConfigurationImpl(long logIndex,
RaftConfigurationImpl conf)
}
}
- RaftConfigurationImpl getCurrent() {
+ synchronized RaftConfigurationImpl getCurrent() {
return currentConf;
}
Review Comment:
Thanks for the review, I will make changes
--
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]