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][broker] Return non-null persistence policy for namespace #14158

Closed
wants to merge 4 commits into from

Conversation

rdhabalia
Copy link
Contributor

@rdhabalia rdhabalia commented Feb 8, 2022

Motivation

Right now, if namespace is not configured with persistence policy then broker considers default persistence-policy while serving the topic but it returns null value in get-persistence admin API

./pulsar-admin namespaces get-persistence pulsar/standalone/ns2
null

Modification

Return default persistence policy if namespace persistence policy is not configured.

  • doc-not-needed

@github-actions
Copy link

github-actions bot commented Feb 8, 2022

@rdhabalia: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)

1 similar comment
@github-actions
Copy link

github-actions bot commented Feb 8, 2022

@rdhabalia: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)

eolivelli
eolivelli previously approved these changes Feb 8, 2022
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

Lgtm

With this change, is it possible to know from the API if we set a policy vs we are returning the default values?

@rdhabalia
Copy link
Contributor Author

this change only impacts api-get call code-path and it will not change set-policy with default values.

Copy link
Contributor

@Jason918 Jason918 left a comment

Choose a reason for hiding this comment

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

I think we can add an applied to control whether we should return namespace setting or the value that actually take effects, like many other polices in org.apache.pulsar.broker.admin.v2.PersistentTopics

@codelipenghui
Copy link
Contributor

I think we can add an applied to control whether we should return namespace setting or the value that actually take effects, like many other polices in org.apache.pulsar.broker.admin.v2.PersistentTopics

Agree, with this change, users will not able to know what is the namespace settings. We should apply the same behavior, for policies, if the topic/namespace don't have a policy, just provide a response to tell users no policy for this topic/namespace, if users want to check which policy will be applied, they can add --applied`.

@codelipenghui
Copy link
Contributor

I will move this one to milestone 2.11 first.

@codelipenghui codelipenghui modified the milestones: 2.10.0, 2.11.0 Feb 8, 2022
@rdhabalia
Copy link
Contributor Author

with this change, users will not able to know what is the namespace settings.

this is incorrect, this PR only sets default persistence policy if the value is not configured and right now it's returning null which is confusing for user. we don't need any additional control flag to show null value to user. and regrading other policies , that can be handled in separate PR and we don't want to mix everything in this one.

@codelipenghui this PR has minor change which doesn't break any change then why should we change the release for this PR and why can't we merge to 2.10 ?

@michaeljmarshall
Copy link
Member

On a note completely unrelated to the content of this PR, we're able to merge this PR without a test passing because it is not "required". I am working on fixing this by updating the .asf.yaml.

Screen Shot 2022-02-10 at 5 25 10 PM

@github-actions
Copy link

The pr had no activity for 30 days, mark with Stale label.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

+1

@eolivelli eolivelli closed this Mar 19, 2022
@eolivelli eolivelli reopened this Mar 19, 2022
@eolivelli
Copy link
Contributor

Reopened to trigger CI

@github-actions
Copy link

The pr had no activity for 30 days, mark with Stale label.

@github-actions
Copy link

The pr had no activity for 30 days, mark with Stale label.

@codelipenghui codelipenghui modified the milestones: 2.11.0, 2.12.0 Jul 26, 2022
@tisonkun tisonkun changed the title [pulsar-broker] Fix: return non-null persistence policy for namespace [fix][broker] Return non-null persistence policy for namespace Dec 10, 2022
@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Dec 10, 2022
Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

Rebased. Pending to merge.

@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2022

Codecov Report

Merging #14158 (a1bfb93) into master (1b5722d) will decrease coverage by 11.50%.
The diff coverage is 0.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #14158       +/-   ##
=============================================
- Coverage     46.34%   34.84%   -11.51%     
+ Complexity    10394     7480     -2914     
=============================================
  Files           703      703               
  Lines         68838    68840        +2     
  Branches       7379     7378        -1     
=============================================
- Hits          31905    23988     -7917     
- Misses        33324    41645     +8321     
+ Partials       3609     3207      -402     
Flag Coverage Δ
unittests 34.84% <0.00%> (-11.51%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../org/apache/pulsar/broker/admin/AdminResource.java 32.34% <0.00%> (-32.64%) ⬇️
...pache/pulsar/broker/admin/impl/NamespacesBase.java 15.18% <0.00%> (-47.92%) ⬇️
...pulsar/broker/admin/impl/PersistentTopicsBase.java 12.34% <0.00%> (-46.71%) ⬇️
...ava/org/apache/pulsar/broker/admin/v1/Brokers.java 0.00% <0.00%> (-100.00%) ⬇️
...va/org/apache/pulsar/broker/admin/v1/Clusters.java 0.00% <0.00%> (-100.00%) ⬇️
.../org/apache/pulsar/broker/admin/v1/Properties.java 0.00% <0.00%> (-100.00%) ⬇️
.../apache/pulsar/broker/admin/v2/ResourceGroups.java 0.00% <0.00%> (-100.00%) ⬇️
...ar/common/naming/PartitionedManagedLedgerInfo.java 0.00% <0.00%> (-100.00%) ⬇️
...naming/RangeEquallyDivideBundleSplitAlgorithm.java 0.00% <0.00%> (-100.00%) ⬇️
...e/pulsar/broker/admin/impl/ResourceQuotasBase.java 0.00% <0.00%> (-96.43%) ⬇️
... and 129 more

@tisonkun
Copy link
Member

It seems the codebase evolves a lot and the added test testSetPersistencePolicies#L439 fail now.

Close as stale.

@rdhabalia you may pick up this patch and rebase on the current master to pass the related tests and resubmit it again.

@tisonkun tisonkun closed this Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants