You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/07/08 18:02:51 UTC

[GitHub] [ozone] adoroszlai opened a new pull request #2396: HDDS-5422. Avoid eager string formatting in preconditions

adoroszlai opened a new pull request #2396:
URL: https://github.com/apache/ozone/pull/2396


   ## What changes were proposed in this pull request?
   
   Some calls to `Preconditions.check...` eagerly format the error message, resulting in unnecessary allocations.
   
   https://issues.apache.org/jira/browse/HDDS-5422
   
   ## How was this patch tested?
   
   :eyes:
   
   https://github.com/adoroszlai/hadoop-ozone/actions/runs/1011814193


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] ayushtkn commented on a change in pull request #2396: HDDS-5422. Avoid eager string formatting in preconditions

Posted by GitBox <gi...@apache.org>.
ayushtkn commented on a change in pull request #2396:
URL: https://github.com/apache/ozone/pull/2396#discussion_r666750402



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java
##########
@@ -65,9 +65,9 @@ void addPipeline(Pipeline pipeline) throws IOException {
     Preconditions.checkArgument(
         pipeline.getNodes().size() == pipeline.getReplicationConfig()
             .getRequiredNodes(),
-        String.format("Nodes size=%d, replication factor=%d do not match ",
+        "Nodes size=%s, replication factor=%s do not match ",

Review comment:
       can you help why %d to %s
   the return values are integers only right? some reason to do so?




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] adoroszlai commented on pull request #2396: HDDS-5422. Avoid eager string formatting in preconditions

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on pull request #2396:
URL: https://github.com/apache/ozone/pull/2396#issuecomment-878133364


   Thanks @ayushtkn for the review.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] adoroszlai commented on a change in pull request #2396: HDDS-5422. Avoid eager string formatting in preconditions

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #2396:
URL: https://github.com/apache/ozone/pull/2396#discussion_r666755050



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java
##########
@@ -65,9 +65,9 @@ void addPipeline(Pipeline pipeline) throws IOException {
     Preconditions.checkArgument(
         pipeline.getNodes().size() == pipeline.getReplicationConfig()
             .getRequiredNodes(),
-        String.format("Nodes size=%d, replication factor=%d do not match ",
+        "Nodes size=%s, replication factor=%s do not match ",

Review comment:
       `Preconditions` (or rather `Strings#lenientFormat` to which it delegates) only supports `%s` placeholders.




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] adoroszlai merged pull request #2396: HDDS-5422. Avoid eager string formatting in preconditions

Posted by GitBox <gi...@apache.org>.
adoroszlai merged pull request #2396:
URL: https://github.com/apache/ozone/pull/2396


   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org