flink-cdc
flink-cdc copied to clipboard
[FLINK-39765][cdc-pipeline/mysql] Implement lineage (FLIP-314) support for mysql source connectors
Jira ticket: https://issues.apache.org/jira/browse/FLINK-39765
Summary: Adds Flink native lineage support (FLIP-314) for the MySQL CDC source.
Description:
- Implement
LineageVertexProvideron MySqlSource so that OpenLineage events report captured MySQL tables as input datasets with schema metadata. - This improves lineage for wildcard table patterns, including
scan.binlog.newly-added-table.enabledjobs, for tables that already exist when the job is submitted. Tables created after job startup are captured at runtime but will only appear in lineage in the next job submission. - Add shared lineage utilities in flink-cdc-common for reuse by other source connectors
Testing:
- Added tests for the changes done
- Did manual tests to generate lineage events in openlineage format using native flink APIs, full event looks like: https://i.fluffy.cc/Xmw4KBHbx1wVMbcFvVxk7V45bB4MClZ3.html
- Example of how a single mysql table looks like:
{
"namespace": "mysql://localhost:3306",
"name": "testdb.users",
"facets": {
"schema": {
"_producer": "https://github.com/OpenLineage/OpenLineage/tree/1.47.1/integration/flink",
"_schemaURL": "https://openlineage.io/spec/facets/1-2-0/SchemaDatasetFacet.json#/$defs/SchemaDatasetFacet",
"fields": [
{
"name": "id",
"type": "int NOT NULL"
},
{
"name": "name",
"type": "varchar(100)"
},
{
"name": "age",
"type": "int"
},
{
"name": "created_at",
"type": "timestamp"
}
]
},
"symlinks": {
"_producer": "https://github.com/OpenLineage/OpenLineage/tree/1.47.1/integration/flink",
"_schemaURL": "https://openlineage.io/spec/facets/1-0-1/SymlinksDatasetFacet.json#/$defs/SymlinksDatasetFacet",
"identifiers": []
},
"config": {
"_producer": "https://github.com/OpenLineage/OpenLineage/tree/1.47.1/integration/flink",
"_schemaURL": "https://openlineage.io/spec/2-0-2/OpenLineage.json#/$defs/DatasetFacet",
"type": "mysql-cdc"
}
}
}
cc: @lvyanquan can I please have a review on this
@lvyanquan I have resolved comments from co-pilot, feel free to re-run or flag anything that needs more fixing thanks.
@lvyanquan gentle reminder can I please have review on this PR?
@lvyanquan is there anything to be fixed from my side for the failing CI pipelines, if yes can you please guide me?