-
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
Refactored PulsarResources to avoid building metadata paths everywhere #11693
Conversation
Thanks for your contribution. For this PR, do we need to update docs? (The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks) |
|
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.
Well done.
thIs is is very useful clean up.
Thanks for doing it
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/ClusterResources.java
Outdated
Show resolved
Hide resolved
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/TopicResources.java
Outdated
Show resolved
Hide resolved
### Motivation This PR is used to keep same behavior with Pulsar 2.8 and 2.7 version. In Pulsar 2.7 and 2.8, when delete a non-existent failure domain resource, it will return 404 status code. In Pulsar 2.9, when delete a non-existent failure domain resource, it will return 200 status code. Reproduce in Pulsar 2.8: ``` $ docker run -itd \ -p 6650:6650 \ -p 8080:8080 \ apachepulsar/pulsar:2.8.1 \ bin/pulsar standalone $ pulsarctl clusters delete-failure-domain standalone non-existent-failure-domain [✖] code: 404 reason: Domain-name non-existent-failure-domain or cluster standalone does not exist ``` Reproduce in Pulsar 2.9: ``` $ docker run -itd \ -p 6650:6650 \ -p 8080:8080 \ apachepulsar/pulsar:2.9.0 \ bin/pulsar standalone $ pulsarctl clusters delete-failure-domain standalone non-existent-failure-domain Delete failure domain [non-existent-failure-domain] for cluster [standalone] succeed ``` Affected version: 2.9.x This issue was caused by #11693. ### Modifications - Remove check resource exists when call the `ClusterResources#deleteFailureDomain()` - Add check resource exists when call the `ClusterResources#deleteFailureDomains()`
### Motivation This PR is used to keep same behavior with Pulsar 2.8 and 2.7 version. In Pulsar 2.7 and 2.8, when delete a non-existent failure domain resource, it will return 404 status code. In Pulsar 2.9, when delete a non-existent failure domain resource, it will return 200 status code. Reproduce in Pulsar 2.8: ``` $ docker run -itd \ -p 6650:6650 \ -p 8080:8080 \ apachepulsar/pulsar:2.8.1 \ bin/pulsar standalone $ pulsarctl clusters delete-failure-domain standalone non-existent-failure-domain [✖] code: 404 reason: Domain-name non-existent-failure-domain or cluster standalone does not exist ``` Reproduce in Pulsar 2.9: ``` $ docker run -itd \ -p 6650:6650 \ -p 8080:8080 \ apachepulsar/pulsar:2.9.0 \ bin/pulsar standalone $ pulsarctl clusters delete-failure-domain standalone non-existent-failure-domain Delete failure domain [non-existent-failure-domain] for cluster [standalone] succeed ``` Affected version: 2.9.x This issue was caused by #11693. ### Modifications - Remove check resource exists when call the `ClusterResources#deleteFailureDomain()` - Add check resource exists when call the `ClusterResources#deleteFailureDomains()` (cherry picked from commit 7f4aac5)
### Motivation This PR is used to keep same behavior with Pulsar 2.8 and 2.7 version. In Pulsar 2.7 and 2.8, when delete a non-existent failure domain resource, it will return 404 status code. In Pulsar 2.9, when delete a non-existent failure domain resource, it will return 200 status code. Reproduce in Pulsar 2.8: ``` $ docker run -itd \ -p 6650:6650 \ -p 8080:8080 \ apachepulsar/pulsar:2.8.1 \ bin/pulsar standalone $ pulsarctl clusters delete-failure-domain standalone non-existent-failure-domain [✖] code: 404 reason: Domain-name non-existent-failure-domain or cluster standalone does not exist ``` Reproduce in Pulsar 2.9: ``` $ docker run -itd \ -p 6650:6650 \ -p 8080:8080 \ apachepulsar/pulsar:2.9.0 \ bin/pulsar standalone $ pulsarctl clusters delete-failure-domain standalone non-existent-failure-domain Delete failure domain [non-existent-failure-domain] for cluster [standalone] succeed ``` Affected version: 2.9.x This issue was caused by apache#11693. ### Modifications - Remove check resource exists when call the `ClusterResources#deleteFailureDomain()` - Add check resource exists when call the `ClusterResources#deleteFailureDomains()`
apache#11693) * Refactored PulsarResources to avoid building metadata paths everywhere * Fixed usages of ZkAdminPaths * Removed unused import * Fixed proxy * Fixed ResourceGroupServiceTest * Added MetadataStore deleteRecursive operation * Fixed merge issues * Use constant * Removed unused import * Fixes for ResourceGroupConfigListenerTest * Fixed cluster resources cleanup * Fixed topic list rest call * Fixed NPE in PersistentDispatcherFailoverConsumerTest setup * Fixed flaky test ReplicatorTest.testRemoveClusterFromNamespace * Fixed handling notification for V1 path namespaces * Fixed LocalPoliciesResources create * Fixed deadlock when making blocking calls from MetadataStore callback thread * Fixed usage of NamespaceName as key * Fixed missing mock in BacklogQuotaManagerConfigurationTest * Fixed RGUsageMTAggrWaitForAllMesgsTest * fixed ServerCnxTest * Fixed mock in PersistentSubscriptionTest * Fixed PersistentTopicTest * Fixed getting partitions list from NamespaceService * Fixed tenant not found expectation * Fixed ProxyConnection to check for existence of auth_data field
Motivation
The
PulsarResources
and its companion classes are all takingString
s with paths for resources in the metadata store. This has lead to a proliferation of string composition to construct these paths from all over the code base.Instead, we should be taking the resource namings (eg:
TopicName
,NamespaceName
, etc.) and hide the path in the metadata.Modifications
BaseResources
to be protected