Skip to content

[improve] Removed usages of SafeRun - #20060

Merged
michaeljmarshall merged 1 commit into
apache:masterfrom
merlimat:safe-run
Apr 11, 2023
Merged

michaeljmarshall merged 1 commit into
apache:masterfrom
merlimat:safe-run

Conversation

@merlimat

@merlimat merlimat commented Apr 10, 2023 •

Copy link
Copy Markdown
Contributor

Motivation

With BK 4.16, we don't need to pass SafeRunnable instances to the OrderedExecutor anymore. The executor has embedded the logic of checking and logging exceptions.

Removing the SafeRun will avoid extra allocations in critical path and clutter of the code

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:

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

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: (merlimat#6)

@merlimat merlimat added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Apr 10, 2023
@merlimat merlimat added this to the 3.0.0 milestone Apr 10, 2023
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Apr 10, 2023
@merlimat

This comment was marked as resolved.

@codecov-commenter

codecov-commenter commented Apr 11, 2023 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.94%. Comparing base (470b674) to head (163cf54).
⚠️ Report is 2632 commits behind head on master.

Files with missing lines Patch % Lines
...che/bookkeeper/mledger/impl/ManagedCursorImpl.java 77.77% 2 Missing ⚠️
...rg/apache/bookkeeper/mledger/impl/OpReadEntry.java 66.66% 2 Missing ⚠️
...che/bookkeeper/mledger/impl/ManagedLedgerImpl.java 94.44% 1 Missing ⚠️
.../apache/bookkeeper/mledger/impl/MetaStoreImpl.java 92.30% 1 Missing ⚠️
...rg/apache/pulsar/broker/service/BrokerService.java 97.82% 1 Missing ⚠️
...va/org/apache/pulsar/broker/service/ServerCnx.java 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #20060       +/-   ##
=============================================
+ Coverage     33.13%   72.94%   +39.81%     
+ Complexity    12164     3575     -8589     
=============================================
  Files          1497     1857      +360     
  Lines        114032   137560    +23528     
  Branches      12373    15135     +2762     
=============================================
+ Hits          37782   100345    +62563     
+ Misses        71340    29234    -42106     
- Partials       4910     7981     +3071     
Flag Coverage Δ
inttests 24.38% <44.11%> (?)
systests 24.97% <47.79%> (?)
unittests 72.22% <92.64%> (+39.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...org/apache/bookkeeper/mledger/impl/OpAddEntry.java 73.84% <100.00%> (+13.33%) ⬆️
...okkeeper/mledger/impl/ShadowManagedLedgerImpl.java 55.66% <100.00%> (+55.66%) ⬆️
...mledger/impl/cache/RangeEntryCacheManagerImpl.java 96.15% <100.00%> (+48.71%) ⬆️
...ker/stats/prometheus/PrometheusMetricsServlet.java 69.04% <100.00%> (+45.23%) ⬆️
...sistent/PersistentDispatcherMultipleConsumers.java 75.29% <100.00%> (+22.88%) ⬆️
...tent/PersistentDispatcherSingleActiveConsumer.java 73.31% <100.00%> (+18.45%) ⬆️
...ersistentStickyKeyDispatcherMultipleConsumers.java 85.09% <100.00%> (+5.28%) ⬆️
...ersistentStreamingDispatcherMultipleConsumers.java 64.35% <100.00%> (ø)
...istentStreamingDispatcherSingleActiveConsumer.java 64.21% <100.00%> (-0.74%) ⬇️
...ervice/streamingdispatch/StreamingEntryReader.java 77.84% <100.00%> (-0.52%) ⬇️
... and 7 more

... and 1517 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@michaeljmarshall
michaeljmarshall merged commit bafecb2 into apache:master Apr 11, 2023
Demogorgon314 pushed a commit to Demogorgon314/pulsar that referenced this pull request Apr 11, 2023
### Motivation

With BK 4.16, we don't need to pass `SafeRunnable` instances to the `OrderedExecutor` anymore. The executor has embedded the logic of checking and logging exceptions.

Removing the SafeRun will avoid extra allocations in critical path and clutter of the code

### 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 -->

### Matching PR in forked repository

PR in forked repository: (merlimat#6)

<!--
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.
-->
@merlimat
merlimat deleted the safe-run branch October 24, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs ready-to-test type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants