From dd8e57166313aae4d3e9c468465584d4f19ad847 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Fri, 8 Sep 2023 10:06:43 +0800 Subject: [PATCH] dm: update contents about wildcards (#14695) (#14760) --- dm/dm-binlog-event-filter.md | 6 +++--- dm/dm-block-allow-table-lists.md | 6 +++--- dm/dm-table-routing.md | 8 +++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/dm/dm-binlog-event-filter.md b/dm/dm-binlog-event-filter.md index 8ce2a0d9c1e9c..5bcc5d35bc240 100644 --- a/dm/dm-binlog-event-filter.md +++ b/dm/dm-binlog-event-filter.md @@ -23,11 +23,11 @@ filters: Starting from DM v2.0.2, you can configure the binlog event filter in the source configuration file. For details, see [Upstream Database Configuration File](/dm/dm-source-configuration-file.md). -In simple scenarios, it is recommended that you use the wildcard for matching schemas and tables. However, note the following version differences: +When you use the wildcard for matching schemas and tables, note the following: -- For DM v1.0.5 or later versions, the binlog event filter supports the [wildcard match](https://en.wikipedia.org/wiki/Glob_(programming)#Syntax), but there can be **only one** `*` in the wildcard expression, and `*` **must be placed at the end**. +- `schema-pattern` and `table-pattern` only support wildcards, including `*`, `?`, and `[]`. There can only be one `*` symbol in a wildcard match, and it must be at the end. For example, in `table-pattern: "t_*"`, `"t_*"` indicates all tables starting with `t_`. See [wildcard matching](https://en.wikipedia.org/wiki/Glob_(programming)#Syntax) for details. -- For DM versions earlier than v1.0.5, the binlog event filter supports the wildcard but does not support the `[...]` and `[!...]` expressions. +- `sql-pattern` only supports regular expressions. ## Parameter descriptions diff --git a/dm/dm-block-allow-table-lists.md b/dm/dm-block-allow-table-lists.md index 0f09f40da5a21..3c131d245e2ca 100644 --- a/dm/dm-block-allow-table-lists.md +++ b/dm/dm-block-allow-table-lists.md @@ -28,7 +28,7 @@ block-allow-list: # Use black-white-list if the DM version is earlie - db-name: "~^test.*" tbl-name: "~^t.*" - db-name: "test" - tbl-name: "t" + tbl-name: "t*" ignore-tables: - db-name: "test" tbl-name: "log" @@ -36,9 +36,9 @@ block-allow-list: # Use black-white-list if the DM version is earlie In simple scenarios, it is recommended that you use the wildcard for matching schemas and tables. However, note the following version differences: -- For DM v1.0.5 or later versions, the block and allow lists support the [wildcard match](https://en.wikipedia.org/wiki/Glob_(programming)#Syntax), but there can be **only one** `*` in the wildcard expression, and `*` **must be placed at the end**. +- Wildcards including `*`, `?`, and `[]` are supported. There can only be one `*` symbol in a wildcard match, and it must be at the end. For example, in `tbl-name: "t*"`, `"t*"` indicates all tables starting with `t`. See [wildcard matching](https://en.wikipedia.org/wiki/Glob_(programming)#Syntax) for details. -- For DM versions earlier than v1.0.5, the block and allow lists only support regular expression matching. +- A regular expression must begin with the `~` character. ## Parameter descriptions diff --git a/dm/dm-table-routing.md b/dm/dm-table-routing.md index ce7e2576c49dd..63f1089e56ef6 100644 --- a/dm/dm-table-routing.md +++ b/dm/dm-table-routing.md @@ -38,11 +38,13 @@ routes: target-schema: "test" ``` -In simple scenarios, it is recommended that you use the wildcard for matching schemas and tables. However, note the following version differences: +Regular expressions and wildcards are supported to match database and table names. In simple scenarios, it is recommended that you use the wildcard for matching schemas and tables. However, note the following: -- For DM v1.0.5 or later versions, the table routing supports the [wildcard match](https://en.wikipedia.org/wiki/Glob_(programming)#Syntax), but there can be **only one** `*` in the wildcard expression, and `*` **must be placed at the end**. +- Wildcards including `*`, `?`, and `[]` are supported. There can only be one `*` symbol in a wildcard match, and it must be at the end. For example, in `table-pattern: "t_*"`, `"t_*"` indicates all tables starting with `t_`. See [wildcard matching](https://en.wikipedia.org/wiki/Glob_(programming)#Syntax) for details. -- For DM versions earlier than v1.0.5, the table routing supports the wildcard but does not support the `[...]` and `[!...]` expressions. +- `table-regexp`, `schema-regexp`, and `source-regexp` only support regular expressions and cannot start with the `~` symbol. + +- `schema-pattern` and `table-pattern` support both wildcards and regular expressions. Regular expressions must begin with the `~` symbol. ## Parameter descriptions