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

fast DDL failed with [Lightning:Restore:ErrOpenDuplicateDB]open duplicate db error: open /tmp/tidb/tmp_ddl-4000/595/duplicates/MANIFEST-000001: no such file or directory #52697

Closed
lance6716 opened this issue Apr 18, 2024 · 2 comments
Labels
component/ddl This issue is related to DDL of TiDB. fuzz/schrddl type/bug The issue is confirmed as a bug.

Comments

@lance6716
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

concurrently run multiple fast ADD INDEX

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

no error

3. What did you see instead (Required)

[Lightning:Restore:ErrOpenDuplicateDB]open duplicate db error: open /tmp/tidb/tmp_ddl-4000/595/duplicates/MANIFEST-000001: no such file or directory

4. What is your TiDB version? (Required)

@lance6716 lance6716 added the type/bug The issue is confirmed as a bug. label Apr 18, 2024
@lance6716
Copy link
Contributor Author

lance6716 commented Apr 18, 2024

I think the problem is when the first DDL job finished one schema state transition, it will remove itself from runningJobs

tidb/pkg/ddl/job_table.go

Lines 416 to 423 in a9e3398

// delivery2Worker owns the worker, need to put it back to the pool in this function.
func (d *ddl) delivery2Worker(wk *worker, pool *workerPool, job *model.Job) {
injectFailPointForGetJob(job)
d.runningJobs.add(job)
d.wg.Run(func() {
metrics.DDLRunningJobCount.WithLabelValues(pool.tp().String()).Inc()
defer func() {
d.runningJobs.remove(job)

Then the second DDL job have chance to be run. Meanwhile, the first job still can continue the next state transition because it has processing set to 1

tidb/pkg/ddl/job_table.go

Lines 121 to 126 in a9e3398

// The job has already been picked up, just return to continue it.
if isJobProcessing {
return &job, nil
}
b, err := filter(&job)

So the second job may remove the first job's sort directory if the first job does not add itself to runningJobs timely in the next state transition.

@seiya-annie seiya-annie added the component/ddl This issue is related to DDL of TiDB. label Apr 18, 2024
@lance6716
Copy link
Contributor Author

closed by #52503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/ddl This issue is related to DDL of TiDB. fuzz/schrddl type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants