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/10/16 13:18:25 UTC
[PR] [fix][test] Stabilize SequenceIdWithErrorTest by fencing after first publish to avoid empty-ledger deletion and send timeout [pulsar]
Denovo1998 opened a new pull request, #24861:
URL: https://github.com/apache/pulsar/pull/24861
<!--
### 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 #24849
<!-- 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
- Previously the test fenced the topic (by opening/closing the ManagedLedger externally) before the producer sent any message. If the current ledger is empty (LAC = -1), the broker’s recovery path deletes that empty ledger. Meanwhile, the managed ledger’s metadata update loop still tries to read/write that deleted ledger, leading to BKNoSuchLedgerExistsOnMetadataServerException and putting the ManagedLedger into a Fenced state.
- Recovery then fails to complete within the producer’s send timeout, so the first send blocks and times out, making the test flaky or consistently failing.
- By moving the fence after the first message is successfully written, the current ledger is non-empty, recovery proceeds by rolling to a new ledger instead of deleting the empty one, and the test can reliably verify the sequenceId behavior across a transient send error.
### Modifications
- Reordered the test flow in SequenceIdWithErrorTest:
- Create the producer and send the first message ("Hello-0") before fencing, ensuring the current ledger is not empty.
- Then fence the topic by externally opening/closing the ManagedLedger (via ManagedLedgerClientFactory), which triggers broker recovery as intended.
- Continue sending the remaining messages and verify their values and sequenceId.
- Added a timeout to consumer.receive(..., 10, TimeUnit.SECONDS) to avoid unbounded waits in abnormal conditions.
- Ensured resources are properly closed (ManagedLedger clientFactory.close() and eventLoopGroup.shutdownGracefully().get()), and the Pulsar client is closed at the end of the test.
### 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: <!-- ENTER URL HERE -->
<!--
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][test] Stabilize SequenceIdWithErrorTest by fencing after first publish to avoid empty-ledger deletion and send timeout [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari merged PR #24861:
URL: https://github.com/apache/pulsar/pull/24861
--
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][test] Stabilize SequenceIdWithErrorTest by fencing after first publish to avoid empty-ledger deletion and send timeout [pulsar]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #24861:
URL: https://github.com/apache/pulsar/pull/24861#issuecomment-3414551411
## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/24861?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 74.29%. Comparing base ([`ee33c99`](https://app.codecov.io/gh/apache/pulsar/commit/ee33c99606e8f573dc55f47529e7c209bd8194e3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`8a47bc6`](https://app.codecov.io/gh/apache/pulsar/commit/8a47bc684e2e5d20887b27f5497884746f5a78f5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 8 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/pulsar/pull/24861?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #24861 +/- ##
============================================
- Coverage 74.45% 74.29% -0.16%
- Complexity 33531 33848 +317
============================================
Files 1913 1913
Lines 149280 149312 +32
Branches 17324 17330 +6
============================================
- Hits 111140 110933 -207
- Misses 29341 29550 +209
- Partials 8799 8829 +30
```
| [Flag](https://app.codecov.io/gh/apache/pulsar/pull/24861/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/24861/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.52% <ø> (-0.40%)` | :arrow_down: |
| [systests](https://app.codecov.io/gh/apache/pulsar/pull/24861/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `22.82% <ø> (-0.07%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pulsar/pull/24861/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.81% <ø> (-0.16%)` | :arrow_down: |
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.
[see 104 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/24861/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