From fcb4cd8f6c917d68fd1f6b689b6640bac1c31aa9 Mon Sep 17 00:00:00 2001 From: Kunni Date: Mon, 22 Jul 2024 12:25:41 +0800 Subject: [PATCH] [FLINK-35871][doc] Add missed "snapshot" mode to mysql connector startup options This closes #3484. --- docs/content.zh/docs/connectors/flink-sources/mysql-cdc.md | 4 +++- docs/content.zh/docs/connectors/pipeline-connectors/mysql.md | 4 +++- docs/content/docs/connectors/flink-sources/mysql-cdc.md | 5 ++++- docs/content/docs/connectors/pipeline-connectors/mysql.md | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/content.zh/docs/connectors/flink-sources/mysql-cdc.md b/docs/content.zh/docs/connectors/flink-sources/mysql-cdc.md index 7f400af238..1d81555de0 100644 --- a/docs/content.zh/docs/connectors/flink-sources/mysql-cdc.md +++ b/docs/content.zh/docs/connectors/flink-sources/mysql-cdc.md @@ -261,7 +261,7 @@ Flink SQL> SELECT * FROM orders; initial String MySQL CDC 消费者可选的启动模式, - 合法的模式为 "initial","earliest-offset","latest-offset","specific-offset" 和 "timestamp"。 + 合法的模式为 "initial","earliest-offset","latest-offset","specific-offset","timestamp" 和 "snapshot"。 请查阅 启动模式 章节了解更多详细信息。 @@ -629,6 +629,7 @@ MySQLSource.builder() .startupOptions(StartupOptions.specificOffset("mysql-bin.000003", 4L) // 从指定 binlog 文件名和位置启动 .startupOptions(StartupOptions.specificOffset("24DA167-0C0C-11E8-8442-00059A3C7B00:1-19")) // 从 GTID 集合启动 .startupOptions(StartupOptions.timestamp(1667232000000L) // 从时间戳启动 + .startupOptions(StartupOptions.snapshot()) // 仅读取快照 ... .build() ``` @@ -642,6 +643,7 @@ CREATE TABLE mysql_source (...) WITH ( 'scan.startup.mode' = 'latest-offset', -- 从最晚位点启动 'scan.startup.mode' = 'specific-offset', -- 从特定位点启动 'scan.startup.mode' = 'timestamp', -- 从特定位点启动 + 'scan.startup.mode' = 'snapshot', -- 仅读取快照 'scan.startup.specific-offset.file' = 'mysql-bin.000003', -- 在特定位点启动模式下指定 binlog 文件名 'scan.startup.specific-offset.pos' = '4', -- 在特定位点启动模式下指定 binlog 位置 'scan.startup.specific-offset.gtid-set' = '24DA167-0C0C-11E8-8442-00059A3C7B00:1-19', -- 在特定位点启动模式下指定 GTID 集合 diff --git a/docs/content.zh/docs/connectors/pipeline-connectors/mysql.md b/docs/content.zh/docs/connectors/pipeline-connectors/mysql.md index e7e53f396b..40c774ffcd 100644 --- a/docs/content.zh/docs/connectors/pipeline-connectors/mysql.md +++ b/docs/content.zh/docs/connectors/pipeline-connectors/mysql.md @@ -172,7 +172,7 @@ pipeline: initial String MySQL CDC 消费者可选的启动模式, - 合法的模式为 "initial","earliest-offset","latest-offset","specific-offset" 和 "timestamp"。 + 合法的模式为 "initial","earliest-offset","latest-offset","specific-offset","timestamp" 和 ""snapshot"。 scan.startup.specific-offset.file @@ -280,6 +280,7 @@ pipeline: - `latest-offset`:首次启动时,从不对受监视的数据库表执行快照, 连接器仅从 binlog 的结尾处开始读取,这意味着连接器只能读取在连接器启动之后的数据更改。 - `specific-offset`:跳过快照阶段,从指定的 binlog 位点开始读取。位点可通过 binlog 文件名和位置指定,或者在 GTID 在集群上启用时通过 GTID 集合指定。 - `timestamp`:跳过快照阶段,从指定的时间戳开始读取 binlog 事件。 +- `snapshot`: 只进行快照阶段,跳过增量阶段,快照阶段读取结束后退出。 例如,可以在 YAML 配置文件中这样指定启动模式: @@ -290,6 +291,7 @@ source: scan.startup.mode: latest-offset # Start from latest offset scan.startup.mode: specific-offset # Start from specific offset scan.startup.mode: timestamp # Start from timestamp + scan.startup.mode: snapshot # Read snapshot only scan.startup.specific-offset.file: 'mysql-bin.000003' # Binlog filename under specific offset startup mode scan.startup.specific-offset.pos: 4 # Binlog position under specific offset mode scan.startup.specific-offset.gtid-set: 24DA167-... # GTID set under specific offset startup mode diff --git a/docs/content/docs/connectors/flink-sources/mysql-cdc.md b/docs/content/docs/connectors/flink-sources/mysql-cdc.md index 1a9f92fb7a..a677e440f9 100644 --- a/docs/content/docs/connectors/flink-sources/mysql-cdc.md +++ b/docs/content/docs/connectors/flink-sources/mysql-cdc.md @@ -259,7 +259,7 @@ Connector Options optional initial String - Optional startup mode for MySQL CDC consumer, valid enumerations are "initial", "earliest-offset", "latest-offset", "specific-offset" and "timestamp". + Optional startup mode for MySQL CDC consumer, valid enumerations are "initial", "earliest-offset", "latest-offset", "specific-offset", "timestamp" and "snapshot". Please see Startup Reading Position section for more detailed information. @@ -653,6 +653,7 @@ the end of the binlog which means only have the changes since the connector was - `specific-offset`: Skip snapshot phase and start reading binlog events from a specific offset. The offset could be specified with binlog filename and position, or a GTID set if GTID is enabled on server. - `timestamp`: Skip snapshot phase and start reading binlog events from a specific timestamp. +- `snapshot`: Only the snapshot phase is performed and exits after the snapshot phase reading is completed. For example in DataStream API: ```java @@ -662,6 +663,7 @@ MySQLSource.builder() .startupOptions(StartupOptions.specificOffset("mysql-bin.000003", 4L) // Start from binlog file and offset .startupOptions(StartupOptions.specificOffset("24DA167-0C0C-11E8-8442-00059A3C7B00:1-19")) // Start from GTID set .startupOptions(StartupOptions.timestamp(1667232000000L) // Start from timestamp + .startupOptions(StartupOptions.snapshot()) // Read snapshot only ... .build() ``` @@ -675,6 +677,7 @@ CREATE TABLE mysql_source (...) WITH ( 'scan.startup.mode' = 'latest-offset', -- Start from latest offset 'scan.startup.mode' = 'specific-offset', -- Start from specific offset 'scan.startup.mode' = 'timestamp', -- Start from timestamp + 'scan.startup.mode' = 'snapshot', -- Read snapshot only 'scan.startup.specific-offset.file' = 'mysql-bin.000003', -- Binlog filename under specific offset startup mode 'scan.startup.specific-offset.pos' = '4', -- Binlog position under specific offset mode 'scan.startup.specific-offset.gtid-set' = '24DA167-0C0C-11E8-8442-00059A3C7B00:1-19', -- GTID set under specific offset startup mode diff --git a/docs/content/docs/connectors/pipeline-connectors/mysql.md b/docs/content/docs/connectors/pipeline-connectors/mysql.md index 834b51070f..41eccf9398 100644 --- a/docs/content/docs/connectors/pipeline-connectors/mysql.md +++ b/docs/content/docs/connectors/pipeline-connectors/mysql.md @@ -175,7 +175,7 @@ pipeline: optional initial String - Optional startup mode for MySQL CDC consumer, valid enumerations are "initial", "earliest-offset", "latest-offset", "specific-offset" and "timestamp". + Optional startup mode for MySQL CDC consumer, valid enumerations are "initial", "earliest-offset", "latest-offset", "specific-offset", "timestamp" and "snapshot". scan.startup.specific-offset.file @@ -290,6 +290,7 @@ The config option `scan.startup.mode` specifies the startup mode for MySQL CDC c - `specific-offset`: Skip snapshot phase and start reading binlog events from a specific offset. The offset could be specified with binlog filename and position, or a GTID set if GTID is enabled on server. - `timestamp`: Skip snapshot phase and start reading binlog events from a specific timestamp. +- `snapshot`: Only the snapshot phase is performed and exits after the snapshot phase reading is completed. For example in YAML definition: @@ -300,6 +301,7 @@ source: scan.startup.mode: latest-offset # Start from latest offset scan.startup.mode: specific-offset # Start from specific offset scan.startup.mode: timestamp # Start from timestamp + scan.startup.mode: snapshot # Read snapshot only scan.startup.specific-offset.file: 'mysql-bin.000003' # Binlog filename under specific offset startup mode scan.startup.specific-offset.pos: 4 # Binlog position under specific offset mode scan.startup.specific-offset.gtid-set: 24DA167-... # GTID set under specific offset startup mode