Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddl events should not be filtered in puller #10524

Closed
CharlesCheung96 opened this issue Jan 22, 2024 · 1 comment · Fixed by #10518
Closed

ddl events should not be filtered in puller #10524

CharlesCheung96 opened this issue Jan 22, 2024 · 1 comment · Fixed by #10518
Labels
affects-6.1 affects-6.5 affects-7.1 affects-7.5 area/ticdc Issues or PRs related to TiCDC. report/customer Customers have encountered this bug. severity/moderate type/bug The issue is confirmed as a bug.

Comments

@CharlesCheung96
Copy link
Contributor

CharlesCheung96 commented Jan 22, 2024

The dataflow of ddl in TiCDC is:

TiKV --> kvClient --> ddlPuller --> owner.schemaStorage  --> owner.ddlManager  --> ddlSink

There are two methods to filter ddl event:

  1. Discard: filter ddl event in ddlPuller.
  2. Ignore: filter ddl event in ddlManager.

In the current implementation, TiCDC discrd ddl events, which should be filtered, in ddlPuller and the subsequent modules of puller do not handle such ddl events. This causes cdc to behave unreasonably when using event-filter rules.
For example, if we create a changefeed-test with the following config:

[filter]
rules = ['test.*']

[[filter.event-filters]]
matcher = ["test.t1"] # matcher is an allow list, which means this rule only applies to the worker table in the test database.
ignore-event = ["create table"] # Ignore `create table` ddl events.

Then,

  1. After executing create table test.t0, cdc will capture table t0.
  2. After executing create table test.t1, cdc will discard the ddl since it match event-filter rules. Therefore, cdc will not capture table t1.
  3. However, after restarting changefeed-test, cdc will get a schema snapshot from tikv, and capture both t0 and t1. This is confusing to the user.

In conclusion, the behavior of TiCDC in ignoring create/delete/truncate/alter DDL in puller module is as follows:

Case 1: After a table or partition is created, TiCDC does not synchronize the new physical table. However, cdc will synchronize the new physical table after the changefeed restarts.

[filter]
rules = ['test.*']

[[filter.event-filters]]
matcher = ["test.t1"] # matcher is an allow list, which means this rule only applies to the worker table in the test database.
ignore-event = ["create table, add table partition"] 

Case 2: After a table or partition is dropped, TiCDC still synchronizes the deleted physical table. However, cdc will not synchronize the deleted physical table after the changefeed restarts.

[filter]
rules = ['test.*']

[[filter.event-filters]]
matcher = ["test.t1"] # matcher is an allow list, which means this rule only applies to the worker table in the test database.
ignore-event = ["drop table, drop table partition"] 

Case 3: After a table or partition is truncated, TiCDC does not synchronize the new physical table, but still synchronizes the deleted physical table.

[filter]
rules = ['test.*']

[[filter.event-filters]]
matcher = ["test.t1"] # matcher is an allow list, which means this rule only applies to the worker table in the test database.
ignore-event = ["truncate table, truncate table partition"] 

Case 4: After the Alter table or partition ddl, CDC still uses the schma of the old table to parse data, wich leads to unpredictable data inconsistencies.

[filter]
rules = ['test.*']

[[filter.event-filters]]
matcher = ["test.t1"] # matcher is an allow list, which means this rule only applies to the worker table in the test database.
ignore-event = ["alter table, alter table partition"] 
@CharlesCheung96 CharlesCheung96 added type/bug The issue is confirmed as a bug. severity/moderate affects-6.5 affects-7.1 affects-7.5 area/ticdc Issues or PRs related to TiCDC. labels Jan 22, 2024
CharlesCheung96 added a commit to ti-chi-bot/tiflow that referenced this issue Jan 24, 2024
CharlesCheung96 added a commit to ti-chi-bot/tiflow that referenced this issue Jan 24, 2024
CharlesCheung96 added a commit to ti-chi-bot/tiflow that referenced this issue Jan 24, 2024
CharlesCheung96 added a commit to ti-chi-bot/tiflow that referenced this issue Jan 24, 2024
@seiya-annie
Copy link

/found customer

@ti-chi-bot ti-chi-bot bot added the report/customer Customers have encountered this bug. label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.1 affects-6.5 affects-7.1 affects-7.5 area/ticdc Issues or PRs related to TiCDC. report/customer Customers have encountered this bug. severity/moderate type/bug The issue is confirmed as a bug.
Projects
Development

Successfully merging a pull request may close this issue.

3 participants