leonardBang commented on code in PR #4638:
URL: https://github.com/apache/flink-cdc/pull/4638#discussion_r4783066214


##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-postgres/src/main/java/org/apache/flink/cdc/connectors/postgres/source/PostgresDataSource.java:
##########
@@ -70,13 +95,25 @@ public EventSourceProvider getEventSourceProvider() {
         boolean includeDatabaseInTableId = 
postgresSourceConfig.isIncludeDatabaseInTableId();
         DebeziumEventDeserializationSchema deserializer =
                 new PostgresEventDeserializer(
-                        DebeziumChangelogMode.ALL,
+                        changelogMode,
                         readableMetadataList,
                         includeDatabaseInTableId,
-                        databaseName);
+                        databaseName,
+                        deleteNonKeyNullAsDefault);
 
         PostgresOffsetFactory postgresOffsetFactory = new 
PostgresOffsetFactory();
         PostgresDialect postgresDialect = new 
PostgresDialect(postgresSourceConfig);
+        Map<TableId, TableChange> tableSchemas =
+                
postgresDialect.discoverDataCollectionSchemas(postgresSourceConfig);
+        try (PostgresConnection jdbc = postgresDialect.openJdbcConnection()) {
+            tableSchemas.forEach(
+                    (tableId, tableChange) ->
+                            PostgresSchemaUtils.validateChangelogMode(

Review Comment:
   Could we make the replica-identity requirement depend on the startup mode? 
With `scan.startup.mode: snapshot`, the default `changelog-mode: all`, and a 
table using `REPLICA IDENTITY DEFAULT`, this unconditional validation now 
rejects the job in `getEventSourceProvider()`, before any snapshot rows are 
read. A snapshot-only source emits INSERT events, so requiring complete before 
images appears unnecessary for that output contract.
   
   I noticed that the documentation explicitly describes this behavior change. 
Is there a snapshot-specific correctness requirement that makes it necessary, 
or could we preserve the previous behavior for snapshot-only jobs? If we allow 
that case, the corresponding checks in metadata/schema lookup and split 
assignment would also need to follow the same rule. It may be helpful to add an 
integration test for a DEFAULT-identity table with `scan.startup.mode: 
snapshot` to cover the compatibility boundary.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to