Skip to content

Commit

Permalink
Add sql mode format restrictions to expr in ticdc filter (#16626)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyunyan authored Mar 19, 2024
1 parent 669d957 commit 1ac320a
Showing 1 changed file with 49 additions and 25 deletions.
74 changes: 49 additions & 25 deletions ticdc/ticdc-filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,55 @@ Description of configuration parameters:
- `matcher`: the database and table that this event filter rule applies to. The syntax is the same as [table filter](/table-filter.md).
- `ignore-event`: the event type to be ignored. This parameter accepts an array of strings. You can configure multiple event types. Currently, the following event types are supported:

| Event | Type | Alias | Description |
| --------------- | ---- | -|--------------------------|
| all dml | | |Matches all DML events |
| all ddl | | |Matches all DDL events |
| insert | DML | |Matches `insert` DML event |
| update | DML | |Matches `update` DML event |
| delete | DML | |Matches `delete` DML event |
| create schema | DDL | create database |Matches `create database` event |
| drop schema | DDL | drop database |Matches `drop database` event |
| create table | DDL | |Matches `create table` event |
| drop table | DDL | |Matches `drop table` event |
| rename table | DDL | |Matches `rename table` event |
| truncate table | DDL | |Matches `truncate table` event |
| alter table | DDL | |Matches `alter table` event, including all clauses of `alter table`, `create index` and `drop index` |
| add table partition | DDL | |Matches `add table partition` event |
| drop table partition | DDL | |Matches `drop table partition` event |
| truncate table partition | DDL | |Matches `truncate table partition` event |
| create view | DDL | |Matches `create view`event |
| drop view | DDL | |Matches `drop view` event |

- `ignore-sql`: the DDL statements to be ignored. This parameter accepts an array of strings, in which you can configure multiple regular expressions. This rule only applies to DDL events.
- `ignore-delete-value-expr`: this parameter accepts a SQL expression. This rule only applies to delete DML events with the specified value.
- `ignore-insert-value-expr`: this parameter accepts a SQL expression. This rule only applies to insert DML events with the specified value.
- `ignore-update-old-value-expr`: this parameter accepts a SQL expression. This rule only applies to update DML events whose old value contains the specified value.
- `ignore-update-new-value-expr`: this parameter accepts a SQL expression. This rule only applies to update DML events whose new value contains the specified value.
| Event | Type | Alias | Description |
| --------------- | ---- | -|--------------------------|
| all dml | | |Matches all DML events |
| all ddl | | |Matches all DDL events |
| insert | DML | |Matches `insert` DML event |
| update | DML | |Matches `update` DML event |
| delete | DML | |Matches `delete` DML event |
| create schema | DDL | create database |Matches `create database` event |
| drop schema | DDL | drop database |Matches `drop database` event |
| create table | DDL | |Matches `create table` event |
| drop table | DDL | |Matches `drop table` event |
| rename table | DDL | |Matches `rename table` event |
| truncate table | DDL | |Matches `truncate table` event |
| alter table | DDL | |Matches `alter table` event, including all clauses of `alter table`, `create index` and `drop index` |
| add table partition | DDL | |Matches `add table partition` event |
| drop table partition | DDL | |Matches `drop table partition` event |
| truncate table partition | DDL | |Matches `truncate table partition` event |
| create view | DDL | |Matches `create view`event |
| drop view | DDL | |Matches `drop view` event |
| modify schema charset and collate | DDL | |Matches `modify schema charset and collate` event |
| recover table | DDL | |Matches `recover table` event |
| rebase auto id | DDL | |Matches `rebase auto id` event |
| modify table comment | DDL | |Matches `modify table comment` event |
| modify table charset and collate | DDL | |Matches `modify table charset and collate` event |
| exchange table partition | DDL | |Matches `exchange table partition` event |
| reorganize table partition | DDL | |Matches `reorganize table partition` event |
| alter table partitioning | DDL | |Matches `alter table partitioning` event |
| remove table partitioning | DDL | |Matches `remove table partitioning` event |
| add column | DDL | |Matches `add column` event |
| drop column | DDL | |Matches `drop column` event |
| modify column | DDL | |Matches `modify column` event |
| set default value | DDL | |Matches `set default value` event |
| add primary key | DDL | |Matches `add primary key` event |
| drop primary key | DDL | |Matches `drop primary key` event |
| rename index | DDL | |Matches `rename index` event |
| alter index visibility | DDL | |Matches `alter index visibility` event |
| alter ttl info | DDL | |Matches `alter ttl info` event |
| alter ttl remove| DDL | |Matches DDL events that remove all TTL attributes of a table |
| multi schema change | DDL | |Matches DDL events that change multiple attributes of a table within the same DDL statement |

> **Note:**
>
> TiDB's DDL statements support changing multiple attributes of a single table at the same time, such as `ALTER TABLE t MODIFY COLUMN a INT, ADD COLUMN b INT, DROP COLUMN c;`. This operation is defined as MultiSchemaChange. If you want to filter out this type of DDL, you need to configure `"multi schema change"` in `ignore-event`.
- `ignore-sql`: the regular expressions of the DDL statements to be filtered out. This parameter accepts an array of strings, in which you can configure multiple regular expressions. This configuration only applies to DDL events.
- `ignore-delete-value-expr`: this parameter accepts a SQL expression that follows the default SQL mode, used to filter out the `DELETE` type of DML events with a specified value.
- `ignore-insert-value-expr`: this parameter accepts a SQL expression that follows the default SQL mode, used to filter out the `INSERT` type of DML events with a specified value.
- `ignore-update-old-value-expr`: this parameter accepts a SQL expression that follows the default SQL mode, used to filter out the `UPDATE` type of DML events with a specified old value.
- `ignore-update-new-value-expr`: this parameter accepts a SQL expression that follows the default SQL mode, used to filter out the `UPDATE` DML events with a specified new value.

> **Note:**
>
Expand Down

0 comments on commit 1ac320a

Please sign in to comment.