You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by le...@apache.org on 2024/07/22 04:25:45 UTC
(flink-cdc) branch master updated: [FLINK-35871][doc] Add missed "snapshot" mode to mysql connector startup options
This is an automated email from the ASF dual-hosted git repository.
leonard pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-cdc.git
The following commit(s) were added to refs/heads/master by this push:
new fcb4cd8f6 [FLINK-35871][doc] Add missed "snapshot" mode to mysql connector startup options
fcb4cd8f6 is described below
commit fcb4cd8f6c917d68fd1f6b689b6640bac1c31aa9
Author: Kunni <lv...@alibaba-inc.com>
AuthorDate: Mon Jul 22 12:25:41 2024 +0800
[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 7f400af23..1d81555de 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;
<td style="word-wrap: break-word;">initial</td>
<td>String</td>
<td> MySQL CDC 消费者可选的启动模式,
- 合法的模式为 "initial","earliest-offset","latest-offset","specific-offset" 和 "timestamp"。
+ 合法的模式为 "initial","earliest-offset","latest-offset","specific-offset","timestamp" 和 "snapshot"。
请查阅 <a href="#a-name-id-002-a">启动模式</a> 章节了解更多详细信息。</td>
</tr>
<tr>
@@ -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 e7e53f396..40c774ffc 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:
<td style="word-wrap: break-word;">initial</td>
<td>String</td>
<td> MySQL CDC 消费者可选的启动模式,
- 合法的模式为 "initial","earliest-offset","latest-offset","specific-offset" 和 "timestamp"。</td>
+ 合法的模式为 "initial","earliest-offset","latest-offset","specific-offset","timestamp" 和 ""snapshot"。</td>
</tr>
<tr>
<td>scan.startup.specific-offset.file</td>
@@ -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 1a9f92fb7..a677e440f 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
<td>optional</td>
<td style="word-wrap: break-word;">initial</td>
<td>String</td>
- <td>Optional startup mode for MySQL CDC consumer, valid enumerations are "initial", "earliest-offset", "latest-offset", "specific-offset" and "timestamp".
+ <td>Optional startup mode for MySQL CDC consumer, valid enumerations are "initial", "earliest-offset", "latest-offset", "specific-offset", "timestamp" and "snapshot".
Please see <a href="#startup-reading-position">Startup Reading Position</a> section for more detailed information.</td>
</tr>
<tr>
@@ -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 834b51070..41eccf939 100644
--- a/docs/content/docs/connectors/pipeline-connectors/mysql.md
+++ b/docs/content/docs/connectors/pipeline-connectors/mysql.md
@@ -175,7 +175,7 @@ pipeline:
<td>optional</td>
<td style="word-wrap: break-word;">initial</td>
<td>String</td>
- <td>Optional startup mode for MySQL CDC consumer, valid enumerations are "initial", "earliest-offset", "latest-offset", "specific-offset" and "timestamp".</td>
+ <td>Optional startup mode for MySQL CDC consumer, valid enumerations are "initial", "earliest-offset", "latest-offset", "specific-offset", "timestamp" and "snapshot".</td>
</tr>
<tr>
<td>scan.startup.specific-offset.file</td>
@@ -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