bshashikant commented on a change in pull request #2155:
URL: https://github.com/apache/ozone/pull/2155#discussion_r616419898
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java
##########
@@ -184,11 +186,20 @@ public void
notifyNotLeader(Collection<TransactionContext> pendingEntries) {
@Override
public CompletableFuture<TermIndex> notifyInstallSnapshotFromLeader(
RaftProtos.RoleInfoProto roleInfoProto, TermIndex firstTermIndexInLog) {
-
- String leaderNodeId = RaftPeerId.valueOf(roleInfoProto.getFollowerInfo()
- .getLeaderInfo().getId().getId()).toString();
+ if (!roleInfoProto.getFollowerInfo().hasLeaderInfo()) {
+ return JavaUtils.completeExceptionally(new IOException("Failed " +
+ "notifyInstallSnapshotFromLeader due to missing leader info"));
+ }
+ String leaderAddress = roleInfoProto.getFollowerInfo()
+ .getLeaderInfo().getId().getAddress();
+ Optional<SCMNodeDetails> leaderDetails =
+ scm.getSCMHANodeDetails().getPeerNodeDetails().stream().filter(
+ p -> p.getRatisHostPortStr().equals(leaderAddress))
+ .findFirst();
+ Preconditions.checkNotNull(leaderDetails);
Review comment:
Done
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java
##########
@@ -184,11 +186,20 @@ public void
notifyNotLeader(Collection<TransactionContext> pendingEntries) {
@Override
public CompletableFuture<TermIndex> notifyInstallSnapshotFromLeader(
RaftProtos.RoleInfoProto roleInfoProto, TermIndex firstTermIndexInLog) {
-
- String leaderNodeId = RaftPeerId.valueOf(roleInfoProto.getFollowerInfo()
- .getLeaderInfo().getId().getId()).toString();
+ if (!roleInfoProto.getFollowerInfo().hasLeaderInfo()) {
+ return JavaUtils.completeExceptionally(new IOException("Failed " +
Review comment:
Done
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]