Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix possible deadlock in background WAL uploader
Stop() of background uploader was acquiring upload scan mutex. Under this mutex, it was disallowing new uploads and awaits finish of all spawned uploads. But scan process has to acquire that mutex too. In various race outcomes, upload could deadlock with Stop(). Now Stop() awaits for finished uploads with the released mutex. Mutex guards that upload is not started if Stop() in progress. With current mutex guards, we could relax all atomic operations with bgUploader.parallelWorkers, but this requires extra refactoring, now we should just fix the bug.
- Loading branch information