-
Type:
Improvement
-
Resolution: Duplicate
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Context
Currently the Go Driver GridFSBucket.UploadFromStream method is not goroutine-safe. While we don't explicitly document that the GridFS API is goroutine safe, it's surprising to users because the Go Driver CRUD API is goroutine-safe and there's no technical reason that the GridFS API shouldn't be goroutine-safe.
We should make GridFSBucket.UploadFromStream goroutine-safe.
Definition of done
- Add a test that calls GridFSBucket.UploadFromStream in different goroutines and asserts that the uploaded results are correct.
- Also test GridFSBucket.UploadFromStreamWithID with a similar test.
- See a proof-of-concept test generated by Claude here.
- Fix any concurrency bugs detected using the -race test flag.
- Update the documentation for GridFSBucket.UploadFromStream to indicate it's safe to call from different goroutines. For example:
// It is safe for concurrent use by multiple goroutines.
Pitfalls
What should the implementer watch out for? What are the risks?
- duplicates
-
GODRIVER-4123 Make GridFS OpenUploadStream and UploadFromStream goroutine-safe
-
- Ready for Work
-