Skip to content

Commit c48e309

Browse files
authored
[doc] Add mysql cdc synchronization table comment document. (#5173)
1 parent ef5ed00 commit c48e309

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

docs/content/cdc-ingestion/mysql-cdc.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,7 @@ to avoid potential name conflict.
265265
266266
1. Chinese characters in records ingested from MySQL are garbled.
267267
* 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)
268-
(the option is changed to `env.java.opts.all` since Flink-1.17).
268+
(the option is changed to `env.java.opts.all` since Flink-1.17).
269+
270+
2. Synchronize MySQL Table comment.
271+
* Synchronize MySQL create table comment to the paimon table, you need to configure `--mysql_conf jdbc.properties.useInformationSchema=true`.

paimon-flink/paimon-flink-cdc/src/test/java/org/apache/paimon/flink/action/cdc/mysql/MySqlSyncTableActionITCase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ public void testSchemaEvolutionWithComment() throws Exception {
332332
mySqlConfig.put("database-name", DATABASE_NAME);
333333
mySqlConfig.put("table-name", "schema_evolution_comment");
334334
mySqlConfig.put("debezium.include.schema.comments", "true");
335+
mySqlConfig.put("jdbc.properties.useInformationSchema", "true");
335336

336337
MySqlSyncTableAction action =
337338
syncTableActionBuilder(mySqlConfig)
@@ -350,6 +351,7 @@ public void testSchemaEvolutionWithComment() throws Exception {
350351

351352
private void testSchemaEvolutionWithCommentImpl(Statement statement) throws Exception {
352353
FileStoreTable table = getFileStoreTable();
354+
assertThat(table.comment()).hasValue("schema_evolution_comment");
353355
statement.executeUpdate("USE " + DATABASE_NAME);
354356
statement.executeUpdate("INSERT INTO schema_evolution_comment VALUES (1, 'one')");
355357

paimon-flink/paimon-flink-cdc/src/test/resources/mysql/sync_table_setup.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ CREATE TABLE schema_evolution_comment (
5757
_id INT comment 'primary',
5858
v1 VARCHAR(10) comment 'v1',
5959
PRIMARY KEY (_id)
60-
);
60+
) COMMENT 'schema_evolution_comment';
6161

6262
-- ################################################################################
6363
-- testAllTypes

0 commit comments

Comments
 (0)