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 2020/11/18 20:51:50 UTC

[GitHub] [kafka] mattwong949 commented on a change in pull request #9608: MINOR: Enable testLogCleanerStats

mattwong949 commented on a change in pull request #9608:
URL: https://github.com/apache/kafka/pull/9608#discussion_r526412288



##########
File path: core/src/test/scala/unit/kafka/log/LogCleanerTest.scala
##########
@@ -815,9 +815,10 @@ class LogCleanerTest {
                (0 until leo.toInt by 2).forall(!keys.contains(_)))
   }
 
+  @Test
   def testLogCleanerStats(): Unit = {
-    // because loadFactor is 0.75, this means we can fit 2 messages in the map
-    val cleaner = makeCleaner(2)
+    // because loadFactor is 0.75, this means we can fit 3 messages in the map

Review comment:
       I took a look at the `testPartialSegmentClean` which also uses `makeCleaner(2)`, and noticed it does multiple clean attempts since it keeps filling its map, so the logic of the tests are ok. I think the comments are misleading, I traced the code to `LogCleaner.buildOffsetMapForSegment` , and there's this line:
   ```
   val maxDesiredMapSize = (map.slots * this.dupBufferLoadFactor).toInt
   ```
   So we will only be able to put one offset in the map, and won't attempt to put anything else after that one even if it's the same key. I am going to change the comments




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