Github user hmcl commented on a diff in the pull request:
https://github.com/apache/storm/pull/2150#discussion_r123868570
--- Diff:
external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/ManualPartitionSubscription.java
---
@@ -58,21 +51,21 @@ public
ManualPartitionNamedSubscription(ManualPartitioner parter, String ... top
@Override
public void refreshAssignment() {
- List<TopicPartition> allPartitions = new ArrayList<>();
- for (String topic : topics) {
- for (PartitionInfo partitionInfo:
consumer.partitionsFor(topic)) {
- allPartitions.add(new
TopicPartition(partitionInfo.topic(), partitionInfo.partition()));
- }
- }
+ List<TopicPartition> allPartitions =
partitionFilter.getFilteredTopicPartitions(consumer);
Collections.sort(allPartitions, TopicPartitionComparator.INSTANCE);
Set<TopicPartition> newAssignment = new
HashSet<>(partitioner.partition(allPartitions, context));
if (!newAssignment.equals(currentAssignment)) {
+ consumer.assign(newAssignment);
if (currentAssignment != null) {
listener.onPartitionsRevoked(currentAssignment);
- listener.onPartitionsAssigned(newAssignment);
}
+ listener.onPartitionsAssigned(newAssignment);
currentAssignment = newAssignment;
- consumer.assign(currentAssignment);
--- End diff --
@srdo lines 62 and 63 should be switched. We want to call the listener only
once all is set.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---