Github user srdo commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1808#discussion_r96903456
  
    --- Diff: 
external/storm-kafka-client/src/main/java/org/apache/storm/kafka/spout/RoundRobinManualPartitioner.java
 ---
    @@ -15,14 +15,26 @@
      *   See the License for the specific language governing permissions and
      *   limitations under the License.
      */
    +package org.apache.storm.kafka.spout;
     
    -package org.apache.storm.kafka.spout.internal.partition;
    +import java.util.ArrayList;
    +import java.util.HashSet;
    +import java.util.List;
    +import java.util.Set;
     
    -import org.apache.kafka.clients.consumer.KafkaConsumer;
     import org.apache.kafka.common.TopicPartition;
    +import org.apache.storm.task.TopologyContext;
     
    -import java.util.List;
    +public class RoundRobinManualPartitioner implements ManualPartitioner {
     
    -public interface KafkaPartitionReader {
    -    List<TopicPartition> readPartitions(KafkaConsumer<?, ?> consumer);
    +   @Override
    +   public List<TopicPartition> partition(List<TopicPartition> 
allPartitions, TopologyContext context) {
    +           int thisTaskIndex = context.getThisTaskIndex();
    +           int totalTaskCount = 
context.getComponentTasks(context.getThisComponentId()).size();
    +           Set<TopicPartition> myPartitions = new 
HashSet<>(allPartitions.size()/totalTaskCount+1);
    +           for (int i = thisTaskIndex; i < allPartitions.size(); i += 
totalTaskCount) {
    --- End diff --
    
    I don't think so. Either i is in [0, allPartitions.size()-1] or the loop is 
over.


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

Reply via email to