Ensure a sequential write to DM by always using a single output #898
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We want to go slow to go fast with data modeling, and never write with more than one partition at a time. This change ensures this by repartitioning down to 1 partition before emitting the result.
Since we almost always have 200 partitions going into the write, we would always clamp this down to the ideal, which was set to 1. But, if we actually had less than 50 partitions going into this, it would not be repartitioned and we would actually try to write to DMS with 50 parallel writes (potentially).
I first didn't find any way to trigger this, but I think I can trigger it by reading directly from time series, sequences etc., which have 50 or smaller as default partitions.
This is very hard to verify in production, but there should be no clear downside to ensuring this.