You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "3pacccccc (via GitHub)" <gi...@apache.org> on 2025/08/05 16:47:07 UTC
[PR] [fix][test] fix flaky EntryCacheManagerTest.simple [pulsar]
3pacccccc opened a new pull request, #24609:
URL: https://github.com/apache/pulsar/pull/24609
Fixes https://github.com/apache/pulsar/issues/24608
### motivation
this test was flaky due to
**line108** in ```EntryCacheManagerTest.java``` of current master branch
already triggered cache eviction, so sometimes the eviction is over, sometimes not, cause this flaky.
### Modifications
1. Removed one entry insertion (`EntryImpl.create(2, 2, new byte[1]`) to:
- Ensure predictable cache eviction timing
- Maintain test's original purpose of verifying eviction logic
2. Updated all affected assertions to match the new expected cache sizes:
- Reduced expected sizes by 1 across all assertions
- Maintained consistent state validation throughout test flow
### 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*
### Does this pull request potentially affect one of the following parts:
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
### 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/3pacccccc/pulsar/pull/21
<!--
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] fix flaky EntryCacheManagerTest.simple [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #24609:
URL: https://github.com/apache/pulsar/pull/24609#discussion_r2257838309
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/EntryCacheManagerTest.java:
##########
Review Comment:
Oh yes, that's correct. There's a hard coded value that starts eviction when the total cache size is more than 98% consumed, https://github.com/apache/pulsar/blob/dedba1a9bf0becb1b3f80f1d89a779451734fbe6/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/RangeEntryCacheManagerImpl.java#L55-L66
--
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] fix flaky EntryCacheManagerTest.simple [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #24609:
URL: https://github.com/apache/pulsar/pull/24609#discussion_r2256202081
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/EntryCacheManagerTest.java:
##########
Review Comment:
The way how eviction happens was changed in #24363.
To address the test flakiness, the test should control the evictions. Here's an example from another test case:
https://github.com/apache/pulsar/blob/8ce67b97b3e428eac02dcfe0bb41d698deb78fd4/pulsar-broker/src/test/java/org/apache/pulsar/broker/stats/PrometheusMetricsTest.java#L694-L696
--
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] Fix flaky EntryCacheManagerTest.simple [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- merged PR #24609:
URL: https://github.com/apache/pulsar/pull/24609
--
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] fix flaky EntryCacheManagerTest.simple [pulsar]
Posted by "3pacccccc (via GitHub)" <gi...@apache.org>.
3pacccccc commented on code in PR #24609:
URL: https://github.com/apache/pulsar/pull/24609#discussion_r2257665825
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/EntryCacheManagerTest.java:
##########
Review Comment:
thank you for your suggestions @lhotari
But I think The root cause of this test flakiness stems from incorrect assumptions about eviction timing. Currently, eviction occurs immediately after inserting ```EntryImpl.create(2, 2, new byte[1])```, but the test incorrectly assumes eviction happens during the next insertion.
The test's original intention appears to be verifying when eviction gets triggered, but it mispredicts the exact trigger point. I think we don't need to manually blocking evictions.
Or Maybe I don't get your point, Would you like to show me how to properly deal with it?
--
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