Skip to content

[GrowableOffsetRangeTracker] Use UnsignedLong instead of BigDecimal to calculate progress#35561

Merged
kennknowles merged 1 commit intoapache:masterfrom
sjvanrossum:growable-offset-range-tracker-big-decimal-refactor
Sep 9, 2025
Merged

[GrowableOffsetRangeTracker] Use UnsignedLong instead of BigDecimal to calculate progress#35561
kennknowles merged 1 commit intoapache:masterfrom
sjvanrossum:growable-offset-range-tracker-big-decimal-refactor

Conversation

@sjvanrossum
Copy link
Copy Markdown
Contributor

Use unsigned integer math to calculate differences between range start, consumed and estimated end positions. The difference between two values does not exceed the maximum value of unsigned longs so BigDecimal isn't strictly necessary here. For high volume consumption in KafkaIO this reduces CPU time spent in RestrictionTracker.getProgress by ~30x.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

…eTracker since the difference between two offsets does not exceed the maximum value of the unsigned representation.
@github-actions github-actions bot added the java label Jul 10, 2025
@sjvanrossum sjvanrossum changed the title Use unsigned integer math to calculate differences between range start, consumed and estimated end positions. The difference between two values does not exceed the maximum value of unsigned longs so BigDecimal isn't strictly necessary here. For high volume consumption in KafkaIO this reduces CPU time spent in RestrictionTracker.getProgress by ~30x. [GrowableOffsetRangeTracker] Use UnsignedLong instead of BigDecimal to calculate progress Jul 10, 2025
@github-actions
Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@sjvanrossum
Copy link
Copy Markdown
Contributor Author

assign set of reviewers

@github-actions
Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @kennknowles for label java.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@github-actions
Copy link
Copy Markdown
Contributor

Reminder, please take a look at this pr: @kennknowles

@kennknowles
Copy link
Copy Markdown
Member

I'm going to kick the tests a few times, but if the failures are real can you take a look?

@damccorm
Copy link
Copy Markdown
Contributor

next action author

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 2, 2025

Reminder, please take a look at this pr: @kennknowles

@sjvanrossum
Copy link
Copy Markdown
Contributor Author

Run Java_IOs_Direct PreCommit

@derrickaw
Copy link
Copy Markdown
Collaborator

Hi @kennknowles, can you review when you get a chance? Thanks!

@github-actions
Copy link
Copy Markdown
Contributor

Reminder, please take a look at this pr: @kennknowles

@github-actions
Copy link
Copy Markdown
Contributor

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @robertwb for label java.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

Copy link
Copy Markdown
Contributor Author

@sjvanrossum sjvanrossum left a comment

Choose a reason for hiding this comment

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

@kennknowles tests are passing (flakes).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 9, 2025

Reminder, please take a look at this pr: @robertwb

@kennknowles kennknowles merged commit 48b453a into apache:master Sep 9, 2025
22 of 25 checks passed
@sjvanrossum sjvanrossum deleted the growable-offset-range-tracker-big-decimal-refactor branch September 10, 2025 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants