chia7712 commented on code in PR #16277:
URL: https://github.com/apache/kafka/pull/16277#discussion_r1635920882
##########
clients/src/test/java/org/apache/kafka/clients/producer/internals/RecordAccumulatorTest.java:
##########
@@ -1737,30 +1735,48 @@ private RecordAccumulator
createTestRecordAccumulator(int deliveryTimeoutMs, int
* Return a test RecordAccumulator instance
*/
private RecordAccumulator createTestRecordAccumulator(
- TransactionManager txnManager,
- int deliveryTimeoutMs,
- int batchSize,
- long totalSize,
- Compression compression,
- int lingerMs
+ TransactionManager txnManager,
+ int deliveryTimeoutMs,
+ int batchSize,
+ long totalSize,
+ Compression compression,
+ int lingerMs
) {
long retryBackoffMs = 100L;
long retryBackoffMaxMs = 1000L;
String metricGrpName = "producer-metrics";
return new RecordAccumulator(
- logContext,
- batchSize,
- compression,
- lingerMs,
- retryBackoffMs,
- retryBackoffMaxMs,
- deliveryTimeoutMs,
- metrics,
- metricGrpName,
- time,
- new ApiVersions(),
- txnManager,
- new BufferPool(totalSize, batchSize, metrics, time,
metricGrpName));
+ logContext,
+ batchSize,
+ compression,
+ lingerMs,
+ retryBackoffMs,
+ retryBackoffMaxMs,
+ deliveryTimeoutMs,
+ metrics,
+ metricGrpName,
+ time,
+ new ApiVersions(),
+ txnManager,
+ new BufferPool(totalSize, batchSize, metrics, time,
metricGrpName)) {
+ @Override
+ protected BuiltInPartitioner createBuiltInPartitioner(LogContext
logContext, String topic,
+ int
stickyBatchSize) {
+ return new MockRandomBuiltInPartitioner(logContext, topic,
stickyBatchSize);
+ }
+ };
+ }
+
+ private class MockRandomBuiltInPartitioner extends BuiltInPartitioner {
Review Comment:
Got it. thanks!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]