[ 
https://issues.apache.org/jira/browse/FLINK-41660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated FLINK-41660:
-----------------------------------
    Labels: pull-request-available  (was: )

> PostgresDataSourceFactory fails with ValidationException when 
> scan.incremental.snapshot.chunk.key-column is configured because it is 
> missing from optionalOptions()
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-41660
>                 URL: https://issues.apache.org/jira/browse/FLINK-41660
>             Project: Flink
>          Issue Type: Bug
>          Components: Flink CDC
>    Affects Versions: cdc-3.6.0, cdc-3.7.0
>            Reporter: Xin Chen
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: cdc-3.7.0
>
>
> {\{PostgresDataSourceFactory}} already defines, reads, and passes 
> \{{scan.incremental.snapshot.chunk.key-column}} to the underlying Postgres 
> source configuration, but omits it from \{{optionalOptions()}}, causing 
> pipeline jobs to fail during factory validation.
> In \{{PostgresDataSourceOptions}}, the option is defined as:
> {code:java}
> public static final ConfigOption<String> 
> SCAN_INCREMENTAL_SNAPSHOT_CHUNK_KEY_COLUMN =
>         ConfigOptions.key("scan.incremental.snapshot.chunk.key-column")
>                 .stringType()
>                 .noDefaultValue()
>                 ...
> {code}
> In \{{PostgresDataSourceFactory#createDataSource}}, it is already read and 
> passed to \{{configFactory}}:
> {code:java}
> String chunkKeyColumn = 
> config.get(SCAN_INCREMENTAL_SNAPSHOT_CHUNK_KEY_COLUMN);
> ...
>         .chunkKeyColumn(chunkKeyColumn)
> {code}
> However, \{{PostgresDataSourceFactory#optionalOptions()}} does not register 
> \{{SCAN_INCREMENTAL_SNAPSHOT_CHUNK_KEY_COLUMN}}. When \{{FactoryHelper}} 
> validates the configuration, any pipeline YAML specifying 
> \{{scan.incremental.snapshot.chunk.key-column}} (such as tables without 
> primary keys) fails with:
> {code}
> org.apache.flink.table.api.ValidationException: Unsupported options found for 
> 'postgres'.
> Unsupported options:
> scan.incremental.snapshot.chunk.key-column
> {code}
> This makes configurations such as the following ineffective:
> {code:yaml}
> source:
>   type: postgres
>   ...
>   scan.incremental.snapshot.chunk.key-column: id
> {code}
> Adding \{{options.add(SCAN_INCREMENTAL_SNAPSHOT_CHUNK_KEY_COLUMN);}} to 
> \{{PostgresDataSourceFactory#optionalOptions()}} resolves the issue.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to