ericzeng created FLINK-39329:
--------------------------------

             Summary: [MySQL-CDC] Improve error message for tables without 
primary key in incremental snapshot
                 Key: FLINK-39329
                 URL: https://issues.apache.org/jira/browse/FLINK-39329
             Project: Flink
          Issue Type: Improvement
          Components: Flink CDC
    Affects Versions: cdc-3.5.0
            Reporter: ericzeng


*Problem*

  When using incremental snapshot on a MySQL table without a primary key, if 
the user forgets to set scan.incremental.snapshot.chunk.key-column, the thrown 
exception message is:

  To use incremental snapshot, 'scan.incremental.snapshot.chunk.key-column' 
must be set when the table doesn't have primary keys.

  This message does not include the table name, making it difficult for users 
to quickly identify which table is causing the problem — especially in 
multi-table sync scenarios.  

*Root Cause*

ChunkUtils#getChunkKeyColumn throws a ValidationException with a static message 
that lacks table identity information.

*Fix*

  Improve the error message to include the specific table name and rephrase it 
for clarity:

  Table '<table_id>' has no primary key. To use incremental snapshot, please 
set 'scan.incremental.snapshot.chunk.key-column' for this table.
                 
  *Impact*           
  No behavior change; error message only. Improves debuggability for users with 
multiple tables.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to