-
Notifications
You must be signed in to change notification settings - Fork 1
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
RFC: Add shuffle for iceberg sink #77
base: main
Are you sure you want to change the base?
Conversation
rfcs/0077-iceberg-sink-shuffle.md
Outdated
|
||
There are two possible implementations for this feature: | ||
|
||
1. Add a new `IcebergPartitionOperator`, which calculates the partition value of each record and adds it to the record, then asking the dispatcher executor to do hash shuffle according to the partition value. The plan is like following: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, our common sinks also have such a Shuffle
when the sink's PK doesn't match its stream key. cc. @st1page
This is very similar with this design, the only problem is that previously we didn't distinguish partition key from primary key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also cc. @xiangjinwu @tabVersion
Previously in channel #wg-new-source-ddl
and risingwavelabs/risingwave#9443, we decided to use the sink property primary_key
for both PK and partition key, depending on different connectors, for example,
- Kafka upsert sink will use
primary_key
as partition key & PK - Kafka append-only sink will use
primary_key
as partition key only
While this RFC proposes to introduce 2 different properties: partition_key and primary_key respectively, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, our common sinks also have such a Shuffle when the sink's PK doesn't match its stream key
clarify the condition can lead to the issue: when the partition key does not contain the whole stream key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this RFC proposes to introduce 2 different properties: partition_key and primary_key respectively, right?
In fact, by primary_key
here I mean stream_key
of sink's input. I think for iceberg we don't need user to specify primary_key
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The optimizer must know the downstream's partition requirements. in the past, we were just concerned about correctness issues such as "make sure the order of operations for the specific key" or "no multiple parallelisms modifying the same key, which can bring dead-lock". And in this RFC, if the downstream system has a stronger partition key to achieving better performance, we can use it as the distribution strategy and the correctness issues should be guaranteed by the downstream system.
About if the user needs to specify the primary_key/partition key in the CREATE SINK
statement.
- for kafka/redis, the primary key/partition key has not a table level's catalog or config, user must give it in
CREATE SINK
statement to define the behavior of the RW sink. - for MySQL/JDBC, current behavior is that requiring users to specify the primary_key in the
CREATE SINK
statement. It will be validated in the meta node if the user-specified pk is the same as the JDBC catalog. It is because currently, frontend can not query the JDBC's catalog without java runtime c.c. @StrikeW correct me if I am wrong - and for iceberg in this RFC, I think user do not need to specify any information in the
CREATE SINK
because our fe node can get the information from the downstream system's catalog
There is also probability that cardinality of range only partition be ten thousands. E.g. the partition is |
Yes, that's possible in an extreme case: when we are catching up with history data. |
Rendered