showuon commented on PR #12066:
URL: https://github.com/apache/kafka/pull/12066#issuecomment-1107468810

   @ruanliang-hualun , I found the test should add one more test case, which is 
"normal" test case. We can put the maxSize as a large one, and expect all the 
partitions should be drained. ex:
   
   ```java
   // new added
   // set maxSize as a max value, so that the all partitions in 2 nodes should 
be drained: node1 => [tp1, tp2], node2 => [tp3, tp4]
   Map<Integer, List<ProducerBatch>> batches1 = accum.drain(cluster, new 
HashSet<Node>(Arrays.asList(node1, node2)), Integer.MAX_VALUE, 0);
           verifyTopicPartitionInBatches(batches1, tp1, tp2, tp3, tp4);
   
           accum.append(tp1, 0L, key, value, Record.EMPTY_HEADERS, null, 
maxBlockTimeMs, false, time.milliseconds());
           accum.append(tp2, 0L, key, value, Record.EMPTY_HEADERS, null, 
maxBlockTimeMs, false, time.milliseconds());
           accum.append(tp3, 0L, key, value, Record.EMPTY_HEADERS, null, 
maxBlockTimeMs, false, time.milliseconds());
           accum.append(tp4, 0L, key, value, Record.EMPTY_HEADERS, null, 
maxBlockTimeMs, false, time.milliseconds());
   
   
   
   // original tests
   // drain batches from 2 nodes: node1 => tp1, node2 => tp3, because the max 
request size is full after the first batch drained
   Map<Integer, List<ProducerBatch>> batches1 = accum.drain(cluster, new 
HashSet<Node>(Arrays.asList(node1, node2)), (int) batchSize, 0);
           verifyTopicPartitionInBatches(batches1, tp1, tp3);
   ```
   
   What do you think?
   If you think it makes sense, are you interested in submitting another PR to 
add the test? 
   Thank you.


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

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

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

Reply via email to