Skip to content

Conversation

@nodece
Copy link
Member

@nodece nodece commented May 27, 2025

Fixes #24312

Motivation

The brokerId was previously initialized in the start method, after the BrokerService had already started. This could lead to a NullPointerException if the brokerId is accessed during the early stages of startup.

Modifications

  • Only handle the metadata changes when broker is fully started.
  • Failed to retrieve brokerId, please fall back to unknown.

Documentation

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

@nodece nodece self-assigned this May 27, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label May 27, 2025
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

This solution won't work when using a dynamic port (0). What NPEs are you seeing?

@lhotari
Copy link
Member

lhotari commented May 27, 2025

Commented about another way to address the issue: #24312 (comment)

@nodece nodece changed the title [fix][broker] Assign broker ID during construction instead of at startup [fix][broker] Ignore metadata changes when broker is not in the Started state May 28, 2025
@nodece nodece requested a review from lhotari May 28, 2025 03:07
…ed state

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented May 28, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 74.22%. Comparing base (bbc6224) to head (540a8ce).
Report is 1123 commits behind head on master.

Files with missing lines Patch % Lines
...rg/apache/pulsar/broker/service/BrokerService.java 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24352      +/-   ##
============================================
+ Coverage     73.57%   74.22%   +0.65%     
- Complexity    32624    32645      +21     
============================================
  Files          1877     1866      -11     
  Lines        139502   145133    +5631     
  Branches      15299    16596    +1297     
============================================
+ Hits         102638   107732    +5094     
+ Misses        28908    28879      -29     
- Partials       7956     8522     +566     
Flag Coverage Δ
inttests 26.68% <75.00%> (+2.10%) ⬆️
systests 23.29% <75.00%> (-1.03%) ⬇️
unittests 73.71% <75.00%> (+0.87%) ⬆️

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

Files with missing lines Coverage Δ
...rg/apache/pulsar/broker/service/BrokerService.java 83.57% <75.00%> (+2.79%) ⬆️

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

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

@lhotari lhotari added this to the 4.1.0 milestone May 28, 2025
@lhotari lhotari merged commit 12c96f6 into apache:master May 28, 2025
56 checks passed
nodece added a commit to ascentstream/pulsar that referenced this pull request May 28, 2025
…ed state (apache#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>

(cherry picked from commit 12c96f6)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
lhotari pushed a commit that referenced this pull request Jun 2, 2025
…ed state (#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
(cherry picked from commit 12c96f6)
lhotari pushed a commit that referenced this pull request Jun 2, 2025
…ed state (#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
(cherry picked from commit 12c96f6)
lhotari pushed a commit that referenced this pull request Jun 2, 2025
…ed state (#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
(cherry picked from commit 12c96f6)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 4, 2025
…ed state (apache#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
(cherry picked from commit 12c96f6)
(cherry picked from commit 38d71d3)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 4, 2025
…ed state (apache#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
(cherry picked from commit 12c96f6)
(cherry picked from commit 1602336)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 4, 2025
…ed state (apache#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
(cherry picked from commit 12c96f6)
(cherry picked from commit 38d71d3)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 4, 2025
…ed state (apache#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
(cherry picked from commit 12c96f6)
(cherry picked from commit 38d71d3)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 5, 2025
…ed state (apache#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
(cherry picked from commit 12c96f6)
(cherry picked from commit 1602336)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 5, 2025
…ed state (apache#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
(cherry picked from commit 12c96f6)
(cherry picked from commit 38d71d3)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 10, 2025
…ed state (apache#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
(cherry picked from commit 12c96f6)
(cherry picked from commit 38d71d3)
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
…ed state (apache#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
…ed state (apache#24352)

Signed-off-by: Zixuan Liu <nodeces@gmail.com>
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.

[Bug] pulsar 4.0.4 Unable to start broker

3 participants