[Dataflow Streaming] Commit size validation for multi key commits - #39473
[Dataflow Streaming] Commit size validation for multi key commits#39473arunpandianp wants to merge 26 commits into
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
130dafe to
8553e14
Compare
8553e14 to
49db96a
Compare
|
R: @scwhittle |
|
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
| } | ||
|
|
||
| // MultiKeyBatchingDisabled items should not be in keyGroupWorkList | ||
| checkState(!Node.isMultiKeyBatchingDisabled(firstNode.task)); |
There was a problem hiding this comment.
Yes, because the code here is not inside Node. static import fails saying the method is private.
| return; | ||
| } | ||
|
|
||
| // Look at budgetHandle instead of executedWorks because when intermediate work items are |
There was a problem hiding this comment.
Comment was a little unclear at first. Maybe something like the following?
// If this is a multi-key work item, then we need to retry all of the individual work items without merging so that we can identify large commits to truncate. We determine the work items that were part of the bundle by looking at the budgethandle instead of executedWorks because validateCommitRequestSize is called when transitioning and the handle has been updated but executedWorks has not.
| if (elapsedNanos >= multiKeyBundleOptions.maxKeyGroupBatchTimeNanos()) { | ||
| return true; | ||
| } | ||
| return getBytesSinked() >= multiKeyBundleOptions.maxKeyGroupBatchSinkBytes(); |
There was a problem hiding this comment.
bytessinked currently is just the output messages. There is a todo to measure state. I think that we should update the flushing of key state to add in the state bytes so that we can stop merging keys if each key is modifying state and it adds up. Then we will be less likely to need to truncate since the sinkbytes limit is lower than the max limit.
There was a problem hiding this comment.
It is a good idea to stop merging when we hit a limit including state updates. We can accumulate the individual commit size from flushStateInternal and compare that against a threshold. Will send a separate change for that.
We flush key state per key and truncation is only based on individual key commit size, so I'm not sure if counting the state updates will reduce truncations.
There was a problem hiding this comment.
Maybe my terminology was confusing, but I was thinking of the case where each key is flushing to state that we might build up too large a commit to apply. Then we have to retry all of the bundles locally without merging instead of just stopping earlier. If we were counting the state bytes we could just stop before we built up such a large commit and wouldn't have to retry.
| Node(Runnable task) { | ||
| this.task = task; | ||
| if (task instanceof QueuedWork) { | ||
| if (task instanceof QueuedWork && !isMultiKeyBatchingDisabled(task)) { |
There was a problem hiding this comment.
could just be
if (!isMultiKeyBatchingDisabled(task)
| computationState, handle.getWorkBatch(), computationId, systemName, work, t); | ||
| } finally { | ||
| List<Work> processedWorkBatch = workBatch != null ? workBatch : ImmutableList.of(work); | ||
| List<Work> processedWorkBatch = workBatch != null ? workBatch : handle.getWorkBatch(); |
There was a problem hiding this comment.
is it always correct to use the handle batch? should we just use that and possibly remove from ExecuteWorkResult as well?
There was a problem hiding this comment.
good idea, done and removed executedWorks. I added handle.getWorkBatch after adding executedWorks and didn't think about it to replace executedWorks
| .build()); | ||
| } | ||
|
|
||
| Windmill.MultiKeyWorkItemCommitRequest multiKeyCommitRequest = multiKeyBuilder.build(); |
There was a problem hiding this comment.
does this possibly throw and thus is done earlier now? If so add a comment, if not maybe revert.
| if (elapsedNanos >= multiKeyBundleOptions.maxKeyGroupBatchTimeNanos()) { | ||
| return true; | ||
| } | ||
| return getBytesSinked() >= multiKeyBundleOptions.maxKeyGroupBatchSinkBytes(); |
There was a problem hiding this comment.
Maybe my terminology was confusing, but I was thinking of the case where each key is flushing to state that we might build up too large a commit to apply. Then we have to retry all of the bundles locally without merging instead of just stopping earlier. If we were counting the state bytes we could just stop before we built up such a large commit and wouldn't have to retry.
| StreamingDataflowWorker worker = | ||
| makeWorker( | ||
| defaultWorkerParams( | ||
| "--experiments=unstable_enable_multi_key_bundle,windmill_max_key_group_batch_time_ms=5000", |
There was a problem hiding this comment.
larger timeout just so it isn't possibly flaky?
| List<ParallelInstruction> instructions = | ||
| Arrays.asList( | ||
| makeSourceInstruction(kvCoder), | ||
| makeDoFnInstruction(new FixedSizeCommitFn(500), 0, kvCoder), |
There was a problem hiding this comment.
maybe have a dofn that you can see that the work is re-executed?
There was a problem hiding this comment.
done. Updated tests to use a DoFn writing to state instead of using productions. Added a todo to add tests using productions. Need to send a WindmillSink change to flush productions in finishKey.
| Windmill.Uint128Proto keyGroup = | ||
| Windmill.Uint128Proto.newBuilder().setHigh(1).setLow(2).build(); | ||
|
|
||
| Work work1 = |
There was a problem hiding this comment.
I only see one work in this test so it doesn't seem like it is necessarily stopping because the batching is disabled.
There was a problem hiding this comment.
Updated and renamed the test.
There was a problem hiding this comment.
does this need to use the handle works as well? Can we get rid of executedWorks?
There was a problem hiding this comment.
Good idea, removed executedWorks
Please add a meaningful description for your change here
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
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, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.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)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.