ivandika3 commented on code in PR #945:
URL: https://github.com/apache/ratis/pull/945#discussion_r1367871641
##########
ratis-common/src/main/java/org/apache/ratis/protocol/RoutingTable.java:
##########
@@ -159,7 +164,7 @@ public String toString() {
/** @return a new {@link RoutingTable} represented by the given map. */
static RoutingTable newRoutingTable(Map<RaftPeerId, Set<RaftPeerId>> map){
- Builder.validate(map);
+ RaftPeerId primary = Builder.validate(map);
Review Comment:
Thank you for the review. Updated based on the patch diff.
##########
ratis-client/src/main/java/org/apache/ratis/client/impl/DataStreamClientImpl.java:
##########
@@ -230,6 +231,14 @@ public DataStreamOutputRpc stream(ByteBuffer
headerMessage) {
@Override
public DataStreamOutputRpc stream(ByteBuffer headerMessage, RoutingTable
routingTable) {
+ if (routingTable != null && routingTable.getPrimary() != null) {
+ // Validate that the primary peer is equal to the primary peer passed
+ // by the RoutingTable
+ Preconditions.assertTrue(
+ dataStreamServer.getId().equals(routingTable.getPrimary()),
+ "The primary peer in the routing table is not the same " +
+ "with the one specified in the client");
Review Comment:
Thank you for the review. Updated based on the patch diff.
##########
ratis-client/src/main/java/org/apache/ratis/client/impl/DataStreamClientImpl.java:
##########
@@ -230,6 +231,14 @@ public DataStreamOutputRpc stream(ByteBuffer
headerMessage) {
@Override
public DataStreamOutputRpc stream(ByteBuffer headerMessage, RoutingTable
routingTable) {
+ if (routingTable != null && routingTable.getPrimary() != null) {
Review Comment:
Thank you for the review. Updated based on the patch diff.
--
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]