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

binlog-schema delete is always failed #7373

Closed
okJiang opened this issue Oct 16, 2022 · 4 comments · Fixed by #8180
Closed

binlog-schema delete is always failed #7373

okJiang opened this issue Oct 16, 2022 · 4 comments · Fixed by #8180
Assignees
Labels
affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. area/dm Issues or PRs related to DM. severity/major type/bug The issue is confirmed as a bug.

Comments

@okJiang
Copy link
Member

okJiang commented Oct 16, 2022

What did you do?

from https://asktug.com/t/topic/963049, and test locally

» binlog-schema delete test start_task t -s mysql-replica-01
{
    "result": true,
    "msg": "",
    "sources": [
        {
            "result": false,
            "msg": "[code=44009:class=schema-tracker:scope=internal:level=medium], Message:  is not a valid `CREATE TABLE` statement, RawCause: [parser:1149]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use",
            "source": "mysql-replica-01",
            "worker": ""
        }
    ]
}

What did you expect to see?

I didn't see any positive test case about binlog-schema delete, we should add it.

What did you see instead?

No response

Versions of the cluster

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

(paste DM version here, and you must ensure versions of dmctl, DM-worker and DM-master are same)
nightly

Upstream MySQL/MariaDB server version:

(paste upstream MySQL/MariaDB server version here)

Downstream TiDB cluster version (execute SELECT tidb_version(); in a MySQL client):

(paste TiDB cluster version here)

How did you deploy DM: tiup or manually?

(leave TiUP or manually here)

Other interesting information (system version, hardware config, etc):

>
>

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

DM is paused

» query-status test
{
    "result": true,
    "msg": "",
    "sources": [
        {
            "result": true,
            "msg": "",
            "sourceStatus": {
                "source": "mysql-replica-01",
                "worker": "worker2",
                "result": null,
                "relayStatus": null
            },
            "subTaskStatus": [
                {
                    "name": "test",
                    "stage": "Paused",
                    "unit": "Sync",
                    "result": {
                        "isCanceled": false,
                        "errors": [
                            {
                                "ErrCode": 20057,
                                "ErrClass": "config",
                                "ErrScope": "internal",
                                "ErrLevel": "high",
                                "Message": "start-time 2037-12-12 01:02:03 is too late, no binlog location matches it",
                                "RawCause": "",
                                "Workaround": "Please check the `--start-time` is expected or try again later."
                            }
                        ],
                        "detail": null
                    },
                    "unresolvedDDLLockID": "",
                    "sync": {
                        "totalEvents": "0",
                        "totalTps": "0",
                        "recentTps": "0",
                        "masterBinlog": "(mysql-bin.000001, 1410)",
                        "masterBinlogGtid": "0add8fb9-0201-11ed-9e0a-de5ffb51d67e:1-6",
                        "syncerBinlog": "(mysql-bin.000001, 1410)",
                        "syncerBinlogGtid": "0add8fb9-0201-11ed-9e0a-de5ffb51d67e:1-6",
                        "blockingDDLs": [
                        ],
                        "unresolvedGroups": [
                        ],
                        "synced": true,
                        "binlogType": "remote",
                        "secondsBehindMaster": "0",
                        "blockDDLOwner": "",
                        "conflictMsg": ""
                    },
                    "validation": null
                }
            ]
        }
    ]
}
@okJiang okJiang added area/dm Issues or PRs related to DM. type/bug The issue is confirmed as a bug. labels Oct 16, 2022
@okJiang
Copy link
Member Author

okJiang commented Oct 16, 2022

This bug is because:

binlog-schema delete is set request's schema to empty

then create SQL is empty

tiflow/dm/syncer/schema.go

Lines 84 to 100 in 1775b4f

// from source or target need get schema
if req.FromSource {
schema, err := dbconn.GetTableCreateSQL(s.tctx.WithContext(ctx), s.fromConn, sourceTable.String())
if err != nil {
return "", err
}
req.Schema = schema
}
if req.FromTarget {
targetTable := s.route(sourceTable)
schema, err := dbconn.GetTableCreateSQL(s.tctx.WithContext(ctx), s.downstreamTrackConn, targetTable.String())
if err != nil {
return "", err
}
req.Schema = schema
}

so parse create SQL failed

node, err := parser2.ParseOneStmt(req.Schema, "", "")

@okJiang
Copy link
Member Author

okJiang commented Oct 16, 2022

/lable affects-6.0 affects-6.1 affects-6.2 affects-6.3

@okJiang
Copy link
Member Author

okJiang commented Oct 16, 2022

/lable affects-6.0

@okJiang
Copy link
Member Author

okJiang commented Oct 17, 2022

/assign @WizardXiao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. area/dm Issues or PRs related to DM. severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants