-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
infoschema: fix information schema data race #7318
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -187,31 +189,31 @@ func (b *Builder) applyCreateTable(m *meta.Meta, roDBInfo *model.DBInfo, tableID | |||
|
|||
newTbl, ok := b.is.TableByID(tableID) | |||
if ok { | |||
roDBInfo.Tables = append(roDBInfo.Tables, newTbl.Meta()) | |||
dbInfo.Tables = append(dbInfo.Tables, newTbl.Meta()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, here is the race?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here may have the race.
} else { | ||
roDBInfo.Tables = append(roDBInfo.Tables[:i], roDBInfo.Tables[i+1:]...) | ||
dbInfo.Tables = append(dbInfo.Tables[:i], dbInfo.Tables[i+1:]...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or here?
In the PR description, you'd better post the data race log, so it's easier for us to understand where is the cause of the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually happens here in the log, but I browse the file and find more places that may have the race.
/run-all-tests |
/run-unit-test |
/run-all-tests |
What have you changed? (mandatory)
When applying the changes to
DBInfo
, we should not directly modify it, because it may be referenced by others.What is the type of the changes? (mandatory)
How has this PR been tested? (mandatory)
Tested in #7305
Does this PR affect documentation (docs/docs-cn) update? (mandatory)
No.
Does this PR affect tidb-ansible update? (mandatory)
No.
Does this PR need to be added to the release notes? (mandatory)
No.
Refer to a related PR or issue link (optional)
Benchmark result if necessary (optional)
Add a few positive/negative examples (optional)
PTAL @coocood @zimulala