-
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
Fix validateGlobalNamespaceOwnership wrap exception issue. #14269
Fix validateGlobalNamespaceOwnership wrap exception issue. #14269
Conversation
log.warn(msg); | ||
validationFuture.completeExceptionally(new RestException(Status.NOT_FOUND, msg)); | ||
validationFuture.completeExceptionally(new RestException(Status.NOT_FOUND, "Namespace not found")); |
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.
Why change this section? The old comment out looks great. If the policies is non-exist, we shouldn't throw the Namespace %s not found
.
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.
Not looks great. Because policies mean namespace. If there is a namespace, there are policies. For user, it's about namespace
here.
And some logs in Namespaces methods are also the same, not policies
but namespace
. Please help confirm.
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.
Sounds good, there is have a premise is that every namespace has policies.
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 also have the same doubt as @nodece .
the if condition on line 773 is checking if the policies exist for the namespace. this means the namespace already exists but there are no policies. it seems like the original error message is more accurate. perhaps i am missing something?
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.
ah ok, just saw your comment @nodece
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.
LGTM
### Motivation When Rest API call `AdminResource#validateGlobalNamespaceOwnership`, broker will execute `PulsarWebResource#checkLocalOrGetPeerReplicationCluster`. In `PulsarWebResource#checkLocalOrGetPeerReplicationCluster`: https://github.com/apache/pulsar/blob/6d717a08ef8cfcac032caee06105285594baf09f/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java#L773-L802 Line 780, 794, and 801 has thrown RestException. But `validateGlobalNamespaceOwnership ` has wrapped the exception : https://github.com/apache/pulsar/blob/6d717a08ef8cfcac032caee06105285594baf09f/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java#L202-L216 This could make the user confused that the log printed is not matched with the REST API. (cherry picked from commit 18d9f1b)
I am unable to cherry-pick this to 2.8.3 because of test errors in the mocking. I am moving it to 2.8.4 for now. After cherry-picking and resolving conflicts, I run
|
) ### Motivation When Rest API call `AdminResource#validateGlobalNamespaceOwnership`, broker will execute `PulsarWebResource#checkLocalOrGetPeerReplicationCluster`. In `PulsarWebResource#checkLocalOrGetPeerReplicationCluster`: https://github.com/apache/pulsar/blob/6d717a08ef8cfcac032caee06105285594baf09f/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java#L773-L802 Line 780, 794, and 801 has thrown RestException. But `validateGlobalNamespaceOwnership ` has wrapped the exception : https://github.com/apache/pulsar/blob/6d717a08ef8cfcac032caee06105285594baf09f/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java#L202-L216 This could make the user confused that the log printed is not matched with the REST API.
Motivation
When Rest API call
AdminResource#validateGlobalNamespaceOwnership
, broker will executePulsarWebResource#checkLocalOrGetPeerReplicationCluster
.In
PulsarWebResource#checkLocalOrGetPeerReplicationCluster
:pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java
Lines 773 to 802 in 6d717a0
Line 780, 794, and 801 has thrown RestException.
But
validateGlobalNamespaceOwnership
has wrapped the exception :pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
Lines 202 to 216 in 6d717a0
This could make the user confused that the log printed is not matched with the REST API.
Modification
Documentation
no-need-doc
doc-not-needed