Skip to content

[fix][broker] Support namespace unsubscribe when bundles are unloaded - #25276

Merged
codelipenghui merged 6 commits into
apache:masterfrom
zhanghaou:fix-namespace-unsub
Mar 5, 2026
Merged

[fix][broker] Support namespace unsubscribe when bundles are unloaded#25276
codelipenghui merged 6 commits into
apache:masterfrom
zhanghaou:fix-namespace-unsub

Conversation

@zhanghaou

Copy link
Copy Markdown
Contributor

Motivation

Unsubscribing at namespace/bundle level fails when the target bundle is not loaded by any broker.

This PR makes unsubscribe paths handle unloaded bundles by acquiring ownership when needed and loading topics before unsubscribing.

Modifications

  1. Convert namespace/bundle unsubscribe paths to async internal APIs and update v1/v2 admin endpoints to use async response flow.
  2. Allow bundle ownership acquisition for unsubscribe operations when bundle is not loaded.
  3. Load topics from metadata and ensure they are in memory before removing subscriptions.
  4. Add tests to verify unsubscribe works on unloaded bundles (both namespace and bundle scope).

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Feb 28, 2026
张浩 added 2 commits February 28, 2026 17:03
@codecov-commenter

codecov-commenter commented Mar 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.65432% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.61%. Comparing base (4cbe124) to head (bec2329).
⚠️ Report is 23 commits behind head on master.

Files with missing lines Patch % Lines
...pache/pulsar/broker/admin/impl/NamespacesBase.java 81.81% 6 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #25276      +/-   ##
============================================
- Coverage     72.81%   72.61%   -0.20%     
- Complexity    34134    34555     +421     
============================================
  Files          1959     1968       +9     
  Lines        155543   155954     +411     
  Branches      17741    17766      +25     
============================================
- Hits         113263   113252      -11     
- Misses        33322    33660     +338     
- Partials       8958     9042      +84     
Flag Coverage Δ
inttests 25.77% <0.00%> (-0.22%) ⬇️
systests 22.35% <60.49%> (-0.19%) ⬇️
unittests 73.57% <87.65%> (-0.21%) ⬇️

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

Files with missing lines Coverage Δ
.../org/apache/pulsar/broker/admin/v1/Namespaces.java 53.39% <100.00%> (+0.94%) ⬆️
.../org/apache/pulsar/broker/admin/v2/Namespaces.java 90.81% <100.00%> (+0.22%) ⬆️
...pache/pulsar/broker/admin/impl/NamespacesBase.java 77.81% <81.81%> (+0.21%) ⬆️

... and 112 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zhanghaou
zhanghaou requested a review from Denovo1998 March 4, 2026 01:50
@codelipenghui codelipenghui added this to the 4.2.0 milestone Mar 5, 2026
@codelipenghui codelipenghui added type/bug The PR fixed a bug or issue reported a bug area/broker release/4.1.4 release/4.0.10 labels Mar 5, 2026
@codelipenghui
codelipenghui merged commit f83251a into apache:master Mar 5, 2026
55 of 56 checks passed
lhotari pushed a commit that referenced this pull request Mar 10, 2026
lhotari pushed a commit that referenced this pull request Mar 10, 2026
ridhkapoor pushed a commit to datastax/pulsar that referenced this pull request Mar 13, 2026
ganesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 16, 2026
ridhkapoor pushed a commit to datastax/pulsar that referenced this pull request Mar 16, 2026
ridhkapoor pushed a commit to datastax/pulsar that referenced this pull request Mar 16, 2026
ridhkapoor pushed a commit to datastax/pulsar that referenced this pull request Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants