[testclient] Improve parameter checking in pulsar-perf#11973
[testclient] Improve parameter checking in pulsar-perf#11973congbobo184 merged 3 commits intoapache:masterfrom yuruguo:perf-param-check
Conversation
eolivelli
left a comment
There was a problem hiding this comment.
Overall it looks good to me
I left one comment
| import com.beust.jcommander.ParameterException; | ||
|
|
||
| public class ParameterValidator implements IParameterValidator { | ||
|
|
There was a problem hiding this comment.
What about naming this like PositiveNumberParameterValidator ?
There was a problem hiding this comment.
I agree with it. Have renamed, PTAL.
michaeljmarshall
left a comment
There was a problem hiding this comment.
Looks good. Just one minor edge case that needs to be addressed.
|
|
||
| @Override | ||
| public ClientBuilder connectionsPerBroker(int connectionsPerBroker) { | ||
| checkArgument(connectionsPerBroker >= 0, "connectionsPerBroker needs to be >= 0"); |
There was a problem hiding this comment.
Per the java doc on the ClientBuilder interface, the value must be greater than 0.
| checkArgument(connectionsPerBroker >= 0, "connectionsPerBroker needs to be >= 0"); | |
| checkArgument(connectionsPerBroker > 0, "connectionsPerBroker needs to be > 0"); |
There was a problem hiding this comment.
Done. PTAL again, THX!
I have reverted,see review
There was a problem hiding this comment.
The value of connectionsPerBroker must be greater than 0 (doc in ClientBuilder L266), and this test will fail after the check is added, so a comment is made.
Related review:#11973 (comment)
There was a problem hiding this comment.
so what do you suggest ?
modifying a test means that we modify the behaviour and this is not good (most of the times)
This test tells me that 0 is an allowed number, so you have to update your preconditions (and docs?) and let this test pass
There was a problem hiding this comment.
I agree with you that 0 is a feasible value for this test. So I update the document and revert the test.
There was a problem hiding this comment.
I took a look at how this setting is used, and 0 is a valid setting.
eolivelli
left a comment
There was a problem hiding this comment.
LGTM
@michaeljmarshall PTAL
michaeljmarshall
left a comment
There was a problem hiding this comment.
I think we should improve the javadoc to better explain what 0 connections per broker means. Otherwise, looks good to me.
There was a problem hiding this comment.
Given the name of this setting (connectionsPerBroker), it isn't immediately clear to me why 0 is a valid setting. I think we should add a note specifying that a value of 0 will disable connection pooling. I think it could also be valuable to update the client configuration file with the same note:
Nit: my preference for this line is to write this as needs to be greater than or equal to 0. Your change is certainly correct, so I'm not sure how much my preference matters, but based on a quick search through the project, we often use greater than or equal to in this situation.
There was a problem hiding this comment.
Good suggestion, done. PTAL
315157973
left a comment
There was a problem hiding this comment.
@Anonymitaet Please help review the docs
site2/docs/reference-cli-tools.md
Outdated
There was a problem hiding this comment.
| |`-time`, `--test-duration`|Test duration in secs. If <= 0, it will keep consuming|0| | |
| |`-time`, `--test-duration`|Test duration (in seconds). If this value is less than or equal to 0, it keeps consuming messages.|0| |
Please check all occurrences and keep consistent.
There was a problem hiding this comment.
Thanks for your contribution. Does this affect only master or other versioned docs?
If latter, could you please help update all affected versions? Thanks
There was a problem hiding this comment.
- The document has been checked and updated, PTAL again @Anonymitaet , thx!
- This affects only master docs.
Fixes #11983
Motivation
When I execute
pulsar-perfto simulate pub/sub test, I found that the task can be started normally after some options are set to unreasonable values, but there is no instance running, which leads to a waste of resources. In fact, when these unreasonable values appear, we should check to prevent the task from starting.for example:
./bin/pulsar-perf consume --num-consumers -1 testModifications
Documentation