Skip to content
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

fix max topic for namespace does not work #9193

Merged
merged 1 commit into from
Jan 14, 2021

Conversation

aloyszhang
Copy link
Contributor

@aloyszhang aloyszhang commented Jan 12, 2021

Motivation

This PR fix max topic for namespace does not work.

Max topic configuration for namespace does not work well. This is caused by currently we use globalZK to get the children node of "/managed-ledgers/tenant/namespace/domain" when caculate the number of existed topics.

Znode of "/managed-ledgers/tenant/namespace/domain" should be accessed by localZK instead.

@aloyszhang
Copy link
Contributor Author

/pulsarbot run-failure-checks

2 similar comments
@aloyszhang
Copy link
Contributor Author

/pulsarbot run-failure-checks

@aloyszhang
Copy link
Contributor Author

/pulsarbot run-failure-checks

@@ -812,7 +812,7 @@ protected boolean isNamespaceReplicated(NamespaceName namespaceName) {
try {
String topicPartitionPath = joinPath(MANAGED_LEDGER_PATH_ZNODE,
namespaceName.toString(), topicDomain.value());
List<String> topics = globalZk().getChildren(topicPartitionPath, false);
List<String> topics = localZk().getChildren(topicPartitionPath, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add a unit test? This will make pulsar more robust

Copy link
Contributor Author

@aloyszhang aloyszhang Jan 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a test AdminApiTest2#testMaxTopicsPerNamespace

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @aloyszhang , This change lgtm. As @codelipenghui mentioned, it would be great if we have it reproduced and fixed in the unit test.
How about we create 2 mocked zk in the MockedPulsarServiceBaseTest, 1 zk for localZk() and another for globalZk? By this way, we could reproduce this error in the original code, and verify it fixed by this change.

Copy link
Contributor Author

@aloyszhang aloyszhang Jan 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your suggestion @jiazhai @codelipenghui .
I have test the AdminApiTest2#testMaxTopicsPerNamespace and found the globalZk and localZk return the same result , this is why the original test passed.
I'll try to add two different zk for local and global respectively.

@jiazhai
Copy link
Member

jiazhai commented Jan 14, 2021

@aloyszhang opened issue #9207 to track the changes of 2 zk in test base.

sijie pushed a commit that referenced this pull request Jan 20, 2021
…cal in MockedPulsarServiceBaseTest (#9222)

Fixes #9207 

### Motivation
This PR is a continue for #9193 , since #9193  is only a partial fix for mis-use of local/global zk. 
This PR fix others places of mis-use and provide different zk for global/local in `MockedPulsarServiceBaseTest`
@aloyszhang aloyszhang deleted the max-topic branch January 22, 2021 11:58
merlimat pushed a commit to merlimat/pulsar that referenced this pull request Apr 6, 2021
This PR fix max topic for namespace does not work.

Max topic configuration for namespace does not work well. This is caused by currently we use globalZK to get the children node of "/managed-ledgers/tenant/namespace/domain" when caculate the number of existed topics.

Znode of "/managed-ledgers/tenant/namespace/domain" should be accessed by localZK instead.
merlimat pushed a commit to merlimat/pulsar that referenced this pull request Apr 6, 2021
…cal in MockedPulsarServiceBaseTest (apache#9222)

Fixes apache#9207

This PR is a continue for apache#9193 , since apache#9193  is only a partial fix for mis-use of local/global zk.
This PR fix others places of mis-use and provide different zk for global/local in `MockedPulsarServiceBaseTest`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants