Github user HeartSaVioR commented on a diff in the pull request: https://github.com/apache/storm/pull/1888#discussion_r99284800 --- Diff: external/storm-kafka/src/test/org/apache/storm/kafka/ZkCoordinatorTest.java --- @@ -114,6 +113,33 @@ public void testPartitionsChange() throws Exception { } } + @Test + public void testPartitionManagerRecreate() throws Exception { + final int totalTasks = 2; + int partitionsPerTask = 2; + List<ZkCoordinator> coordinatorList = buildCoordinators(totalTasks / partitionsPerTask); + when(reader.getBrokerInfo()).thenReturn(TestUtils.buildPartitionInfoList(TestUtils.buildPartitionInfo(totalTasks, 9092))); + List<List<PartitionManager>> partitionManagersBeforeRefresh = getPartitionManagers(coordinatorList); + waitForRefresh(); + when(reader.getBrokerInfo()).thenReturn(TestUtils.buildPartitionInfoList(TestUtils.buildPartitionInfo(totalTasks, 9093))); + List<List<PartitionManager>> partitionManagersAfterRefresh = getPartitionManagers(coordinatorList); + assertEquals(partitionManagersAfterRefresh.size(), partitionManagersAfterRefresh.size()); + Iterator<List<PartitionManager>> iterator = partitionManagersAfterRefresh.iterator(); + for (List<PartitionManager> partitionManagersBefore : partitionManagersBeforeRefresh) { + List<PartitionManager> partitionManagersAfter = iterator.next(); + for (PartitionManager before : partitionManagersBefore) --- End diff -- I'd rather create a new hash map for before or after which key is partition, and compare based on the map and other list. The depth of `if` statement is already 4.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---