Conversation
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?
Add a DB2 pipeline connector so the YAML Pipeline API supports IBM DB2 as a source, in the same way the existing MySQL / Postgres / Oracle / SQL Server pipeline connectors do. Before this change DB2 was only reachable from the DataStream / SQL APIs via
flink-connector-db2-cdc.JIRA: FLINK-40508
Brief change log
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-db2, registered in the pipeline-connectorspom.xml.Db2DataSourceFactory(identifierdb2) plusDb2DataSource,Db2PipelineSource,Db2EventDeserializer,Db2MetadataAccessor,Db2PipelineRecordEmitter,Db2SchemaDataTypeInference,Db2SchemaUtilsandDb2TypeUtils.Db2DataSourceOptionsexposes the options the DB2 source connector already supports:hostname,port,username,password,database,tables,tables.exclude,server-time-zone,scan.startup.mode(initial/latest-offset),schema-change.enabled,metadata.list,scan.incremental.snapshot.chunk.key-column,scan.incremental.snapshot.chunk.size,chunk-meta.group.size,chunk-key.even-distribution.factor.upper-bound,chunk-key.even-distribution.factor.lower-bound,scan.snapshot.fetch.size,connect.timeout,connection.pool.size,connect.max-retries,scan.incremental.snapshot.backfill.skip,scan.incremental.close-idle-reader.enabledandscan.incremental.snapshot.unbounded-chunk-first.enabled.flink-connector-db2-cdc.DECFLOAT(16)→DOUBLE,DECFLOAT(34)→DECIMAL(34, 0),XML/SQLXML/CLOB→STRING,BLOB/BINARY/VARBINARY→BYTES.schemaName.tableName, andlatest-offsetmaps toStartupOptions.latest()withinitialas the default..github/workflows/modules.py: the new module is added toMODULES_DB2, so CI compiles and tests it on both Flink 1.20 and Flink 2.x..github/labeler.yml: adds adb2-pipeline-connectorrule.docs/contentanddocs/content.zh, including a row in each pipeline-connectorsoverview.md.One thing worth pointing out:
src/test/resources/db2_server/is a byte-identical copy of the source connector's test resources. That is not accidental —Db2TestBase#getFilePathresolves the Docker build context withPaths.get(url.toURI()), which cannot read a resource out of thetest-jar, so the files have to exist on the module's own test classpath as real files. The added.gitattributeskeeps these container scripts at LF endings, which matters for contributors on Windows.Verifying this change
This change added tests and can be verified as follows:
Db2TypeUtilsTestcover every supported DB2 column type plus the unsupported-type failure path.Db2DataSourceFactoryITCaseandDb2PipelineITCaserun against a real DB2 instance through testcontainers, reusingDb2TestBasefrom the source connector's test-jar.mvn teston Java 11 / Flink 1.20, and on CI in theSource Unit Tests / test (…, db2, mongodb)andSource Unit Tests 2.x / test (…, 2.2.0, db2, mongodb)jobs, which runmvn verifyand therefore execute the ITCases against both Flink 1.20.3 and Flink 2.2.0.Documentation
docs/content/docs/connectors/pipeline-connectors/db2.mdand its Chinese counterpart.Was generative AI tooling used to co-author this PR?