szetszwo commented on code in PR #9682:
URL: https://github.com/apache/ozone/pull/9682#discussion_r2737757670
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OMRatisHelper.java:
##########
@@ -64,14 +64,14 @@ public static OMResponse
convertByteStringToOMResponse(ByteString bytes) throws
}
/** Convert the given reply with proto 3 {@link ByteString} to a proto 2
response. */
- public static OMResponse getOMResponseFromRaftClientReply(RaftClientReply
reply) throws IOException {
+ public static OMResponse getOMResponseFromRaftClientReply(RaftClientReply
reply, String leaderOMNodeId)
+ throws IOException {
final OMResponse response =
convertByteStringToOMResponse(reply.getMessage().getContent());
- if (reply.getReplierId().equals(response.getLeaderOMNodeId())) {
- return response;
+ OMResponse.Builder omResponse = OMResponse.newBuilder(response);
+ if (leaderOMNodeId != null) {
+ omResponse.setLeaderOMNodeId(leaderOMNodeId);
}
- return OMResponse.newBuilder(response)
- .setLeaderOMNodeId(reply.getReplierId())
- .build();
+ return omResponse.build();
Review Comment:
Pass RaftPeerId and rebuild response only if leaderOMNodeId != null.
```java
public static OMResponse getOMResponseFromRaftClientReply(RaftClientReply
reply, RaftPeerId leaderOMNodeId)
throws IOException {
final OMResponse response =
convertByteStringToOMResponse(reply.getMessage().getContent());
if (leaderOMNodeId == null) {
return response;
}
return OMResponse.newBuilder(response)
.setLeaderOMNodeId(leaderOMNodeId.toString())
.build();
}
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]