Skip to content

[INLONG-6160][Sort] Support dynamic partition for KafkaLoadNode#6165

Merged
healchow merged 5 commits intoapache:masterfrom
yunqingmoswu:INLONG-6160
Oct 18, 2022
Merged

[INLONG-6160][Sort] Support dynamic partition for KafkaLoadNode#6165
healchow merged 5 commits intoapache:masterfrom
yunqingmoswu:INLONG-6160

Conversation

@yunqingmoswu
Copy link
Contributor

Prepare a Pull Request

(Change the title refer to the following example)

Title: [INLONG-6160][Sort] Support dynamic partition for KafkaLoadNode

(The following XYZ should be replaced by the actual GitHub Issue number)

Fixes #6160

Motivation

Support dynamic partition for KafkaLoadNode when the format of kafka is raw and the 'key.fields' is not specifyed.
This is mainly for some whole database migration scenarios, we assume that the upstream input data is a mixed schema of whole database migration, we ignore the real schema for now, receive the entire record in a binary raw data format, and fetch and parse its schema and data on the kafka sink side, and according to Some data values ​​are dynamically written to related topic partitions.
Dynamic partition writing has some limitations:
1.The upstream data is raw format with a fixed inner format, only support [canal-json|debezium-json] at now
2.The 'key.fields' is not specifyed
3.It needs to specify 'sink.multiple.partition-pattern' and 'sink.multiple.format' for dynamically extracting partition from data
4.It will extract primary key from raw data as the partition key used hash if the 'sink.multiple.partition-pattern'
equals 'PRIMARY_KEY' else it will parse partition key from raw data.

Modifications

1.Add option of 'sink.multiple.partition-pattern'
2.Add partitioner of 'RawDataHashPartitioner'
3.Add method extractValues and extractPrimaryKeyNames and extractPrimaryKeyValues for the mode of 'DynamicSchemaFormat'

Verifying this change

(Please pick either of the following options)

  • This change is a trivial rework/code cleanup without any test coverage.

  • This change is already covered by existing tests, such as:
    (please describe tests)

  • This change added tests and can be verified as follows:

    (example:)

    • Added integration tests for end-to-end deployment with large payloads (10MB)
    • Extended integration test for recovery after broker failure

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation

@yunqingmoswu yunqingmoswu added this to the 1.4.0 milestone Oct 13, 2022
@healchow healchow merged commit 1b3c5af into apache:master Oct 18, 2022
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.

[Feature][Sort] Support dynamic partition for KafkaLoadNode

5 participants