Skip to content

[broker][admin]Add api for update topic properties - #17238

Merged
AnonHxy merged 3 commits into
apache:masterfrom
AnonHxy:update_topic_properties_api
Aug 25, 2022
Merged

[broker][admin]Add api for update topic properties#17238
AnonHxy merged 3 commits into
apache:masterfrom
AnonHxy:update_topic_properties_api

Conversation

@AnonHxy

@AnonHxy AnonHxy commented Aug 23, 2022

Copy link
Copy Markdown
Contributor

Motivation

  • Maybe this modification should be part of PIP 110: Topic metadata #12629 . As described in the PIP document "These metadata could be set during topic creation and also updated.", we have implemented the creation method, but have not implement the updated method.

  • This PR will implement the topic meta update

Modifications

  • Add a admin api updateProperties

Verifying this change

  • Make sure that the change passes the CI checks.
  • Add UT org.apache.pulsar.broker.admin.AdminApi2Test#testUpdatePartitionedTopicProperties
  • Add UT org.apache.pulsar.broker.admin.AdminApi2Test#testUpdateNonPartitionedTopicProperties

Documentation

Check the box below or label this PR directly.

Need to update docs?

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

@AnonHxy AnonHxy added the doc-not-needed Your PR changes do not impact docs label Aug 23, 2022
@AnonHxy
AnonHxy requested a review from Jason918 August 23, 2022 17:30
@AnonHxy AnonHxy self-assigned this Aug 23, 2022

@Technoboy- Technoboy- left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@Technoboy- Technoboy- added this to the 2.12.0 milestone Aug 24, 2022
@Technoboy- Technoboy- added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages area/admin labels Aug 24, 2022
@Jason918

Jason918 commented Sep 4, 2022

Copy link
Copy Markdown
Contributor

Can you help open a new PR to branch-2.10? There are a lot conflict when cherry-pick directly. @AnonHxy

@eolivelli

Copy link
Copy Markdown
Contributor

@Jason918 we cannot add new APIs on released branches

@Jason918

Jason918 commented Sep 4, 2022

Copy link
Copy Markdown
Contributor

@Jason918 we cannot add new APIs on released branches

Sure, I will remove the label.

liangyepianzhou pushed a commit to streamnative/pulsar-archived that referenced this pull request Mar 1, 2023
yaalsn pushed a commit to streamnative/pulsar-archived that referenced this pull request Mar 1, 2023
liangyepianzhou pushed a commit to streamnative/pulsar-archived that referenced this pull request May 10, 2023

