[fix][broker] Handle the case when getOwnedServiceUnits fails gracefully - #23119
Merged
Conversation
heesung-sohn
reviewed
Aug 2, 2024
lhotari
approved these changes
Aug 5, 2024
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #23119 +/- ##
============================================
- Coverage 73.57% 73.46% -0.11%
- Complexity 32624 33544 +920
============================================
Files 1877 1919 +42
Lines 139502 144125 +4623
Branches 15299 15748 +449
============================================
+ Hits 102638 105886 +3248
- Misses 28908 30118 +1210
- Partials 7956 8121 +165
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
heesung-sohn
approved these changes
Aug 5, 2024
BewareMyPower
approved these changes
Aug 6, 2024
Technoboy-
pushed a commit
that referenced
this pull request
Aug 6, 2024
nikhil-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Aug 8, 2024
…fully (apache#23119) (cherry picked from commit fff41c3)
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Aug 12, 2024
…fully (apache#23119) (cherry picked from commit fff41c3)
Denovo1998
pushed a commit
to Denovo1998/pulsar
that referenced
this pull request
Aug 17, 2024
grssam
pushed a commit
to grssam/pulsar
that referenced
this pull request
Sep 4, 2024
hanmz
pushed a commit
to hanmz/pulsar
that referenced
this pull request
Feb 12, 2025
Demogorgon314
added a commit
to Demogorgon314/kop
that referenced
this pull request
Apr 15, 2026
…ative#659) ### Motivation The follow-up PR for the new LB: apache/pulsar#23119 The `getOwnedServiceUnits` may throw an exception after apache/pulsar#22977 , we can ignore this exception since the LB is not started yet. ``` pulsar-broker org.apache.pulsar.broker.PulsarServerException: java.lang.RuntimeException: java.lang.IllegalStateException: Invalid channel state:LeaderElectionServiceStarted pulsar-broker at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:997) pulsar-broker at org.apache.pulsar.PulsarBrokerStarter$BrokerStarter.call(PulsarBrokerStarter.java:294) pulsar-broker at org.apache.pulsar.PulsarBrokerStarter$BrokerStarter.call(PulsarBrokerStarter.java:131) pulsar-broker at picocli.CommandLine.executeUserObject(CommandLine.java:2041) pulsar-broker at picocli.CommandLine.access$1500(CommandLine.java:148) pulsar-broker at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461) pulsar-broker at picocli.CommandLine$RunLast.handle(CommandLine.java:2453) pulsar-broker at picocli.CommandLine$RunLast.handle(CommandLine.java:2415) pulsar-broker at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273) pulsar-broker at picocli.CommandLine$RunLast.execute(CommandLine.java:2417) pulsar-broker at picocli.CommandLine.execute(CommandLine.java:2170) pulsar-broker at org.apache.pulsar.PulsarBrokerStarter$BrokerStarter.start(PulsarBrokerStarter.java:152) pulsar-broker at org.apache.pulsar.PulsarBrokerStarter.main(PulsarBrokerStarter.java:386) pulsar-broker Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Invalid channel state:LeaderElectionServiceStarted pulsar-broker at org.apache.pulsar.broker.namespace.NamespaceService.getOwnedServiceUnits(NamespaceService.java:1203) pulsar-broker at io.streamnative.pulsar.handlers.kop.NamespaceBundleOwnershipListenerImpl.addTopicOwnershipListener(NamespaceBundleOwnershipListenerImpl.java:72) pulsar-broker at io.streamnative.pulsar.handlers.kop.KafkaProtocolHandler.start(KafkaProtocolHandler.java:259) pulsar-broker at org.apache.pulsar.broker.protocol.ProtocolHandlerWithClassLoader.start(ProtocolHandlerWithClassLoader.java:93) pulsar-broker at org.apache.pulsar.broker.protocol.ProtocolHandlers.lambda$start$4(ProtocolHandlers.java:153) pulsar-broker at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:422) pulsar-broker at org.apache.pulsar.broker.protocol.ProtocolHandlers.start(ProtocolHandlers.java:153) pulsar-broker at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:952) pulsar-broker ... 12 more pulsar-broker Caused by: java.lang.IllegalStateException: Invalid channel state:LeaderElectionServiceStarted pulsar-broker at org.apache.pulsar.broker.loadbalance.extensions.channel.ServiceUnitStateChannelImpl.getOwnershipEntrySet(ServiceUnitStateChannelImpl.java:1767) pulsar-broker at org.apache.pulsar.broker.loadbalance.extensions.ExtensibleLoadManagerImpl.getOwnedServiceUnitsAsync(ExtensibleLoadManagerImpl.java:217) pulsar-broker at org.apache.pulsar.broker.namespace.NamespaceService.getOwnedServiceUnits(NamespaceService.java:1200) pulsar-broker ... 19 more pulsar-broker 2024-08-12T04:00:38,065+0000 [pulsar-service-shutdown] INFO org.apache.pulsar.PulsarBrokerStarter - Shut down functions worker service successfully. pulsar-broker 2024-08-12T04:00:38,074+0000 [pulsar-service-shutdown] ERROR org.apache.pulsar.PulsarBrokerStarter - Error while shutting down Pulsar service ``` ### Modifications * Handle `getOwnedServiceUnits` fails gracefully
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
When
getOwnedServiceUnitsfails, the broker will fail to start, we should handlegetOwnedServiceUnitsfails gracefullyModifications
getOwnedServiceUnitsfails gracefullyServiceUnitStateChannel's tableview is null.Documentation
docdoc-requireddoc-not-neededdoc-complete