You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/11/13 00:45:40 UTC

[GitHub] [kafka] mjsax commented on a change in pull request #9568: KAFKA-10689: fix windowed FKJ topology and put checks in assignor to avoid infinite loops

mjsax commented on a change in pull request #9568:
URL: https://github.com/apache/kafka/pull/9568#discussion_r522531710



##########
File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsPartitionAssignor.java
##########
@@ -575,17 +577,22 @@ private void setRepartitionTopicMetadataNumberOfPartitions(final Map<String, Int
                             }
                         }
 
-                        // if we still have not found the right number of partitions,
-                        // another iteration is needed
                         if (numPartitions == null) {
                             numPartitionsNeeded = true;
+                            log.trace("Unable to determine number of partitions for {}, another iteration is needed",
+                                      repartitionSourceTopic);
                         } else {
-                            repartitionTopicMetadata.get(topicName).setNumberOfPartitions(numPartitions);
+                            repartitionTopicMetadata.get(repartitionSourceTopic).setNumberOfPartitions(numPartitions);
+                            progressMadeThisIteration = true;
                         }
                     }
                 }
             }
-        } while (numPartitionsNeeded);
+        } while (numPartitionsNeeded && progressMadeThisIteration);

Review comment:
       Would it be easier to do
   ```
     if (!progressMadeThisIteration) {
       throw new TaskAssignmentException("Failed to compute number of partitions for all repartition topics");
     }
   } while (numPartitionsNeeded);
   ```
   (and don't have the `if (numPartitionsNeeded)` after the while loop)
   
   I guess both is correct and it might be a matter of taste. Also don't have a strong opinion about it. It's just an idea.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org