Skip to content

[cleanup] PIP-457: Remove NamespaceName.isGlobal() and TopicName.isGlobal()#25319

Merged
lhotari merged 1 commit intoapache:masterfrom
merlimat:pip-457-cleanup
Mar 16, 2026
Merged

[cleanup] PIP-457: Remove NamespaceName.isGlobal() and TopicName.isGlobal()#25319
lhotari merged 1 commit intoapache:masterfrom
merlimat:pip-457-cleanup

Conversation

@merlimat
Copy link
Contributor

Motivation

Follow-up cleanup for PIP-457 (V1 topic name and namespace removal, #25275 and #25304).

With V1 namespace removal, NamespaceName.isGlobal() always returns true (since all namespaces are now 2-part V2 format). This makes isGlobal() dead code — every condition checking it is either always-true or always-false.

Modifications

  • Removed NamespaceName.isGlobal() and TopicName.isGlobal() methods
  • Simplified all call sites across the broker:
    • Always-true if (x.isGlobal()) conditions: unwrapped to just the body
    • Always-false if (!x.isGlobal()) conditions: removed as dead code
    • Combined conditions: removed the isGlobal() term
  • Cleaned up PersistentTopicsBase.java: chained thenCompose() calls directly instead of using intermediate variables with block lambdas (~30 methods simplified)

Verifying this change

This change is a pure refactor with no behavioral change — isGlobal() already returned true unconditionally.

Documentation

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

…obal()

With V1 namespace removal, isGlobal() always returns true, making it
dead code. Removed the methods and simplified all call sites:
- Always-true conditions unwrapped to just the body
- Always-false conditions (negated) removed as dead code
- Combined conditions simplified by removing the isGlobal() term
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Mar 13, 2026
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 83.33333% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.74%. Comparing base (ce5bc13) to head (4b986d3).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...oker/service/nonpersistent/NonPersistentTopic.java 47.05% 6 Missing and 3 partials ⚠️
...sar/broker/service/persistent/PersistentTopic.java 57.89% 7 Missing and 1 partial ⚠️
...he/pulsar/broker/admin/v2/NonPersistentTopics.java 20.00% 4 Missing ⚠️
...pulsar/broker/admin/impl/PersistentTopicsBase.java 97.89% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #25319      +/-   ##
============================================
+ Coverage     72.73%   72.74%   +0.01%     
+ Complexity    34671    34217     -454     
============================================
  Files          1967     1954      -13     
  Lines        156326   154609    -1717     
  Branches      17812    17693     -119     
============================================
- Hits         113697   112475    -1222     
+ Misses        33552    33125     -427     
+ Partials       9077     9009      -68     
Flag Coverage Δ
inttests 25.90% <31.15%> (+0.15%) ⬆️
systests 22.49% <19.56%> (+0.12%) ⬆️
unittests 73.73% <83.33%> (+0.03%) ⬆️

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/AdminResource.java 77.26% <100.00%> (+0.50%) ⬆️
...rg/apache/pulsar/broker/service/BrokerService.java 83.68% <ø> (+0.02%) ⬆️
...rg/apache/pulsar/broker/web/PulsarWebResource.java 65.70% <100.00%> (+1.74%) ⬆️
...org/apache/pulsar/common/naming/NamespaceName.java 89.28% <ø> (+0.24%) ⬆️
...ava/org/apache/pulsar/common/naming/TopicName.java 90.72% <ø> (-1.18%) ⬇️
...pulsar/broker/admin/impl/PersistentTopicsBase.java 69.98% <97.89%> (+0.16%) ⬆️
...he/pulsar/broker/admin/v2/NonPersistentTopics.java 64.00% <20.00%> (+0.28%) ⬆️
...sar/broker/service/persistent/PersistentTopic.java 80.23% <57.89%> (-0.04%) ⬇️
...oker/service/nonpersistent/NonPersistentTopic.java 71.42% <47.05%> (-1.47%) ⬇️

... and 108 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.

@lhotari lhotari merged commit 2e3e78d into apache:master Mar 16, 2026
56 of 57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs ready-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants