tiflow icon indicating copy to clipboard operation
tiflow copied to clipboard

Can not skip `DROP PROCEDURE` with schema-pattern

Open GMHDBJD opened this issue 3 years ago • 8 comments

What did you do?

upstream

use db;
/*!*/ DROP PROCEDURE `xxx`

task config

filters:
  filter-rule-1:
    schema-pattern: "db"
    sql-pattern: [".*\\s+DROP\\s+PROCEDURE"]
    action: Ignore

What did you expect to see?

no error occurs

What did you see instead?

"result": {
                        "isCanceled": false,
                        "errors": [
                            {
                                "ErrCode": 36067,
                                "ErrClass": "sync-unit",
                                "ErrScope": "internal",
                                "ErrLevel": "high",
                                "Message": "startLocation: [position: (mysql-bin.000001, 1849), gtid-set: ], endLocation: [position: (mysql-bin.000001, 1970), gtid-set: ], origin SQL: [/*!*/ DROP PROCEDURE IF EXISTS `xxx`]: parse DDL: /*!*/ DROP PROCEDURE IF EXISTS `xxx`",
                                "RawCause": "line 1 column 20 near \"PROCEDURE IF EXISTS `xxx`\" ",
                                "Workaround": "Please confirm your DDL statement is correct and needed. For TiDB compatible DDL, see https://docs.pingcap.com/tidb/stable/mysql-compatibility#ddl. You can use `handle-error` command to skip or replace the DDL or add a binlog filter rule to ignore it if the DDL is not needed."
                            }
                        ],
                        "detail": null
                    },

Versions of the cluster

DM version (run dmctl -V or dm-worker -V or dm-master -V):

master

current status of DM cluster (execute query-status <task-name> in dmctl)

(paste current status of DM cluster here)

GMHDBJD avatar Nov 10 '21 03:11 GMHDBJD

with an all schema pattern, the event was skipped correctly.

filters:
  filter-rule-1:
    schema-pattern: "*"
    sql-pattern: [".*\\s+DROP\\s+PROCEDURE"]
    action: Ignore

GMHDBJD avatar Nov 10 '21 03:11 GMHDBJD

@okJiang PTAL. Seems we still try to parse some DDLs that tidb doesn't support.

glorv avatar Nov 11 '21 06:11 glorv

Maybe you are confused with events and sql-pattern. You can try again with sql-pattern. @GMHDBJD

okJiang avatar Nov 11 '21 07:11 okJiang

with an all schema pattern, the event was skipped correctly.

filters:
  filter-rule-1:
    schema-pattern: "*"
    events: [".*\\s+DROP\\s+PROCEDURE"]
    action: Ignore

So I think this is expected behavior. For DDLs that tidb don't support, we won't know the related db/table schema, so the schema pattern must be set as *.

We may add a NOTE in our doc for this.

glorv avatar Nov 11 '21 07:11 glorv

Maybe you are confused with events and sql-pattern. You can try again with sql-pattern. @GMHDBJD

My fault,update

GMHDBJD avatar Nov 11 '21 07:11 GMHDBJD

with an all schema pattern, the event was skipped correctly.

filters:
  filter-rule-1:
    schema-pattern: "*"
    events: [".*\\s+DROP\\s+PROCEDURE"]
    action: Ignore

So I think this is expected behavior. For DDLs that tidb don't support, we won't know the related db/table schema, so the schema pattern must be set as *.

We may add a NOTE in our doc for this.

Yes, but our docs is wrong,https://docs.pingcap.com/zh/tidb-data-migration/stable/key-features#binlog-event-filter Also if we have different behavior between DDLs(whether TiDB support or not), users will be confused

GMHDBJD avatar Nov 11 '21 07:11 GMHDBJD

assign to @liumengya94 as beginner's issue

D3Hunter avatar Aug 10 '22 10:08 D3Hunter