You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by lz...@apache.org on 2025/03/03 04:16:01 UTC

(paimon) branch master updated: [doc] Add mysql cdc synchronization table comment document. (#5173)

This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new c48e3097a2 [doc] Add mysql cdc synchronization table comment document. (#5173)
c48e3097a2 is described below

commit c48e3097a22dfa6fd4dcc4f3f7b94d86a32a2f3a
Author: Kerwin <37...@users.noreply.github.com>
AuthorDate: Mon Mar 3 12:15:57 2025 +0800

    [doc] Add mysql cdc synchronization table comment document. (#5173)
---
 docs/content/cdc-ingestion/mysql-cdc.md                              | 5 ++++-
 .../paimon/flink/action/cdc/mysql/MySqlSyncTableActionITCase.java    | 2 ++
 .../paimon-flink-cdc/src/test/resources/mysql/sync_table_setup.sql   | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/docs/content/cdc-ingestion/mysql-cdc.md b/docs/content/cdc-ingestion/mysql-cdc.md
index 121f58c0ab..1632ef4c81 100644
--- a/docs/content/cdc-ingestion/mysql-cdc.md
+++ b/docs/content/cdc-ingestion/mysql-cdc.md
@@ -265,4 +265,7 @@ to avoid potential name conflict.
 
 1. Chinese characters in records ingested from MySQL are garbled.
 * Try to set `env.java.opts: -Dfile.encoding=UTF-8` in `flink-conf.yaml`(Flink version < 1.19) or `config.yaml`(Flink version >= 1.19)
-(the option is changed to `env.java.opts.all` since Flink-1.17).
\ No newline at end of file
+(the option is changed to `env.java.opts.all` since Flink-1.17).
+
+2. Synchronize MySQL Table comment.
+* Synchronize MySQL create table comment to the paimon table, you need to configure `--mysql_conf jdbc.properties.useInformationSchema=true`.
diff --git a/paimon-flink/paimon-flink-cdc/src/test/java/org/apache/paimon/flink/action/cdc/mysql/MySqlSyncTableActionITCase.java b/paimon-flink/paimon-flink-cdc/src/test/java/org/apache/paimon/flink/action/cdc/mysql/MySqlSyncTableActionITCase.java
index 749d87eb06..ca01cd73e8 100644
--- a/paimon-flink/paimon-flink-cdc/src/test/java/org/apache/paimon/flink/action/cdc/mysql/MySqlSyncTableActionITCase.java
+++ b/paimon-flink/paimon-flink-cdc/src/test/java/org/apache/paimon/flink/action/cdc/mysql/MySqlSyncTableActionITCase.java
@@ -332,6 +332,7 @@ public class MySqlSyncTableActionITCase extends MySqlActionITCaseBase {
         mySqlConfig.put("database-name", DATABASE_NAME);
         mySqlConfig.put("table-name", "schema_evolution_comment");
         mySqlConfig.put("debezium.include.schema.comments", "true");
+        mySqlConfig.put("jdbc.properties.useInformationSchema", "true");
 
         MySqlSyncTableAction action =
                 syncTableActionBuilder(mySqlConfig)
@@ -350,6 +351,7 @@ public class MySqlSyncTableActionITCase extends MySqlActionITCaseBase {
 
     private void testSchemaEvolutionWithCommentImpl(Statement statement) throws Exception {
         FileStoreTable table = getFileStoreTable();
+        assertThat(table.comment()).hasValue("schema_evolution_comment");
         statement.executeUpdate("USE " + DATABASE_NAME);
         statement.executeUpdate("INSERT INTO schema_evolution_comment VALUES (1, 'one')");
 
diff --git a/paimon-flink/paimon-flink-cdc/src/test/resources/mysql/sync_table_setup.sql b/paimon-flink/paimon-flink-cdc/src/test/resources/mysql/sync_table_setup.sql
index 10a0f20d45..f7c4dd9845 100644
--- a/paimon-flink/paimon-flink-cdc/src/test/resources/mysql/sync_table_setup.sql
+++ b/paimon-flink/paimon-flink-cdc/src/test/resources/mysql/sync_table_setup.sql
@@ -57,7 +57,7 @@ CREATE TABLE schema_evolution_comment (
     _id INT comment 'primary',
     v1 VARCHAR(10) comment 'v1',
     PRIMARY KEY (_id)
-);
+) COMMENT 'schema_evolution_comment';
 
 -- ################################################################################
 --  testAllTypes