public boolean setAndCheckDiscoveredPartition ( KafkaTopicPartition partition ) { if ( isUndiscoveredPartition ( partition ) ) { discoveredPartitions . add ( partition ) ; return KafkaTopicPartitionAssigner . assign ( partition , numParallelSubtasks ) == indexOfThisSubtask ; } return false ; }
Sets a partition as discovered . Partitions are considered as new if its partition id is larger than all partition ids previously seen for the topic it belongs to . Therefore for a set of discovered partitions the order that this method is invoked with each partition is important .