nodece opened a new pull request, #19925:
URL: https://github.com/apache/pulsar/pull/19925
Fixes #19921
### Motivation
Failed to delete tenant, see log:
```
2023-03-25T18:40:15,174+0800 [pulsar-web-48-12] ERROR
org.apache.pulsar.broker.admin.impl.TenantsBase - [null] Failed to delete
tenant newtenant
org.apache.pulsar.metadata.api.MetadataStoreException$NotFoundException:
path /admin/local-policies/newtenant not found.
at
org.apache.pulsar.metadata.impl.RocksdbMetadataStore.storeDelete(RocksdbMetadataStore.java:480)
~[pulsar-metadata.jar:3.0.0-SNAPSHOT]
at
org.apache.pulsar.metadata.impl.AbstractMetadataStore.deleteInternal(AbstractMetadataStore.java:386)
~[pulsar-metadata.jar:3.0.0-SNAPSHOT]
at
org.apache.pulsar.metadata.impl.AbstractMetadataStore.delete(AbstractMetadataStore.java:373)
~[pulsar-metadata.jar:3.0.0-SNAPSHOT]
at
org.apache.pulsar.metadata.cache.impl.MetadataCacheImpl.delete(MetadataCacheImpl.java:248)
~[pulsar-metadata.jar:3.0.0-SNAPSHOT]
at
org.apache.pulsar.broker.resources.BaseResources.deleteAsync(BaseResources.java:160)
~[pulsar-broker-common.jar:3.0.0-SNAPSHOT]
at
org.apache.pulsar.broker.resources.LocalPoliciesResources.deleteLocalPoliciesTenantAsync(LocalPoliciesResources.java:88)
~[pulsar-broker-common.jar:3.0.0-SNAPSHOT]
at
org.apache.pulsar.broker.admin.impl.TenantsBase.lambda$internalDeleteTenantAsync$33(TenantsBase.java:238)
~[pulsar-broker.jar:3.0.0-SNAPSHOT]
```
When deleting a tenant, we did delete a path that does not exist, so throw
an exception.
### Modifications
- Check whether the `/admin/local-policies/{tenant}` exists, and then delete
it
### Verifying this change
- [x] Make sure that the change passes the CI checks.
Added `AdminApiTenantTest`.
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update
later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]