-
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
Make sure policies.is_allow_auto_update_schema not null #14409
Make sure policies.is_allow_auto_update_schema not null #14409
Conversation
/pulsarbot run-failure-checks |
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.
We are used to allow getting the configuration merged with the global configuration using 'applied' parameter.
I can't give pointers now, but you can learn learn 'applied' in other APIs
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.
We can add a new interface Policies getPolicies(String namespace, boolean applied)
in org.apache.pulsar.client.admin.Namespaces
. And set applied
as true by default in getPolicies(String namespace)
.
In broker, add a new parameter @QueryParam("applied") @DefaultValue("true") boolean applied
in org.apache.pulsar.broker.admin.v2.Namespaces#getPolicies
.
NOTE: you may need to update other policies filed to applied value too.
the applied option should be false by default? to keep consistent with topic policy does. It's better to start with a PIP, as far as I understand, not all the namespace policies follow the same way, some return null if the namespace doesn't have the policy, some return value from broker level, we need to improve this situation even if the inevitable break change may be introduced, otherwise, we will always be confused by different behaviors. We should add a release notice for #12786 |
This default value is just for backward compatible. And we can even deprecate method |
I see, we have to make tradeoffs here, maybe we should make API follow the same pattern in 3.0 |
@gaoran10 @michaeljmarshall Please help check this PR, which is fixing a breaking change in the ongoing release 2.8.3, 2.9.2, and 2.10.0. And @wangjialing218 also shared the information under the 2.9.2 VOTE3 email thread, we need to decide as soon as possible whether to start a new round RC. |
@codelipenghui - thanks for tagging me. Looking now. |
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 change looks good to me, just left a minor comment.
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
Show resolved
Hide resolved
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 believe this solution is incomplete. I think we also need to update this method defined on line 517 in the same class:
protected Policies getNamespacePolicies(String tenant, String cluster, String namespace)
After looking at the code a bit more, it appears that updating the second |
This makes sense to me. Do you think we need to add the |
@michaeljmarshall Done, the second method was duplicated code from first one. |
@wangjialing218 - great, I thought those methods looked similar, but I didn't look closely enough to see the one was a duplicate. Thanks for fixing that. |
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 don't have a strong opinion regarding the applied
flag. I think we could probably add it to this endpoint without breaking the API for 2.10. I am interested to know what @eolivelli has to say.
I am +1 on the PR when ignoring the question of the applied
flag.
We can go with the current form from my opinion. Let's unblock the release. |
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
/pulsarbot run-failure-checks |
Agree, maybe we can plan to 2.11 |
@eolivelli @Jason918 @michaeljmarshall Please help review again |
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.
+1
(cherry picked from commit 7d60795)
(cherry picked from commit 7d60795)
(cherry picked from commit 7d60795)
Motivation
Follow code works fine on 2.8.x but get NPE on 2.9.x
Becasue
Policies.is_allow_auto_update_schema
changed fromboolean
toBoolean
by #12786 and default value is null.This may cause user's service fail when upgrade pulsar from 2.8.x to 2.9.x
Modifications
Make sure
Policies.is_allow_auto_update_schema
not null when callgetPolicies
Documentation
no-need-doc
Just keep behaviour same between 2.8.x and 2.9.x