Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sqlbase: avoid a race in sqlbase.CancelChecker
Prior to the distsql-ification of planNode execution, all the execution steps in a local query were interleaved (using coroutine-style concurrency), so that the calls to `(*CancelChecker).Check()` were all sequential. With distsql now it's possible for different planNode `Next()` or `startExec()` methods to be running in concurrent goroutines on multiple cores, i.e. truly parallel. This in turn requires atomic access to the counter in the cancel checker. Without atomic access, there is a race condition and the possibility that the cancel checker does not work well (some increments can be performed two times, which could cause the condition of the check to occasionally fail). Found with SQLSmith. Release note: None
- Loading branch information