@Override
public void updatePropertiesComplete(Map<String, String> properties, Object ctx) {
managedLedger.getConfig().getProperties().putAll(properties);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

managedLedger.getConfig().getProperties() can return NPE if the topic is from the older code without the properties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for you to fix it!

liangyepianzhou added a commit to streamnative/pulsar-archived that referenced this pull request Sep 27, 2023
* [broker][admin]Add api for update topic properties (apache#17238)

(cherry picked from commit b21f728)

* [broker][admin] Add cmd to remove topic properties (apache#17337)

* [broker][admin] Add cmd to remove topic properties

* address comment

* address comment

(cherry picked from commit 7075a5c)
(cherry picked from commit 6f8dbc7)

* [fix][broker] Fix NPE when updating topic's properties (apache#17352)

Co-authored-by: bjhuxiaohua <bjhuxiaohua@foxmail.com>
(cherry picked from commit f1d1158)
(cherry picked from commit 723ad75)

* [fix][broker] Fix NPE when update topic properties.
### Motivation

In Pulsar 2.10, when creating a producer/consumer that auto-creates a topic and then attempts to update its properties, a NullPointerException (NPE) occurs. The reason is that Pulsar 2.10 does not correctly handle the case when the properties are `null`.
### Modifications

Add an NPE check.

(cherry picked from commit 0b02321)

* remove release profile

* import

* Revert "remove release profile"

This reverts commit 6bec650.

---------

Co-authored-by: Xiaoyu Hou <AnonHxyGo@gmail.com>
Co-authored-by: Ruguo Yu <jiang7chengzitc@163.com>
Co-authored-by: Flowermin <48741608+Flowermin@users.noreply.github.com>
liangyepianzhou added a commit to streamnative/pulsar-archived that referenced this pull request Sep 27, 2023
* [broker][admin]Add api for update topic properties (apache#17238)

(cherry picked from commit b21f728)

* [broker][admin] Add cmd to remove topic properties (apache#17337)

* [broker][admin] Add cmd to remove topic properties

* address comment

* address comment

(cherry picked from commit 7075a5c)
(cherry picked from commit 6f8dbc7)

* [fix][broker] Fix NPE when updating topic's properties (apache#17352)

Co-authored-by: bjhuxiaohua <bjhuxiaohua@foxmail.com>
(cherry picked from commit f1d1158)
(cherry picked from commit 723ad75)

* [fix][broker] Fix NPE when update topic properties.
### Motivation

In Pulsar 2.10, when creating a producer/consumer that auto-creates a topic and then attempts to update its properties, a NullPointerException (NPE) occurs. The reason is that Pulsar 2.10 does not correctly handle the case when the properties are `null`.
### Modifications

Add an NPE check.

(cherry picked from commit 0b02321)

* remove release profile

* import

* Revert "remove release profile"

This reverts commit 6bec650.

---------

Co-authored-by: Xiaoyu Hou <AnonHxyGo@gmail.com>
Co-authored-by: Ruguo Yu <jiang7chengzitc@163.com>
Co-authored-by: Flowermin <48741608+Flowermin@users.noreply.github.com>
nodece pushed a commit to nodece/pulsar that referenced this pull request Nov 24, 2023
(cherry picked from commit b21f728)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
nodece added a commit to ascentstream/pulsar that referenced this pull request Nov 27, 2023
* [broker][admin]Add api for update topic properties (apache#17238)

(cherry picked from commit b21f728)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>

* [broker][admin] Add cmd to remove topic properties (apache#17337)

* [broker][admin] Add cmd to remove topic properties

* address comment

* address comment

(cherry picked from commit 7075a5c)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>

* [fix][broker] Fix NPE when updating topic's properties (apache#17352)

Co-authored-by: bjhuxiaohua <bjhuxiaohua@foxmail.com>
(cherry picked from commit f1d1158)

---------

Co-authored-by: Xiaoyu Hou <anonhxygo@gmail.com>
Co-authored-by: Ruguo Yu <jiang7chengzitc@163.com>
Co-authored-by: Flowermin <48741608+Flowermin@users.noreply.github.com>
nodece added a commit to ascentstream/pulsar that referenced this pull request Mar 15, 2024
* [broker][admin]Add api for update topic properties (apache#17238)

(cherry picked from commit b21f728)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>

* [broker][admin] Add cmd to remove topic properties (apache#17337)

* [broker][admin] Add cmd to remove topic properties

* address comment

* address comment

(cherry picked from commit 7075a5c)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>

* [fix][broker] Fix NPE when updating topic's properties (apache#17352)

Co-authored-by: bjhuxiaohua <bjhuxiaohua@foxmail.com>
(cherry picked from commit f1d1158)

---------

Co-authored-by: Xiaoyu Hou <anonhxygo@gmail.com>
Co-authored-by: Ruguo Yu <jiang7chengzitc@163.com>
Co-authored-by: Flowermin <48741608+Flowermin@users.noreply.github.com>
nodece added a commit to ascentstream/pulsar that referenced this pull request Mar 15, 2024
* [broker][admin]Add api for update topic properties (apache#17238)

(cherry picked from commit b21f728)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>

* [broker][admin] Add cmd to remove topic properties (apache#17337)

* [broker][admin] Add cmd to remove topic properties

* address comment

* address comment

(cherry picked from commit 7075a5c)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>

* [fix][broker] Fix NPE when updating topic's properties (apache#17352)

Co-authored-by: bjhuxiaohua <bjhuxiaohua@foxmail.com>
(cherry picked from commit f1d1158)

---------

Co-authored-by: Xiaoyu Hou <anonhxygo@gmail.com>
Co-authored-by: Ruguo Yu <jiang7chengzitc@163.com>
Co-authored-by: Flowermin <48741608+Flowermin@users.noreply.github.com>
nodece added a commit to nodece/pulsar that referenced this pull request May 11, 2024
* [broker][admin]Add api for update topic properties (apache#17238)

(cherry picked from commit b21f728)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>

* [broker][admin] Add cmd to remove topic properties (apache#17337)

* [broker][admin] Add cmd to remove topic properties

* address comment

* address comment

(cherry picked from commit 7075a5c)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>

* [fix][broker] Fix NPE when updating topic's properties (apache#17352)

Co-authored-by: bjhuxiaohua <bjhuxiaohua@foxmail.com>
(cherry picked from commit f1d1158)

---------

Co-authored-by: Xiaoyu Hou <anonhxygo@gmail.com>
Co-authored-by: Ruguo Yu <jiang7chengzitc@163.com>
Co-authored-by: Flowermin <48741608+Flowermin@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/admin doc-not-needed Your PR changes do not impact docs type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants