Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UnboundedReaderMaxReadTimeMs to DataflowPipelineDebugOptions, deprecate UnboundedReaderMaxReadTimeSec #31091

Merged
merged 5 commits into from
Apr 26, 2024

Conversation

stankiewicz
Copy link
Contributor

UnboundedReader is controlled with UnboundedReaderMaxReadTimeSec and UnboundedReaderMaxElements.
For sub second latency user has to set UnboundedReaderMaxElements to 1 which is not flexible as there may be multiple situation where there are more elements.

In this change UnboundedReaderMaxReadTimeSec becomes deprecated.
UnboundedReaderMaxReadTimeMs is introduced.
Change is backward compatible - it takes into account both values - If UnboundedReaderMaxReadTimeSec is non default it will take overwrite UnboundedReaderMaxReadTimeMs.

@stankiewicz
Copy link
Contributor Author

related to #31082

Copy link
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

@stankiewicz
Copy link
Contributor Author

Run Java Unit Tests

@stankiewicz
Copy link
Contributor Author

stankiewicz commented Apr 24, 2024

R: @jrmccluskey Jack, would you be able to take a look at this or suggest reviewer?

Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

* The max amount of time an UnboundedReader is consumed before checkpointing.
*
* @deprecated use {@link DataflowPipelineDebugOptions#getUnboundedReaderMaxReadTimeMs()} instead
*/
@Description(
"The max amount of time before an UnboundedReader is consumed before checkpointing, in seconds.")
@Default.Integer(10)
Copy link
Contributor

Choose a reason for hiding this comment

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

can the default be removed here? I think it will be less brittle since the default won't be repeated in the WorkerCustomSources

if (maxReadTimeMsDeprecated != null and maxReadTimeMsDeprecated > 0) {
// use it. Seems fine just pick if both were set.
} else {
use new option, either the default or explicitly set
}

or another option could be to use a DefaultFactory (see StagerFactory in this file) so that the default of the new field is to be 1000 * getUnboundedReaderMaxReadTimeSec

Then the code could just use getUnboundedReaderMaxReadTimeMs() and it would either default to fallback to previous value (set or default) or prefer the new value if it was set.

@stankiewicz stankiewicz requested a review from scwhittle April 26, 2024 11:11
* Sets Integer value based on old, deprecated field ({@link
* DataflowPipelineDebugOptions#getUnboundedReaderMaxReadTimeSec()}) is set.
*/
class UnboundedReaderMaxReadTimeFactory implements DefaultValueFactory<Integer> {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be static final class?


/**
* Sets Integer value based on old, deprecated field ({@link
* DataflowPipelineDebugOptions#getUnboundedReaderMaxReadTimeSec()}) is set.
Copy link
Contributor

Choose a reason for hiding this comment

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

rm "is set"

@stankiewicz stankiewicz requested a review from scwhittle April 26, 2024 12:44
@scwhittle scwhittle merged commit 15f7f02 into apache:master Apr 26, 2024
17 checks passed
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.

2 participants