flink-cdc icon indicating copy to clipboard operation
flink-cdc copied to clipboard

[FLINK-39765][cdc-pipeline/mysql] Implement lineage (FLIP-314) support for mysql source connectors

Open jsinghkukreja opened this issue 6 months ago • 4 comments

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 LineageVertexProvider on 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.enabled jobs, 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"
        }
      }
    }

jsinghkukreja avatar May 26 '26 14:05 jsinghkukreja

cc: @lvyanquan can I please have a review on this

jsinghkukreja avatar May 26 '26 15:05 jsinghkukreja

@lvyanquan I have resolved comments from co-pilot, feel free to re-run or flag anything that needs more fixing thanks.

jsinghkukreja avatar May 28 '26 17:05 jsinghkukreja

@lvyanquan gentle reminder can I please have review on this PR?

jsinghkukreja avatar Jun 11 '26 15:06 jsinghkukreja

@lvyanquan is there anything to be fixed from my side for the failing CI pipelines, if yes can you please guide me?

jsinghkukreja avatar Jun 23 '26 04:06 jsinghkukreja