> On March 24, 2015, 10:46 p.m., Guozhang Wang wrote: > > core/src/main/scala/kafka/server/AbstractFetcherThread.scala, lines 81-86 > > <https://reviews.apache.org/r/31366/diff/2/?file=898415#file898415line81> > > > > Jun has a comment about the case when all partitions gets inactive, > > which is common when the fetched broker has been just gone through leader > > migration. > > > > We can move the foreach statement before the if statement, and after > > foreach check if any partitions gets added, if not just backoff for > > fetchBackoffMs. > > Sriharsha Chintalapani wrote: > Thanks for the review. Are you looking at something like this. This > wouldn't handle if we have partitionMap populated but all of them are > inactive. > > partitionMap.foreach { > case((topicAndPartition, partitionFetchState)) => > if(partitionFetchState.isActive) > fetchRequestBuilder.addFetch(topicAndPartition.topic, > topicAndPartition.partition, > partitionFetchState.offset, fetchSize) > } > if (partitionMap.isEmpty) > partitionMapCond.await(fetchBackOffMs, TimeUnit.MILLISECONDS) > or do we want to check if all the currentParttions are inactive and than > backoff? that would be expensive to check if all the partitions or active or > not in dowork. > > Guozhang Wang wrote: > What I think is a bit different and maybe simpler: > > For FetchRequestBuilder, in the build() call its requestMap will be > cleared after the fetch request is created, so we can just add another > function in FetchRequestBuilder return boolean indicating if its request map > is empty. With this we can get rid of the allPartitionsInactive flag.
Thanks for the suggestion. I used fetchRequest.requestInfo.isEmpty which we already have. If the fetchRequestBuilder.partitionMap is empty than the requestInfo will also be empty. Can you please take a look at the latest diff. - Sriharsha ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/31366/#review77674 ----------------------------------------------------------- On April 7, 2015, 3:41 p.m., Sriharsha Chintalapani wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/31366/ > ----------------------------------------------------------- > > (Updated April 7, 2015, 3:41 p.m.) > > > Review request for kafka. > > > Bugs: KAFKA-1461 > https://issues.apache.org/jira/browse/KAFKA-1461 > > > Repository: kafka > > > Description > ------- > > KAFKA-1461. Replica fetcher thread does not implement any back-off behavior. > > > KAFKA-1461. Replica fetcher thread does not implement any back-off behavior. > > > KAFKA-1461. Replica fetcher thread does not implement any back-off behavior. > > > Diffs > ----- > > core/src/main/scala/kafka/server/AbstractFetcherThread.scala > f178527048ea5dbc8c1fde81a5bac54a8e1634c6 > core/src/main/scala/kafka/server/ReplicaFetcherThread.scala > 2d84afa451277e3769368678fd8ea578a8a81774 > > Diff: https://reviews.apache.org/r/31366/diff/ > > > Testing > ------- > > > Thanks, > > Sriharsha Chintalapani > >