[FLINK-40331][cdc-connect][fluss] Support forward shuffle in fluss sink. - #4498
Open
loserwang1024 wants to merge 1 commit into
Open
[FLINK-40331][cdc-connect][fluss] Support forward shuffle in fluss sink.#4498loserwang1024 wants to merge 1 commit into
loserwang1024 wants to merge 1 commit into
Conversation
lvyanquan
reviewed
Aug 25, 2026
| * <p>Implementations that do not depend on the source subtask index can continue implementing | ||
| * {@link #hashcode(Object)} only. | ||
| */ | ||
| default int hashcode(int sourceIndex, T event) { |
Contributor
There was a problem hiding this comment.
Hi @loserwang1024, thanks for the PR! One suggestion on the HashFunction change: instead of a raw int sourceIndex, consider passing a small immutable HashContext object:
@Internal
public class HashContext {
private final int sourceSubtaskIndex;
private final int downstreamParallelism;
public HashContext(int sourceSubtaskIndex, int downstreamParallelism) { ... }
public int getSourceSubtaskIndex() { ... }
public int getDownstreamParallelism() { ... }
}default int hashcode(HashContext context, T event) {
return hashcode(event);
}Reasons:
- Self-documenting call sites —
hashcode(subTaskId, event)gives no hint what the bareintmeans;hashcode(hashContext, event)does. - Extensible without signature churn — future strategies (bucket-aware mapping, fallback when
sourceIndex >= downstreamParallelism) can read from the context instead of stacking moreintoverloads. - Fails fast instead of silently skewing —
ForwardHashFunction.hashcode(event)can throwUnsupportedOperationExceptionrather than returning0and routing everything to subtask 0 if someone calls the single-arg method by mistake.
The context can be created once in open() and reused, so there's no per-record allocation cost. Since HashFunction is @Internal, this is the cheapest time to make the change. WDYT?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What is the purpose of this pull request?
https://issues.apache.org/jira/browse/FLINK-40331
Brief change log
Add sink.partitioning.strategy in fluss sink to support FORWARD.
Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change added tests and can be verified as follows:
...*...*Documentation
Was generative AI tooling used to co-author this PR?