> On May 14, 2014, 4:31 a.m., Jun Rao wrote: > > clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java, > > lines 204-247 > > <https://reviews.apache.org/r/21398/diff/2/?file=580819#file580819line204> > > > > Could the two loops be merged into a single loop?
The first loop actually loops over the nodes, and for each node check their TopicAndPartition's corresponding PartitionInfo and will break for the first ready partition. The second loop over the PartitionInfo directly and will also break for the first ready partition with unknown leader. It will be a bit complex to merge these two. - Guozhang ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/21398/#review42921 ----------------------------------------------------------- On May 13, 2014, 6:25 p.m., Guozhang Wang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/21398/ > ----------------------------------------------------------- > > (Updated May 13, 2014, 6:25 p.m.) > > > Review request for kafka. > > > Bugs: KAFKA-1445 > https://issues.apache.org/jira/browse/KAFKA-1445 > > > Repository: kafka > > > Description > ------- > > 0. Add the partitionsForNode index in Cluster;\n 1. Ready would return a list > of ready nodes instead of partitions;\n 2. Ready would also check if there is > any ready partitions with unknown leader, if yes indicate the > processReadyNode to force metadata refresh;\n 3. Drain would take a list of > nodes and drain the batches per node until the max request size is reached;\n > 4. Collocate would not be just tranform batches per node into a producer > request;\n 5. Corresponding unit test changes; \n 6. One minor compilation > warning fix > > > Diffs > ----- > > > clients/src/main/java/org/apache/kafka/clients/producer/internals/Partitioner.java > fbb732a57522109ac0e0eaf5c87b50cbd3a7f767 > > clients/src/main/java/org/apache/kafka/clients/producer/internals/RecordAccumulator.java > 2d7e52d430fa267ee3689a06f8a621ce5dfd1e33 > > clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java > f0152fabbdd44e9f1a24291e84c17edf8379f4fc > clients/src/main/java/org/apache/kafka/common/Cluster.java > 426bd1eec708979149cbd6fa3959e6f9e73c7e0e > clients/src/main/java/org/apache/kafka/common/Node.java > 0e47ff3ff0e055823ec5a5aa4839d25b0fac8374 > > clients/src/test/java/org/apache/kafka/clients/producer/RecordAccumulatorTest.java > f37ab770b1794830154f9908a0156e7e99b4a458 > > clients/src/test/java/org/apache/kafka/common/utils/AbstractIteratorTest.java > 1df226606fad29da47d81d0b8ff36209c3536c06 > > Diff: https://reviews.apache.org/r/21398/diff/ > > > Testing > ------- > > unit tests > > > Thanks, > > Guozhang Wang > >