You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Thomas Reuhl (Jira)" <ji...@apache.org> on 2020/08/05 09:46:00 UTC

[jira] [Issue Comment Deleted] (KAFKA-10095) In LogCleanerManagerTest replace get().nonEmpty call with contains

     [ https://issues.apache.org/jira/browse/KAFKA-10095?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Reuhl updated KAFKA-10095:
---------------------------------
    Comment: was deleted

(was: {{I'm a newbie to kafka and would like to pick up the issue. One idea would be to change the code to actually checking that the topicPartition is _contained_ in the cleaner checkpoints:}}
{code:java}
cleanerManager.setCleaningState(topicPartition, LogCleaningInProgress)
cleanerManager.doneCleaning(topicPartition, log.dir, 1)
assertTrue(cleanerManager.cleaningState(topicPartition).isEmpty)
assertTrue(cleanerManager.allCleanerCheckpoints.contains(topicPartition))

cleanerManager.setCleaningState(topicPartition, LogCleaningAborted)
cleanerManager.doneCleaning(topicPartition, log.dir, 1)
assertEquals(LogCleaningPaused(1), cleanerManager.cleaningState(topicPartition).get)
assertTrue(cleanerManager.allCleanerCheckpoints.contains(topicPartition))
{code}
 )

> In LogCleanerManagerTest replace get().nonEmpty call with contains
> ------------------------------------------------------------------
>
>                 Key: KAFKA-10095
>                 URL: https://issues.apache.org/jira/browse/KAFKA-10095
>             Project: Kafka
>          Issue Type: Improvement
>          Components: log cleaner, unit tests
>            Reporter: Jakob Homan
>            Assignee: Sarah Gonsalves
>            Priority: Trivial
>              Labels: newbie
>
> n.b. This is a newbie ticket designed to be an introduction to contributing for the assignee.
> In kafka.log.LogCleanerManagerTest we have two calls to .get(something).nonEmpty, which is equivalent to .contains(something).  We should simplify these calls.
>  {code}    cleanerManager.doneCleaning(topicPartition, log.dir, 1)
>     assertTrue(cleanerManager.cleaningState(topicPartition).isEmpty)
>     assertTrue(cleanerManager.allCleanerCheckpoints.get(topicPartition).nonEmpty)
>     cleanerManager.setCleaningState(topicPartition, LogCleaningAborted)
>     cleanerManager.doneCleaning(topicPartition, log.dir, 1)
>     assertEquals(LogCleaningPaused(1), cleanerManager.cleaningState(topicPartition).get)
>     assertTrue(cleanerManager.allCleanerCheckpoints.get(topicPartition).nonEmpty){code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)