You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/02/17 06:27:03 UTC
[GitHub] [pulsar] Jason918 commented on a change in pull request #14336: Validate rack name
Jason918 commented on a change in pull request #14336:
URL: https://github.com/apache/pulsar/pull/14336#discussion_r808710505
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Bookies.java
##########
@@ -162,6 +164,15 @@ public void updateBookieRackInfo(@Suspended final AsyncResponse asyncResponse,
throw new RestException(Status.PRECONDITION_FAILED, "Bookie 'group' parameters is missing");
}
+ // validate rack name
+ int separatorCnt = StringUtils.countMatches(
+ StringUtils.strip(bookieInfo.getRack(), PATH_SEPARATOR), PATH_SEPARATOR);
+ boolean isRackEnabled = pulsar().getConfiguration().isBookkeeperClientRackawarePolicyEnabled();
+ boolean isRegionEnabled = pulsar().getConfiguration().isBookkeeperClientRegionawarePolicyEnabled();
+ if (isRackEnabled && ((isRegionEnabled && separatorCnt != 1) || (!isRegionEnabled && separatorCnt != 0))) {
+ asyncResponse.resume(new RestException(Status.PRECONDITION_FAILED, "Bookie 'rack' parameter is invalid"));
Review comment:
need a return here.
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org