You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "yzeng1618 (via GitHub)" <gi...@apache.org> on 2025/05/24 08:04:04 UTC

[PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

yzeng1618 opened a new pull request, #4027:
URL: https://github.com/apache/flink-cdc/pull/4027

   https://issues.apache.org/jira/browse/FLINK-34864  
   Previously, in the scenario of multi-table synchronization such as from MySQL to Doris, if some tables had no primary keys, it would directly result in an error, which affected the synchronization of other tables. Therefore, relevant development work was carried out. Incidentally, I found that this issue had already been recorded on Jira. As a result, I added unit tests and other content and submitted this pull request (PR). The specific usage is to set the ignoreNoPrimaryKeyTable parameter to "true" in the pipeline of the YAML file, and then this function can be achieved.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "lvyanquan (via GitHub)" <gi...@apache.org>.
lvyanquan commented on code in PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#discussion_r2108253977


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/config/MySqlSourceOptions.java:
##########
@@ -293,4 +293,15 @@ public class MySqlSourceOptions {
                     .defaultValue(false)
                     .withDescription(
                             "Whether to assign the unbounded chunks first during snapshot reading phase. This might help reduce the risk of the TaskManager experiencing an out-of-memory (OOM) error when taking a snapshot of the largest unbounded chunk. Defaults to false.");
+
+    @Experimental
+    public static final ConfigOption<Boolean> IGNORE_NO_PRIMARY_KEY_TABLE =
+            ConfigOptions.key("ignore-no-primary-key-table")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Whether to ignore tables without primary key. When enabled, the connector will skip tables "
+                                    + "that don't have a primary key. By default these tables will be processed, but for some "
+                                    + "scenarios it may be desirable to ignore them since tables without primary keys "
+                                    + "might cause performance issues during incremental snapshot.");

Review Comment:
   What would happen if we met the records of these tables in incremental reading phase?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "lvyanquan (via GitHub)" <gi...@apache.org>.
lvyanquan commented on code in PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#discussion_r2108253977


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/config/MySqlSourceOptions.java:
##########
@@ -293,4 +293,15 @@ public class MySqlSourceOptions {
                     .defaultValue(false)
                     .withDescription(
                             "Whether to assign the unbounded chunks first during snapshot reading phase. This might help reduce the risk of the TaskManager experiencing an out-of-memory (OOM) error when taking a snapshot of the largest unbounded chunk. Defaults to false.");
+
+    @Experimental
+    public static final ConfigOption<Boolean> IGNORE_NO_PRIMARY_KEY_TABLE =
+            ConfigOptions.key("ignore-no-primary-key-table")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Whether to ignore tables without primary key. When enabled, the connector will skip tables "
+                                    + "that don't have a primary key. By default these tables will be processed, but for some "
+                                    + "scenarios it may be desirable to ignore them since tables without primary keys "
+                                    + "might cause performance issues during incremental snapshot.");

Review Comment:
   What would happen if we met the record of these tables in incremental reading phase?



##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/debezium/reader/BinlogSplitReader.java:
##########
@@ -267,7 +267,8 @@ private boolean shouldEmit(SourceRecord sourceRecord) {
                         ChunkUtils.getChunkKeyColumnType(
                                 statefulTaskContext.getDatabaseSchema().tableFor(tableId),
                                 statefulTaskContext.getSourceConfig().getChunkKeyColumns(),
-                                statefulTaskContext.getSourceConfig().isTreatTinyInt1AsBoolean());
+                                statefulTaskContext.getSourceConfig().isTreatTinyInt1AsBoolean(),
+                                statefulTaskContext.getSourceConfig());

Review Comment:
   Passing statefulTaskContext.getSourceConfig().isIgnoreNoPrimaryKeyTable() is more accurate.



##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-mysql/src/main/java/org/apache/flink/cdc/connectors/mysql/source/MySqlDataSourceOptions.java:
##########
@@ -330,4 +330,11 @@ public class MySqlDataSourceOptions {
                     .defaultValue(false)
                     .withDescription(
                             "Whether to skip backfill in snapshot reading phase. If backfill is skipped, changes on captured tables during snapshot phase will be consumed later in change log reading phase instead of being merged into the snapshot.WARNING: Skipping backfill might lead to data inconsistency because some change log events happened within the snapshot phase might be replayed (only at-least-once semantic is promised). For example updating an already updated value in snapshot, or deleting an already deleted entry in snapshot. These replayed change log events should be handled specially.");
+
+    @Experimental
+    public static final ConfigOption<Boolean> IGNORE_NO_PRIMARY_KEY_TABLE =
+            ConfigOptions.key("ignore-no-primary-key-table")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription("Whether to ignore tables without primary key in MySQL.");

Review Comment:
   Please keep in consistence with MySqlSourceOptions.



##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/test/java/org/apache/flink/cdc/connectors/mysql/source/assigners/MySqlChunkSplitterTest.java:
##########
@@ -85,4 +93,53 @@ void testSplitEvenlySizedChunksNormal() {
                         ChunkRange.of(2147483637, 2147483647),
                         ChunkRange.of(2147483647, null));
     }
+
+    @Test
+    void testIgnoreNoPrimaryKeyTable() throws Exception {
+        // 创建配置,设置ignoreNoPrimaryKeyTable为true
+        MySqlSourceConfig sourceConfig =
+                new MySqlSourceConfigFactory()
+                        .startupOptions(StartupOptions.initial())
+                        .databaseList("test_db")
+                        .tableList("test_db.test_table")
+                        .hostname("localhost")
+                        .username("test")
+                        .password("test")
+                        .serverTimeZone(ZoneId.of("UTC").toString())
+                        .ignoreNoPrimaryKeyTable(true)
+                        .createConfig(0);
+
+        // 创建一个简单的MySqlSchema实现
+        MySqlSchema schema =
+                new MySqlSchema(sourceConfig, true) {
+                    @Override
+                    public TableChanges.TableChange getTableSchema(
+                            MySqlPartition partition, JdbcConnection jdbc, TableId tableId) {
+                        // 创建一个没有主键的表
+                        Table noPkTable =
+                                Table.editor()
+                                        .tableId(tableId)
+                                        .addColumn(
+                                                Column.editor()
+                                                        .name("id")
+                                                        .type("BIGINT")
+                                                        .jdbcType(-5)
+                                                        .optional(false)
+                                                        .create())
+                                        .create();
+                        return new TableChanges.TableChange(
+                                TableChanges.TableChangeType.CREATE, noPkTable);
+                    }
+                };
+
+        MySqlChunkSplitter splitter = new MySqlChunkSplitter(schema, sourceConfig);
+        MySqlPartition partition = new MySqlPartition("mysql_binlog_source");
+
+        // 测试无主键表

Review Comment:
   Avoid using language other than English.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "lvyanquan (via GitHub)" <gi...@apache.org>.
lvyanquan commented on code in PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#discussion_r2108352901


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/assigners/MySqlChunkSplitter.java:
##########
@@ -133,6 +137,10 @@ public List<MySqlSnapshotSplit> splitChunks(MySqlPartition partition, TableId ta
                     "Can not split a new table before the previous table splitting finish.");
             if (currentSplittingTable == null) {
                 analyzeTable(partition, currentSplittingTableId);
+                // Skip tables without primary key
+                if (splitColumn == null && sourceConfig.isIgnoreNoPrimaryKeyTable()) {
+                    return Collections.emptyList();

Review Comment:
   Please logger out that  this table was ignored.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #4027: [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization
URL: https://github.com/apache/flink-cdc/pull/4027


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "lvyanquan (via GitHub)" <gi...@apache.org>.
lvyanquan commented on code in PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#discussion_r2113774103


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/config/MySqlSourceOptions.java:
##########
@@ -293,4 +293,15 @@ public class MySqlSourceOptions {
                     .defaultValue(false)
                     .withDescription(
                             "Whether to assign the unbounded chunks first during snapshot reading phase. This might help reduce the risk of the TaskManager experiencing an out-of-memory (OOM) error when taking a snapshot of the largest unbounded chunk. Defaults to false.");
+
+    @Experimental
+    public static final ConfigOption<Boolean> IGNORE_NO_PRIMARY_KEY_TABLE =
+            ConfigOptions.key("ignore-no-primary-key-table")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Whether to ignore tables without primary key. When enabled, the connector will skip tables "
+                                    + "that don't have a primary key. By default these tables will be processed, but for some "
+                                    + "scenarios it may be desirable to ignore them since tables without primary keys "
+                                    + "might cause performance issues during incremental snapshot.");

Review Comment:
   Can you add an IT case test to verify it during snapshot and incremental reading phases?



##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/config/MySqlSourceOptions.java:
##########
@@ -293,4 +293,15 @@ public class MySqlSourceOptions {
                     .defaultValue(false)
                     .withDescription(
                             "Whether to assign the unbounded chunks first during snapshot reading phase. This might help reduce the risk of the TaskManager experiencing an out-of-memory (OOM) error when taking a snapshot of the largest unbounded chunk. Defaults to false.");
+
+    @Experimental
+    public static final ConfigOption<Boolean> IGNORE_NO_PRIMARY_KEY_TABLE =
+            ConfigOptions.key("ignore-no-primary-key-table")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Whether to ignore tables without primary key. When enabled, the connector will skip tables "
+                                    + "that don't have a primary key. By default these tables will be processed, but for some "
+                                    + "scenarios it may be desirable to ignore them since tables without primary keys "
+                                    + "might cause performance issues during incremental snapshot.");

Review Comment:
   Can you add an ITCase test to verify it during snapshot and incremental reading phases?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on code in PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#discussion_r2122512367


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/config/MySqlSourceOptions.java:
##########
@@ -293,4 +293,15 @@ public class MySqlSourceOptions {
                     .defaultValue(false)
                     .withDescription(
                             "Whether to assign the unbounded chunks first during snapshot reading phase. This might help reduce the risk of the TaskManager experiencing an out-of-memory (OOM) error when taking a snapshot of the largest unbounded chunk. Defaults to false.");
+
+    @Experimental
+    public static final ConfigOption<Boolean> IGNORE_NO_PRIMARY_KEY_TABLE =
+            ConfigOptions.key("ignore-no-primary-key-table")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Whether to ignore tables without primary key. When enabled, the connector will skip tables "
+                                    + "that don't have a primary key. By default these tables will be processed, but for some "
+                                    + "scenarios it may be desirable to ignore them since tables without primary keys "
+                                    + "might cause performance issues during incremental snapshot.");

Review Comment:
   The code logic content has been newly added and verified through testing.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#issuecomment-3957868389

   @lvyanquan Please take a look when you have time.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#issuecomment-5418704664

   This pull request has been closed because it has not had recent activity. You could reopen it if you try to continue your work, and anyone who are interested in it are encouraged to continue work on this pull request.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "lvyanquan (via GitHub)" <gi...@apache.org>.
lvyanquan commented on code in PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#discussion_r2108253977


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/config/MySqlSourceOptions.java:
##########
@@ -293,4 +293,15 @@ public class MySqlSourceOptions {
                     .defaultValue(false)
                     .withDescription(
                             "Whether to assign the unbounded chunks first during snapshot reading phase. This might help reduce the risk of the TaskManager experiencing an out-of-memory (OOM) error when taking a snapshot of the largest unbounded chunk. Defaults to false.");
+
+    @Experimental
+    public static final ConfigOption<Boolean> IGNORE_NO_PRIMARY_KEY_TABLE =
+            ConfigOptions.key("ignore-no-primary-key-table")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Whether to ignore tables without primary key. When enabled, the connector will skip tables "
+                                    + "that don't have a primary key. By default these tables will be processed, but for some "
+                                    + "scenarios it may be desirable to ignore them since tables without primary keys "
+                                    + "might cause performance issues during incremental snapshot.");

Review Comment:
   What would happen if we met the records of these tables in incremental reading phase? Skip it or emit it?
   



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on code in PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#discussion_r2110781071


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/test/java/org/apache/flink/cdc/connectors/mysql/source/assigners/MySqlChunkSplitterTest.java:
##########
@@ -85,4 +93,53 @@ void testSplitEvenlySizedChunksNormal() {
                         ChunkRange.of(2147483637, 2147483647),
                         ChunkRange.of(2147483647, null));
     }
+
+    @Test
+    void testIgnoreNoPrimaryKeyTable() throws Exception {
+        // 创建配置,设置ignoreNoPrimaryKeyTable为true
+        MySqlSourceConfig sourceConfig =
+                new MySqlSourceConfigFactory()
+                        .startupOptions(StartupOptions.initial())
+                        .databaseList("test_db")
+                        .tableList("test_db.test_table")
+                        .hostname("localhost")
+                        .username("test")
+                        .password("test")
+                        .serverTimeZone(ZoneId.of("UTC").toString())
+                        .ignoreNoPrimaryKeyTable(true)
+                        .createConfig(0);
+
+        // 创建一个简单的MySqlSchema实现
+        MySqlSchema schema =
+                new MySqlSchema(sourceConfig, true) {
+                    @Override
+                    public TableChanges.TableChange getTableSchema(
+                            MySqlPartition partition, JdbcConnection jdbc, TableId tableId) {
+                        // 创建一个没有主键的表
+                        Table noPkTable =
+                                Table.editor()
+                                        .tableId(tableId)
+                                        .addColumn(
+                                                Column.editor()
+                                                        .name("id")
+                                                        .type("BIGINT")
+                                                        .jdbcType(-5)
+                                                        .optional(false)
+                                                        .create())
+                                        .create();
+                        return new TableChanges.TableChange(
+                                TableChanges.TableChangeType.CREATE, noPkTable);
+                    }
+                };
+
+        MySqlChunkSplitter splitter = new MySqlChunkSplitter(schema, sourceConfig);
+        MySqlPartition partition = new MySqlPartition("mysql_binlog_source");
+
+        // 测试无主键表

Review Comment:
   It has been fixed.



##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/debezium/reader/BinlogSplitReader.java:
##########
@@ -267,7 +267,8 @@ private boolean shouldEmit(SourceRecord sourceRecord) {
                         ChunkUtils.getChunkKeyColumnType(
                                 statefulTaskContext.getDatabaseSchema().tableFor(tableId),
                                 statefulTaskContext.getSourceConfig().getChunkKeyColumns(),
-                                statefulTaskContext.getSourceConfig().isTreatTinyInt1AsBoolean());
+                                statefulTaskContext.getSourceConfig().isTreatTinyInt1AsBoolean(),
+                                statefulTaskContext.getSourceConfig());

Review Comment:
   It has been fixed.



##########
flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-mysql/src/main/java/org/apache/flink/cdc/connectors/mysql/source/MySqlDataSourceOptions.java:
##########
@@ -330,4 +330,11 @@ public class MySqlDataSourceOptions {
                     .defaultValue(false)
                     .withDescription(
                             "Whether to skip backfill in snapshot reading phase. If backfill is skipped, changes on captured tables during snapshot phase will be consumed later in change log reading phase instead of being merged into the snapshot.WARNING: Skipping backfill might lead to data inconsistency because some change log events happened within the snapshot phase might be replayed (only at-least-once semantic is promised). For example updating an already updated value in snapshot, or deleting an already deleted entry in snapshot. These replayed change log events should be handled specially.");
+
+    @Experimental
+    public static final ConfigOption<Boolean> IGNORE_NO_PRIMARY_KEY_TABLE =
+            ConfigOptions.key("ignore-no-primary-key-table")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription("Whether to ignore tables without primary key in MySQL.");

Review Comment:
   It has been fixed.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#issuecomment-3173197257

   @lvyanquan Could you please let me know when you can take a look at this PR and merge it?


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on code in PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#discussion_r2110666798


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/config/MySqlSourceOptions.java:
##########
@@ -293,4 +293,15 @@ public class MySqlSourceOptions {
                     .defaultValue(false)
                     .withDescription(
                             "Whether to assign the unbounded chunks first during snapshot reading phase. This might help reduce the risk of the TaskManager experiencing an out-of-memory (OOM) error when taking a snapshot of the largest unbounded chunk. Defaults to false.");
+
+    @Experimental
+    public static final ConfigOption<Boolean> IGNORE_NO_PRIMARY_KEY_TABLE =
+            ConfigOptions.key("ignore-no-primary-key-table")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Whether to ignore tables without primary key. When enabled, the connector will skip tables "
+                                    + "that don't have a primary key. By default these tables will be processed, but for some "
+                                    + "scenarios it may be desirable to ignore them since tables without primary keys "
+                                    + "might cause performance issues during incremental snapshot.");

Review Comment:
   we will skip them



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "yzeng1618 (via GitHub)" <gi...@apache.org>.
yzeng1618 commented on code in PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#discussion_r2110781504


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/main/java/org/apache/flink/cdc/connectors/mysql/source/assigners/MySqlChunkSplitter.java:
##########
@@ -133,6 +137,10 @@ public List<MySqlSnapshotSplit> splitChunks(MySqlPartition partition, TableId ta
                     "Can not split a new table before the previous table splitting finish.");
             if (currentSplittingTable == null) {
                 analyzeTable(partition, currentSplittingTableId);
+                // Skip tables without primary key
+                if (splitColumn == null && sourceConfig.isIgnoreNoPrimaryKeyTable()) {
+                    return Collections.emptyList();

Review Comment:
   It has been added.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34864][cdc-connector-mysql] Add the IgnoreNoPrimaryKeyTable parameter to skip tables without primary keys in multi-table synchronization [flink-cdc]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4027:
URL: https://github.com/apache/flink-cdc/pull/4027#issuecomment-4805355181

   This pull request has been automatically marked as stale because it has not had recent activity for 120 days. It will be closed in 60 days if no further activity occurs.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org