-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit fixes an issue that was introduced in 0c1095e where we could set an error on the DistSQLReceiver from the concurrent goroutine while the main goroutine would proceed on pushing. If the next object it pushes is not a metadata (i.e. either a row or a batch), this would result in a crash. The issue is that we mistakenly assumed that updating the status of the receiver only on metadata objects would be sufficient, but it's not since there is a race between the context cancellation propagation across the local flow and the row / batch being pushed to the client. This commit fixes the issue by introducing an atomic boolean that indicates whether the receiver's status needs to be updated. The concurrent goroutine now sets the error as well as this atomic boolean, and the main goroutine now checks the boolean on each push and updates the status if necessary. With this setup we avoid acquiring the mutex on each push call and only do an atomic read (which is supposed to be faster). Release note: None
- Loading branch information
1 parent
4b3f582
commit 3b3bf2f
Showing
1 changed file
with
33 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters