Fix using random payload in ProducerPerformance incorrectly
This commit is contained in:
parent
f86cd7db43
commit
e78ef3f531
43
0007-fix-payload-incorrectly.patch
Normal file
43
0007-fix-payload-incorrectly.patch
Normal file
@ -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<byte[], byte[]> 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();
|
||||
15
kafka.spec
15
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 <sundapeng_yewu@cmss.chinamobile.com> - 2.8.2-7
|
||||
- Fix using random payload in ProducerPerformance incorrectly
|
||||
* Mon Nov 27 2023 sundapeng <sundapeng_yewu@cmss.chinamobile.com> - 2.8.2-6
|
||||
- fix NPE in subscriptionState.patch
|
||||
|
||||
- fix NPE in subscriptionState
|
||||
* Fri Nov 03 2023 sundapeng <sundapeng_yewu@cmss.chinamobile.com> - 2.8.2-5
|
||||
-fix CVE-2016-3189
|
||||
|
||||
* Thu Sep 21 2023 sundapeng <sundapeng_yewu@cmss.chinamobile.com> - 2.8.2-4
|
||||
-fix CVE-2022-42004
|
||||
|
||||
* Fri Sep 1 2023 sundapeng <sundapeng_yewu@cmss.chinamobile.com> - 2.8.2-3
|
||||
- fix CVE-2023-34455
|
||||
|
||||
* Wed Aug 30 2023 sundapeng <sundapeng_yewu@cmss.chinamobile.com> - 2.8.2-2
|
||||
- fix CVE-2022-41881
|
||||
|
||||
* Sat Sep 24 2022 xiexing <xiexing4@hisilicon.com> - 2.8.2-1
|
||||
- fix CVE-2022-34917
|
||||
|
||||
* Thu Aug 11 2022 xiexing <xiexing4@hisilicon.com> - 2.8.1-1
|
||||
- update version to fix CVE-2021-38153
|
||||
|
||||
* Thu Mar 25 2021 huanghaitao <huanghaitao8@huawei.com> 2.6.0 - 2
|
||||
- Remove dist macros
|
||||
|
||||
* Sat Aug 15 2020 Hao Zhang <unioah@isrc.iscas.ac.cn>
|
||||
- init
|
||||
* Sat Oct 04 2020 Hao Zhang <unioah@isrc.iscas.ac.cn>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user