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: fix check running ingest job #54543

Merged
merged 7 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/ddl/ingest/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func filterProcessingJobIDs(ctx context.Context, se *sess.Session, jobIDs []int6
sb.WriteString(strconv.FormatInt(id, 10))
}
sql := fmt.Sprintf(
"SELECT job_id FROM mysql.tidb_ddl_job WHERE job_id IN (%s) AND processing",
"SELECT job_id FROM mysql.tidb_ddl_job WHERE job_id IN (%s)",
sb.String())
rows, err := se.Execute(ctx, sql, "filter_processing_job_ids")
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ddl/ingest/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestLitBackendCtxMgr(t *testing.T) {

tk := testkit.NewTestKit(t, store)
tk.MustExec("insert into mysql.tidb_ddl_job (job_id, processing) values (100, true);")
tk.MustExec("insert into mysql.tidb_ddl_job (job_id, processing) values (101, true);")
tk.MustExec("insert into mysql.tidb_ddl_job (job_id, processing) values (101, false);")

ingest.CleanUpTempDir(ctx, tk.Session(), sortPath)
require.DirExists(t, staleJobDir)
Expand All @@ -63,7 +63,7 @@ func TestLitBackendCtxMgr(t *testing.T) {
require.DirExists(t, staleJobDir)
require.NoDirExists(t, staleJobDir2)

tk.MustExec("update mysql.tidb_ddl_job set processing = false where job_id = 100;")
tk.MustExec("delete from mysql.tidb_ddl_job where job_id = 100;")
ingest.CleanUpTempDir(ctx, tk.Session(), sortPath)
require.NoDirExists(t, staleJobDir)
require.NoDirExists(t, staleJobDir2)
Expand Down