-
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
expression: fix data race of rand function #11168
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
/run-all-tests |
@@ -988,19 +989,23 @@ func (c *randFunctionClass) getFunction(ctx sessionctx.Context, args []Expressio | |||
|
|||
type builtinRandSig struct { | |||
baseBuiltinFunc | |||
mu *sync.Mutex |
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.
All the projectWorkers will battle for this Mutex?
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.
Yes, and this is the only way to make it correct.
Codecov Report
@@ Coverage Diff @@
## master #11168 +/- ##
===========================================
Coverage 81.1123% 81.1123%
===========================================
Files 423 423
Lines 90382 90382
===========================================
Hits 73311 73311
Misses 11788 11788
Partials 5283 5283 |
/run-integration-ddl-test |
What problem does this PR solve?
What is changed and how it works?
Add a mutex for
rand
to prevent data race.Check List
Tests
Code changes
Side effects
Related changes