You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "dao-jun (via GitHub)" <gi...@apache.org> on 2025/04/10 09:00:23 UTC
[PR] [fix] Fix ML thread maybe blocked by internalGetPartitionedStats API [pulsar]
dao-jun opened a new pull request, #24167:
URL: https://github.com/apache/pulsar/pull/24167
### Motivation

### Modifications
<!-- Describe the modifications you've done. -->
### Verifying this change
- [ ] 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 -->
--
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][ml] Fix ML thread blocking issue in internalGetPartitionedStats API [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #24167:
URL: https://github.com/apache/pulsar/pull/24167#issuecomment-2792419484
@dao-jun I revisited the title and description with Claude AI and using the solution explained in https://gist.github.com/lhotari/81f533af4b9ad515e02d96e543c4408b
--
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][ml] Fix ML thread blocking issue in internalGetPartitionedStats API [pulsar]
Posted by "dao-jun (via GitHub)" <gi...@apache.org>.
dao-jun commented on PR #24167:
URL: https://github.com/apache/pulsar/pull/24167#issuecomment-2792447895
> @dao-jun I revisited the title and description with Claude AI and using the solution explained in https://gist.github.com/lhotari/81f533af4b9ad515e02d96e543c4408b
Thank! And there is a worse situation: If we get topic stats and set `getEarliestTimeInBacklog` to true, the thread can block forever. I'll add this situation to the motivation
--
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] Fix ML thread maybe blocked by internalGetPartitionedStats API [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #24167:
URL: https://github.com/apache/pulsar/pull/24167#discussion_r2037096893
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -1491,8 +1491,8 @@ protected void internalGetPartitionedStats(AsyncResponse asyncResponse, boolean
.thenCompose(owned -> {
if (owned) {
return getTopicReferenceAsync(partition)
- .thenApply(ref ->
- ref.getStats(getStatsOptions));
+ .thenCompose(ref -> ref.asyncGetStats(getStatsOptions))
+ .thenApply(s -> (TopicStats) s);
Review Comment:
oh yes, it's needed. Another way to write this is `.thenApply(TopicStats.class::cast)`, however there's no need to make a change.
--
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][ml] Fix ML thread blocking issue in internalGetPartitionedStats API [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari merged PR #24167:
URL: https://github.com/apache/pulsar/pull/24167
--
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] Fix ML thread maybe blocked by internalGetPartitionedStats API [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #24167:
URL: https://github.com/apache/pulsar/pull/24167#discussion_r2037086144
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -1491,8 +1491,8 @@ protected void internalGetPartitionedStats(AsyncResponse asyncResponse, boolean
.thenCompose(owned -> {
if (owned) {
return getTopicReferenceAsync(partition)
- .thenApply(ref ->
- ref.getStats(getStatsOptions));
+ .thenCompose(ref -> ref.asyncGetStats(getStatsOptions))
+ .thenApply(s -> (TopicStats) s);
Review Comment:
is this line needed?
--
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] Fix ML thread maybe blocked by internalGetPartitionedStats API [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on PR #24167:
URL: https://github.com/apache/pulsar/pull/24167#issuecomment-2792399825
@dao-jun Please spend some time writing a motivation and modifications in written text. You can use LLM like DeepSeek to achieve that. Follow this guide to achieve that: https://gist.github.com/lhotari/81f533af4b9ad515e02d96e543c4408b .
--
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] Fix ML thread maybe blocked by internalGetPartitionedStats API [pulsar]
Posted by "dao-jun (via GitHub)" <gi...@apache.org>.
dao-jun closed pull request #24167: [fix] Fix ML thread maybe blocked by internalGetPartitionedStats API
URL: https://github.com/apache/pulsar/pull/24167
--
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][ml] Fix ML thread blocking issue in internalGetPartitionedStats API [pulsar]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #24167:
URL: https://github.com/apache/pulsar/pull/24167#issuecomment-2792433670
## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/24167?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 74.25%. Comparing base [(`bbc6224`)](https://app.codecov.io/gh/apache/pulsar/commit/bbc62245c5ddba1de4b1e7cee4ab49334bc36277?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`6d78158`)](https://app.codecov.io/gh/apache/pulsar/commit/6d781582639b44b87658a7ca823ff62a191d7172?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 1015 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/pulsar/pull/24167?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #24167 +/- ##
============================================
+ Coverage 73.57% 74.25% +0.67%
+ Complexity 32624 32502 -122
============================================
Files 1877 1864 -13
Lines 139502 144495 +4993
Branches 15299 16488 +1189
============================================
+ Hits 102638 107289 +4651
+ Misses 28908 28735 -173
- Partials 7956 8471 +515
```
| [Flag](https://app.codecov.io/gh/apache/pulsar/pull/24167/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/24167/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `26.82% <0.00%> (+2.24%)` | :arrow_up: |
| [systests](https://app.codecov.io/gh/apache/pulsar/pull/24167/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `23.21% <0.00%> (-1.12%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pulsar/pull/24167/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.74% <100.00%> (+0.90%)` | :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/24167?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...pulsar/broker/admin/impl/PersistentTopicsBase.java](https://app.codecov.io/gh/apache/pulsar/pull/24167?src=pr&el=tree&filepath=pulsar-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fbroker%2Fadmin%2Fimpl%2FPersistentTopicsBase.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi9pbXBsL1BlcnNpc3RlbnRUb3BpY3NCYXNlLmphdmE=) | `69.99% <100.00%> (+4.53%)` | :arrow_up: |
... and [1065 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/24167/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