fix(doc): Concurrency bug in striped_downloads.md guide#4731
fix(doc): Concurrency bug in striped_downloads.md guide#4731coryan merged 2 commits intogoogleapis:mainfrom
Conversation
Signed-off-by: Dennis Keck <26092524+fellhorn@users.noreply.github.com>
|
I don't have access to any Windows machines to verify that |
First, thanks for the bug report and PR. I am quite embarrassed you had to find this problem yourself. Second, I think we do need the example to work on Windows, even if we must caveat the code with "beware, this may be slower". Do you want to take a stab at making the Windows changes too? If you prefer, we can merge the code with a |
|
/gcbrun |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4731 +/- ##
==========================================
- Coverage 95.05% 95.04% -0.02%
==========================================
Files 198 198
Lines 7581 7581
==========================================
- Hits 7206 7205 -1
- Misses 375 376 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Some formatting problems, can you use mdformat on this file: |
|
/gcbrun |
coryan
left a comment
There was a problem hiding this comment.
I will make the fixes for Windows in a second pass.
|
Thanks again for the PR! I made some formatting changes and will fix the code on Windows shortly. |
|
Sorry, I was busy with other things yesterday. Thanks for taking over the Windows part! |
The guide on how to implement striped downloads uses
tokio::fs::Filein a non-thread-safe way by concurrently seeking the file cursor across the different tasks. The downloaded file will usually be messed up as the chunks are written with the wrong cursor position.This PR adds a reference implementation using
pwritefor Unix systems.Towards #4730