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

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

Closed
Tracked by #37119
zimulala opened this issue Feb 20, 2023 · 0 comments · Fixed by #41860
Closed
Tracked by #37119

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

zimulala opened this issue Feb 20, 2023 · 0 comments · Fixed by #41860
Assignees
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug This issue is a bug.

Comments

@zimulala
Copy link
Contributor

zimulala commented Feb 20, 2023

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

@zimulala zimulala added type/bug This issue is a bug. severity/moderate labels Feb 20, 2023
@zimulala zimulala changed the title Fix the RemoveBackfillJob's bug in job_table.go The like in RemoveBackfillJob in job_table.go is incorrect Feb 20, 2023
@aytrack aytrack added the sig/sql-infra SIG: SQL Infra label Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/sql-infra SIG: SQL Infra type/bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants