diff --git a/0007-fix-payload-incorrectly.patch b/0007-fix-payload-incorrectly.patch new file mode 100644 index 0000000000000000000000000000000000000000..86770bb95ba5cd5d986e6f671043707fabebcd15 --- /dev/null +++ b/0007-fix-payload-incorrectly.patch @@ -0,0 +1,43 @@ +diff --git a/tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java b/tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java +index 12a0fccea8..3c5f63df18 100644 +--- a/tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java ++++ b/tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java +@@ -112,12 +112,10 @@ public class ProducerPerformance { + + /* setup perf test */ + byte[] payload = null; +- Random random = new Random(0); + if (recordSize != null) { + payload = new byte[recordSize]; +- for (int i = 0; i < payload.length; ++i) +- payload[i] = (byte) (random.nextInt(26) + 65); + } ++ Random random = new Random(0); + ProducerRecord record; + Stats stats = new Stats(numRecords, 5000); + long startMs = System.currentTimeMillis(); +@@ -127,15 +125,20 @@ public class ProducerPerformance { + int currentTransactionSize = 0; + long transactionStartTime = 0; + for (long i = 0; i < numRecords; i++) { ++ if (payloadFilePath != null) { ++ payload = payloadByteList.get(random.nextInt(payloadByteList.size())); ++ } else if (recordSize != null) { ++ for (int j = 0; j < payload.length; ++j) ++ payload[j] = (byte) (random.nextInt(26) + 65); ++ } else { ++ throw new IllegalArgumentException("no payload File Path or record Size provided"); ++ } ++ + if (transactionsEnabled && currentTransactionSize == 0) { + producer.beginTransaction(); + transactionStartTime = System.currentTimeMillis(); + } + +- +- if (payloadFilePath != null) { +- payload = payloadByteList.get(random.nextInt(payloadByteList.size())); +- } + record = new ProducerRecord<>(topicName, payload); + + long sendStartMs = System.currentTimeMillis(); diff --git a/kafka.spec b/kafka.spec index 465871d5daaeca1616f115f23061b23beeff7b8f..3727cd8d47834b26b83a89876eb891de6ed29feb 100644 --- a/kafka.spec +++ b/kafka.spec @@ -4,7 +4,7 @@ Name: kafka Version: 2.8.2 -Release: 6 +Release: 7 Summary: A Distributed Streaming Platform. License: Apache-2.0 @@ -18,6 +18,7 @@ Patch2: 0003-CVE-2023-34455.patch Patch3: 0004-CVE-2022-42004.patch Patch4: 0005-CVE-2016-3189.patch Patch5: 0006-NPE-subscriptionState.patch +Patch6: 0007-fix-payload-incorrectly.patch BuildRequires: systemd java-1.8.0-openjdk-devel Provides: kafka = %{version} @@ -69,30 +70,24 @@ cp -pr licenses/* $RPM_BUILD_ROOT%{kafka_home}/licenses rm -rf %{buildroot} %changelog +* Fri Dec 08 2023 sundapeng - 2.8.2-7 +- Fix using random payload in ProducerPerformance incorrectly * Mon Nov 27 2023 sundapeng - 2.8.2-6 -- fix NPE in subscriptionState.patch - +- fix NPE in subscriptionState * Fri Nov 03 2023 sundapeng - 2.8.2-5 -fix CVE-2016-3189 - * Thu Sep 21 2023 sundapeng - 2.8.2-4 -fix CVE-2022-42004 - * Fri Sep 1 2023 sundapeng - 2.8.2-3 - fix CVE-2023-34455 - * Wed Aug 30 2023 sundapeng - 2.8.2-2 - fix CVE-2022-41881 - * Sat Sep 24 2022 xiexing - 2.8.2-1 - fix CVE-2022-34917 - * Thu Aug 11 2022 xiexing - 2.8.1-1 - update version to fix CVE-2021-38153 - * Thu Mar 25 2021 huanghaitao 2.6.0 - 2 - Remove dist macros - * Sat Aug 15 2020 Hao Zhang - init * Sat Oct 04 2020 Hao Zhang