You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "gharris1727 (via GitHub)" <gi...@apache.org> on 2023/06/06 19:50:19 UTC
[GitHub] [kafka] gharris1727 commented on a diff in pull request #13816: MINOR: Optimize runtime of MM2 integration tests by batching transactions
gharris1727 commented on code in PR #13816:
URL: https://github.com/apache/kafka/pull/13816#discussion_r1220234170
##########
connect/mirror/src/test/java/org/apache/kafka/connect/mirror/TestUtils.java:
##########
@@ -34,14 +38,39 @@ static Map<String, String> makeProps(String... keyValues) {
}
return props;
}
-
- /*
- * return records with different but predictable key and value
+
+ /**
+ * Assemble a collection of records arbitrarily distributed across all partitions of the specified topic
+ * @param topicName Destination topic
+ * @param numRecords count of records to produce to the topic in total
+ * @return A batch of records that can be sent to a producer.
*/
- public static Map<String, String> generateRecords(int numRecords) {
- Map<String, String> records = new HashMap<>();
+ public static List<ProducerRecord<byte[], byte[]>> generateRecords(String topicName, int numRecords) {
+ List<ProducerRecord<byte[], byte[]>> records = new ArrayList<>();
for (int i = 0; i < numRecords; i++) {
- records.put("key-" + i, "message-" + i);
+ String key = "key-" + i;
+ String value = "message-" + i;
+ records.add(new ProducerRecord<>(topicName, null, key.getBytes(), value.getBytes()));
+ }
+ return records;
+ }
+
+ /**
+ * Assemble a collection of records evenly distributed across some partitions of the specified topic
Review Comment:
Since the tests don't rely on this keying, and having the same key in multiple partitions is strange, i'll change this to make the keys unique.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org