Skip to content

The like in RemoveBackfillJob in job_table.go is incorrect #41579

@zimulala

Description

@zimulala

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

tidb/ddl/job_table.go

Lines 938 to 946 in 21aa40f

// RemoveBackfillJob removes the backfill jobs from the tidb_background_subtask table.
// If isOneEle is true, removes all jobs with backfillJob's ddl_job_id, ele_id and ele_key. Otherwise, removes the backfillJob.
func RemoveBackfillJob(sess *session, isOneEle bool, backfillJob *BackfillJob) error {
sql := "delete from mysql.tidb_background_subtask"
if !isOneEle {
sql += fmt.Sprintf(" where task_key like \"%d_%s_%d_%d\"", backfillJob.JobID, hex.EncodeToString(backfillJob.EleKey), backfillJob.EleID, backfillJob.ID)
} else {
sql += fmt.Sprintf(" where task_key like \"%d_%s_%d_%%\"", backfillJob.JobID, hex.EncodeToString(backfillJob.EleKey), backfillJob.EleID)
}

like and = are not the same.
Related PR: #41093.

2. What did you expect to see? (Required)

https://github.com/pingcap/tidb/pull/39616/files#diff-91c692cc214077acc788fcaf2f92fb40d0a6c4aef3e34e3b6ed532677dac9f13R705-R707

3. What did you see instead (Required)

https://github.com/pingcap/tidb/pull/41093/files#diff-91c692cc214077acc788fcaf2f92fb40d0a6c4aef3e34e3b6ed532677dac9f13R943

4. What is your TiDB version? (Required)

master

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions