-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Issues 5709]remove the namespace checking #5716
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comment https://github.com/apache/pulsar/pull/5716/files#diff-e513da2014c39f6b12d8b1232af8ff2bL183
I think you can try to add a unit test for topicNameValid
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a unit test?
I have added it. |
pulsar-client/src/test/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImplTest.java
Outdated
Show resolved
Hide resolved
pulsar-client/src/test/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImplTest.java
Outdated
Show resolved
Hide resolved
conf.setStatsIntervalSeconds(100); | ||
|
||
ThreadFactory threadFactory = new DefaultThreadFactory("client-test-multi", Thread.currentThread().isDaemon()); | ||
EventLoopGroup eventLoopGroup = EventLoopUtil.newEventLoopGroup(conf.getNumIoThreads(), threadFactory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity, why do you create an external event loop?
If you are using an external event loop, it is a good practice to shutdown the event loop at the end of the test.
|
||
ThreadFactory threadFactory = new DefaultThreadFactory("client-test-multi", Thread.currentThread().isDaemon()); | ||
EventLoopGroup eventLoopGroup = EventLoopUtil.newEventLoopGroup(conf.getNumIoThreads(), threadFactory); | ||
ExecutorService listenerExecutor = Executors.newSingleThreadScheduledExecutor(threadFactory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
who is using listenerExecutor
?
.create(); | ||
producer.send("default/MultiTopics1-Message1"); | ||
producer1.send("test-multi/MultiTopics2-Message1"); | ||
producer.closeAsync(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need add the logic to verify you receive the messages that are produced by producer and producer1
public void received(Consumer<byte[]> consumer, Message<byte[]> msg) { | ||
if("producer".equals(msg.getProducerName()) || "producer1".equals(msg.getProducerName())){ | ||
String message = new String(msg.getData()); | ||
assertTrue(message.contains("MultiTopics")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertion is done in another thread. The code might never run since you close consumer immediately after producers sent the records.
Please change the logic to use #receive
. Add the logic to receive messages and verify them after line 109.
public void received(Consumer<byte[]> consumer, Message<byte[]> msg) { | ||
if("producer".equals(msg.getProducerName()) || "producer1".equals(msg.getProducerName())){ | ||
String message = new String(msg.getData()); | ||
assertTrue(message.contains("MultiTopics")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertion is done in another thread. The code might never run since you close consumer immediately after producers sent the records.
Please change the logic to use #receive
. Add the logic to receive messages and verify them after line 109.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'v fixed ,PTAL.
retest this please |
run java8 tests |
run java8 tests |
Please check unit test use command @huangdx0726 :
|
} else { | ||
return false; | ||
} | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can simplify by
topic -> !TopicName.isValid(topic)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'v fixed ,PTAL.
Consumer consumer = clientImpl.newConsumer().topic("persistent://public/test-multi/MultiTopics2") | ||
.subscriptionName("multiTopicSubscription") | ||
.subscribe(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to create a consumer which subscribe multi topics in multi namespaces right? Or can you clarify how the new test cover your change in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix it.
@tuteng The unit test is passed in local ,PTAL. |
run java8 tests |
@huangdx0726 to take a look
|
public void multiTopicsInDifferentNameSpace() throws PulsarClientException { | ||
List<String> topics = new ArrayList<>(); | ||
topics.add("persistent://public/default/MultiTopics1"); | ||
topics.add("persistent://public/test-multi/MultiTopics2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems you need create namespace "test-multi" first?
pulsar Service not started? |
topics.add("persistent://public/test-multi/MultiTopics2"); | ||
topics.add("persistent://public/test-multi/MultiTopics3"); | ||
ClientConfigurationData conf = new ClientConfigurationData(); | ||
conf.setServiceUrl("pulsar://localhost:6650"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@huangdx0726 Seems this is related to your error. since this test MultiTopicsConsumerImplTest
not start pulsar service at all.
Please move this testcast into TopicsConsumerImplTest
, which contains all needed setups.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed as persd your comment, PTAL.
@jiazhai can you review this pull request again? |
ut not passed |
May i create tenant ‘public’ in this test unint? |
@jiazhai I'v fixed ,PTAL. |
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
3 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
…te-update * 'website-update' of github.com:zeo1995/pulsar: (432 commits) Fixed ordering issue in KeyShared dispatcher when adding consumer (apache#7106) Fix Duplicated messages are sent to dead letter topic apache#6960 (apache#7021) [Issue 2793][Doc]--Update the TLS hostname verification for CPP and Python clients (apache#7162) [Doc]--set netty mex frame size (apache#7174) [Doc] Update for the maximum message size (apache#7171) Fixed KeyShared consumers getting stuck on delivery (apache#7105) [apache#6003][pulsar-functions] Possibility to add builtin Functions (apache#6895) [Issue 6921][pulsar-broker-common] Replaced "Paths.get(...).getParent()", because it's system dependent and uses '\' as path separator on Windows (apache#6992) Improve broker unit test CI (apache#7173) Fix typo in exception message (apache#7027) Support KeyValue Schema Use Null Key And Null Value (apache#7139) [Doc]--Update documents for support consumer priority level in failover mode (apache#7136) Add schema config to cpp and cgo docs. (apache#7137) [Doc]--Update for the maximum message size (apache#7160) [C++] Expose ZSTD and Snappy compression to C API (apache#7014) [pulsar-proxy] add proxyLogLevel into config file (apache#6948) Add multi-hosts example for bookkeeperMetadataServiceUri (apache#6998) support for termination of partitioned topic (apache#6126) Use pure-java Air-Compressor instead of JNI based libraries (apache#5390) [Issues 5709]remove the namespace checking (apache#5716) ... # Conflicts: # site2/website/scripts/split-swagger-by-version.js
[Issues 5709] remove the namespace checking Support multiple topic subscriptions across multiple namespace Fixes apache#5709 ### Motivation Support multiple topic subscriptions across multiple namespace ### Modifications remove the namespace checking
Fixes #9449 ### Motivation This is a catchup work for #5716 that supports multiple topic subscriptions across multiple namespaces. ### Modifications - Move the check for namespace in `MultiTopicsConsumerImpl` to `PatternMultiTopicsConsumerImpl` that uses a regex subscription. - Fix the existed tests for subscription on topics across different namespaces. ### Verifying this change This change is already covered by existing tests, such as *BasicEndToEndTest.testMultiTopicsConsumerDifferentNamespace*.
Fixes #9449 ### Motivation This is a catchup work for #5716 that supports multiple topic subscriptions across multiple namespaces. ### Modifications - Move the check for namespace in `MultiTopicsConsumerImpl` to `PatternMultiTopicsConsumerImpl` that uses a regex subscription. - Fix the existed tests for subscription on topics across different namespaces. ### Verifying this change This change is already covered by existing tests, such as *BasicEndToEndTest.testMultiTopicsConsumerDifferentNamespace*. (cherry picked from commit 69e9322)
Fixes apache#9449 ### Motivation This is a catchup work for apache#5716 that supports multiple topic subscriptions across multiple namespaces. ### Modifications - Move the check for namespace in `MultiTopicsConsumerImpl` to `PatternMultiTopicsConsumerImpl` that uses a regex subscription. - Fix the existed tests for subscription on topics across different namespaces. ### Verifying this change This change is already covered by existing tests, such as *BasicEndToEndTest.testMultiTopicsConsumerDifferentNamespace*. (cherry picked from commit 69e9322) (cherry picked from commit 3031550)
Fixes #9449 ### Motivation This is a catchup work for #5716 that supports multiple topic subscriptions across multiple namespaces. ### Modifications - Move the check for namespace in `MultiTopicsConsumerImpl` to `PatternMultiTopicsConsumerImpl` that uses a regex subscription. - Fix the existed tests for subscription on topics across different namespaces. ### Verifying this change This change is already covered by existing tests, such as *BasicEndToEndTest.testMultiTopicsConsumerDifferentNamespace*. (cherry picked from commit 69e9322)
Fixes #9449 ### Motivation This is a catchup work for apache/pulsar#5716 that supports multiple topic subscriptions across multiple namespaces. ### Modifications - Move the check for namespace in `MultiTopicsConsumerImpl` to `PatternMultiTopicsConsumerImpl` that uses a regex subscription. - Fix the existed tests for subscription on topics across different namespaces. ### Verifying this change This change is already covered by existing tests, such as *BasicEndToEndTest.testMultiTopicsConsumerDifferentNamespace*.
[Issues 5709] remove the namespace checking Support multiple topic subscriptions across multiple namespace
Fixes #5709
Motivation
Support multiple topic subscriptions across multiple namespace
Modifications
remove the namespace checking