You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/03/09 02:11:02 UTC
[GitHub] [pulsar] murong00 commented on a change in pull request #9838: [Issue 9821] [pulsar-testclient] Fix perf tools to keep compatibility with previous version
murong00 commented on a change in pull request #9838:
URL: https://github.com/apache/pulsar/pull/9838#discussion_r589887194
##########
File path: pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java
##########
@@ -189,9 +188,19 @@ public static void main(String[] args) throws Exception {
}
if (arguments.topic != null && arguments.topic.size() != arguments.numTopics) {
- System.out.println("The size of topics list should be equal to --num-topics");
- jc.usage();
- System.exit(-1);
+ // keep compatibility with the previous version
+ if (arguments.topic.size() == 1) {
+ String prefixTopicName = TopicName.get(arguments.topic.get(0)).toString();
+ List<String> defaultTopics = Lists.newArrayList();
+ for (int i = 0; i < arguments.numTopics; i++) {
+ defaultTopics.add(String.format("%s-%d", prefixTopicName, i));
Review comment:
> This is a breaking change? The previous behavior is if the numTopics==1, the topic name should be the prefixTopicName.
@codelipenghui I don't think it is a breaking change since the basis of this logic is that `topic.size() != numTopics`, i.e.
```
topics.size=1&numTopics>1: use the defaultTopics which size is numTopics and this is compatible
topics.size>1&numTopics<=1: print "The size of topics list should be equal to --num-topics" to ensure the size of them are equal
```
when `topic.size() == numTopics`, i.e.
```
topics.size=numTopics=1: use arguments.topic.get(0), i.e. the topic name is prefixTopicName and this is compatible
topics.size=numTopics>1: use the topic list as expected
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org