You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/05/12 03:39:54 UTC

[GitHub] [rocketmq] XiaoyiPeng opened a new pull request, #4281: [ISSUE #4280] Polish the method 'indexKeyHashMethod' in class 'IndexFile'.

XiaoyiPeng opened a new pull request, #4281:
URL: https://github.com/apache/rocketmq/pull/4281

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   For #4280 
   
   ## Brief changelog
   
     1. Change the method modifier from public to private.
     2. Remove code from Line#151 to Line#152
   
   ## Verifying this change
   
   XXXX


-- 
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: dev-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] XiaoyiPeng closed pull request #4281: [ISSUE #4280] Polish the method 'indexKeyHashMethod' in class 'IndexFile'.

Posted by GitBox <gi...@apache.org>.
XiaoyiPeng closed pull request #4281: [ISSUE #4280] Polish the method 'indexKeyHashMethod' in class 'IndexFile'.
URL: https://github.com/apache/rocketmq/pull/4281


-- 
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: dev-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] cserwen commented on a diff in pull request #4281: [ISSUE #4280] Polish the method 'indexKeyHashMethod' in class 'IndexFile'.

Posted by GitBox <gi...@apache.org>.
cserwen commented on code in PR #4281:
URL: https://github.com/apache/rocketmq/pull/4281#discussion_r870924447


##########
store/src/main/java/org/apache/rocketmq/store/index/IndexFile.java:
##########
@@ -145,12 +145,9 @@ public boolean putKey(final String key, final long phyOffset, final long storeTi
         return false;
     }
 
-    public int indexKeyHashMethod(final String key) {
+    private int indexKeyHashMethod(final String key) {
         int keyHash = key.hashCode();
-        int keyHashPositive = Math.abs(keyHash);

Review Comment:
   Will hashcode equal the minimum value of int? 



-- 
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: dev-unsubscribe@rocketmq.apache.org

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


[GitHub] [rocketmq] XiaoyiPeng commented on a diff in pull request #4281: [ISSUE #4280] Polish the method 'indexKeyHashMethod' in class 'IndexFile'.

Posted by GitBox <gi...@apache.org>.
XiaoyiPeng commented on code in PR #4281:
URL: https://github.com/apache/rocketmq/pull/4281#discussion_r870931759


##########
store/src/main/java/org/apache/rocketmq/store/index/IndexFile.java:
##########
@@ -145,12 +145,9 @@ public boolean putKey(final String key, final long phyOffset, final long storeTi
         return false;
     }
 
-    public int indexKeyHashMethod(final String key) {
+    private int indexKeyHashMethod(final String key) {
         int keyHash = key.hashCode();
-        int keyHashPositive = Math.abs(keyHash);

Review Comment:
   Oh, you remind me, this case can lead to serious problem.



-- 
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: dev-unsubscribe@rocketmq.apache.org

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