You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/03/17 10:29:27 UTC

[GitHub] [kafka] chia7712 commented on a change in pull request #10334: MINOR: Fix BaseHashTable sizing

chia7712 commented on a change in pull request #10334:
URL: https://github.com/apache/kafka/pull/10334#discussion_r595891567



##########
File path: metadata/src/test/java/org/apache/kafka/timeline/BaseHashTableTest.java
##########
@@ -121,4 +121,19 @@ public void testExpansion() {
             assertEquals(Integer.valueOf(i), table.baseRemove(Integer.valueOf(i)));
         }
     }
+
+    @Test
+    public void testExpectedSizeToCapacity() {

Review comment:
       As it was a bug, maybe we should check all available numbers. For example:
   ```java
           IntStream.range(Integer.MIN_VALUE, Integer.MAX_VALUE).forEach(i -> {
               int result = BaseHashTable.expectedSizeToCapacity(i);
               assertTrue(result >= 2);
               assertTrue(result <= BaseHashTable.MAX_CAPACITY);
               assertEquals(0, result % 2);
           });
   ```




----------------------------------------------------------------
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.

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