You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "Denovo1998 (via GitHub)" <gi...@apache.org> on 2025/09/21 01:28:46 UTC
[PR] Fix test disable broker [pulsar]
Denovo1998 opened a new pull request, #24770:
URL: https://github.com/apache/pulsar/pull/24770
<!--
### Contribution Checklist
- PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://pulsar.apache.org/contribute/develop-semantic-title/)*.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Each pull request should address only one issue, not mix up code from multiple issues.
- Each commit in the pull request has a meaningful commit message
- Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
-->
<!-- Either this PR fixes an issue, -->
Fixes #xyz
<!-- or this PR is one task of an issue -->
Main Issue: #xyz
<!-- If the PR belongs to a PIP, please add the PIP link here -->
PIP: #xyz
<!-- Details of when a PIP is required and how the PIP process work, please see: https://github.com/apache/pulsar/blob/master/pip/README.md -->
### Motivation
**log:** https://gist.github.com/Denovo1998/c48c58c1de0270a4008ae77b6161adfb
When running `ExtensibleLoadManagerImplTest`, testDisableBroker occasionally fails. There are two root causes:
- In the test, disableBroker() was called on the third broker. Subsequently, during the shutdown process, disableBroker() will be called again through BrokerService. The exception log itself does not affect the test assertion.
- More importantly, even after disabling, testDisableBroker will still call ternaryLoadManager.checkOwnershipAsync(...). At this time, the channel has cleaned up ownerships and unregistered. And when using the metadata-based `ServiceUnitStateTableViewImpl`, `ServiceUnitStateChannelImpl.getActiveOwnerAsync` will throw a `MetadataStoreException` because the brokerRegistry is not registered, causing `.get()` to return an ExecutionException.
Semantically, a disabled/closed broker should no longer claim to own any bundle, nor should it trigger metadata liveness checks and exceptions in this state.
Therefore, in the "Channel disable/closed" scenario, directly short-circuiting the "ownership" check to "no" avoids exceptions and stabilizes testing.
### Modifications
Add handling of channel state in `org.apache.pulsar.broker.loadbalance.extensions.channel.ServiceUnitStateChannelImpl#getActiveOwnerAsync`, specifically as follows:
- New channel status judgment:
- When channelState is Disabled or Closed, the current broker cannot be an active owner:
- If the table already has an owner and it is not the local machine (for example, the bundle has been assigned to another broker), then return the owner as is for upper-layer redirection;
- If the owner in the table is the local machine or is empty, return Optional.empty().
- When the channel is normal (not Disabled/Closed), keep the original logic unchanged:
- Still throw MetadataStoreException when brokerRegistry.isRegistered() is false and using metadata-based table view (this branch is only triggered in non-disabled/shutdown state), directly return owner under in-memory table.
- Still validate liveness according to the original logic through dedupeGetOwnerRequest and brokerRegistry.lookupAsync.
### Verifying this change
- [x] 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*
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: https://github.com/Denovo1998/pulsar/pull/11
<!--
After opening this PR, the build in apache/pulsar will fail and instructions will
be provided for opening a PR in the PR author's forked repository.
apache/pulsar pull requests should be first tested in your own fork since the
apache/pulsar CI based on GitHub Actions has constrained resources and quota.
GitHub Actions provides separate quota for pull requests that are executed in
a forked repository.
The tests will be run in the forked repository until all PR review comments have
been handled, the tests pass and the PR is approved by a reviewer.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Flaky-test: ExtensibleLoadManagerImplTest.testDisableBroker [pulsar]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #24770:
URL: https://github.com/apache/pulsar/pull/24770#issuecomment-3324099082
## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/24770?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `22.22222%` with `7 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 74.23%. Comparing base ([`0c6ba1c`](https://app.codecov.io/gh/apache/pulsar/commit/0c6ba1cf72fb12b9a97e3f8438d5c34a5918fb69?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`e01a9c3`](https://app.codecov.io/gh/apache/pulsar/commit/e01a9c3f66101f8871fbac420db1a0500df04c15?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 2 commits behind head on master.
| [Files with missing lines](https://app.codecov.io/gh/apache/pulsar/pull/24770?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...xtensions/channel/ServiceUnitStateChannelImpl.java](https://app.codecov.io/gh/apache/pulsar/pull/24770?src=pr&el=tree&filepath=pulsar-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fbroker%2Floadbalance%2Fextensions%2Fchannel%2FServiceUnitStateChannelImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9sb2FkYmFsYW5jZS9leHRlbnNpb25zL2NoYW5uZWwvU2VydmljZVVuaXRTdGF0ZUNoYW5uZWxJbXBsLmphdmE=) | 22.22% | [3 Missing and 4 partials :warning: ](https://app.codecov.io/gh/apache/pulsar/pull/24770?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/pulsar/pull/24770?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #24770 +/- ##
=============================================
+ Coverage 39.04% 74.23% +35.18%
- Complexity 13345 33266 +19921
=============================================
Files 1844 1901 +57
Lines 144311 148412 +4101
Branches 16730 17208 +478
=============================================
+ Hits 56353 110171 +53818
+ Misses 80460 29465 -50995
- Partials 7498 8776 +1278
```
| [Flag](https://app.codecov.io/gh/apache/pulsar/pull/24770/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [inttests](https://app.codecov.io/gh/apache/pulsar/pull/24770/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.71% <0.00%> (-0.06%)` | :arrow_down: |
| [systests](https://app.codecov.io/gh/apache/pulsar/pull/24770/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `22.76% <0.00%> (-0.08%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pulsar/pull/24770/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.77% <22.22%> (+38.59%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Files with missing lines](https://app.codecov.io/gh/apache/pulsar/pull/24770?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...xtensions/channel/ServiceUnitStateChannelImpl.java](https://app.codecov.io/gh/apache/pulsar/pull/24770?src=pr&el=tree&filepath=pulsar-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fbroker%2Floadbalance%2Fextensions%2Fchannel%2FServiceUnitStateChannelImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9sb2FkYmFsYW5jZS9leHRlbnNpb25zL2NoYW5uZWwvU2VydmljZVVuaXRTdGF0ZUNoYW5uZWxJbXBsLmphdmE=) | `86.30% <22.22%> (+9.29%)` | :arrow_up: |
... and [1397 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/24770/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Flaky-test: ExtensibleLoadManagerImplTest.testDisableBroker [pulsar]
Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower merged PR #24770:
URL: https://github.com/apache/pulsar/pull/24770
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org