Skip to content

[FLINK-41660][pipeline-connector/postgres] Register scan.incremental.snapshot.chunk.key-column as an optional option - #4636

Merged
yuxiqian merged 1 commit into
apache:masterfrom
YasuoStudyJava:FLINK-41660-postgres-chunk-key-column
Nov 25, 2026
Merged

yuxiqian merged 1 commit into
apache:masterfrom
YasuoStudyJava:FLINK-41660-postgres-chunk-key-column

Conversation

@YasuoStudyJava

@YasuoStudyJava YasuoStudyJava commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

PostgresDataSourceFactory reads scan.incremental.snapshot.chunk.key-column and forwards it to the underlying Postgres source, but did not register the option in optionalOptions(). FactoryHelper therefore rejected any pipeline configuration that set it:

ValidationException: Unsupported options found for 'postgres'.
Unsupported options:
scan.incremental.snapshot.chunk.key-column

Add the option to optionalOptions(), matching the MySQL and SQLServer pipeline source factories, and cover it with a unit test.

What is the purpose of this pull request?

Fixes FLINK-41660.

PostgresDataSourceFactory reads scan.incremental.snapshot.chunk.key-column and forwards it to the
underlying Postgres source, but the option was never registered in optionalOptions(). As a result,
FactoryHelper rejects any pipeline configuration that sets it:

org.apache.flink.table.api.ValidationException: Unsupported options found for 'postgres'.

Unsupported options:

scan.incremental.snapshot.chunk.key-column

This makes it impossible to configure a chunk key column for tables without a primary key, which is
the main use case of the option. The MySQL and SQLServer pipeline source factories already register
the same option; Postgres did not.

Brief change log

  • PostgresDataSourceFactory#optionalOptions(): register SCAN_INCREMENTAL_SNAPSHOT_CHUNK_KEY_COLUMN.
  • Add PostgresDataSourceFactoryTest#testChunkKeyColumnOption, asserting the option is part of
    optionalOptions() and that its value reaches PostgresSourceConfig#getChunkKeyColumn().

Verifying this change

This change added tests and can be verified as follows:

  • Added unit tests in flink-cdc-pipeline-connector-postgres (PostgresDataSourceFactoryTest)
  • Previously, creating a PostgresDataSource with scan.incremental.snapshot.chunk.key-column set
    failed with the ValidationException above; with the fix the source is created and the configured
    chunk key column is propagated to the source configuration.
  • mvn spotless:apply / spotless:check pass

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable — the option is already documented in
    docs/content/docs/connectors/pipeline-connectors/postgres-cdc.md; this change only makes it usable
Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: CodeMaker (Deepseek Flash)

…snapshot.chunk.key-column as an optional option

PostgresDataSourceFactory reads scan.incremental.snapshot.chunk.key-column and forwards it to the underlying Postgres source, but did not register the option in optionalOptions(). FactoryHelper therefore rejected any pipeline configuration that set it:

  ValidationException: Unsupported options found for 'postgres'.
  Unsupported options:
  scan.incremental.snapshot.chunk.key-column

Add the option to optionalOptions(), matching the MySQL and SQLServer pipeline source factories, and cover it with a unit test.
@YasuoStudyJava
YasuoStudyJava force-pushed the FLINK-41660-postgres-chunk-key-column branch from 1c06f89 to 4a82259 Compare November 25, 2026 08:33

@yuxiqian yuxiqian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, waiting for CI to pass...

@yuxiqian
yuxiqian merged commit d7f6ade into apache:master Nov 25, 2026
39 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants