You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2017/04/23 15:29:52 UTC
kafka git commit: MINOR: ProducerPerformance should work with older
client jars
Repository: kafka
Updated Branches:
refs/heads/trunk 1fbb8cfaf -> b15422177
MINOR: ProducerPerformance should work with older client jars
Author: Jun Rao <ju...@gmail.com>
Reviewers: Ismael Juma <is...@juma.me.uk>
Closes #2896 from junrao/minor
Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/b1542217
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/b1542217
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/b1542217
Branch: refs/heads/trunk
Commit: b15422177460a8f928a2ba93c429de426ae68076
Parents: 1fbb8cf
Author: Jun Rao <ju...@gmail.com>
Authored: Sun Apr 23 16:28:05 2017 +0100
Committer: Ismael Juma <is...@juma.me.uk>
Committed: Sun Apr 23 16:29:45 2017 +0100
----------------------------------------------------------------------
.../apache/kafka/tools/ProducerPerformance.java | 21 +++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kafka/blob/b1542217/tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java
----------------------------------------------------------------------
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 fd57291..da1f41b 100644
--- a/tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java
+++ b/tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java
@@ -129,17 +129,24 @@ public class ProducerPerformance {
}
}
- // Make sure all messages are sent before printing out the stats and the metrics
- producer.flush();
+ if (!shouldPrintMetrics) {
+ producer.close();
- /* print final results */
- stats.printTotal();
+ /* print final results */
+ stats.printTotal();
+ } else {
+ // Make sure all messages are sent before printing out the stats and the metrics
+ // We need to do this in a different branch for now since tests/kafkatest/sanity_checks/test_performance_services.py
+ // expects this class to work with older versions of the client jar that don't support flush().
+ producer.flush();
+
+ /* print final results */
+ stats.printTotal();
- /* print out metrics */
- if (shouldPrintMetrics) {
+ /* print out metrics */
ToolsUtils.printMetrics(producer.metrics());
+ producer.close();
}
- producer.close();
} catch (ArgumentParserException e) {
if (args.length == 0) {
parser.printHelp();