Add opt-in append_blob write mode for WASB task logs - #71064
Add opt-in append_blob write mode for WASB task logs#71064bujjibabukatta wants to merge 8 commits into
Conversation
45b9297 to
7b8e86a
Compare
7b8e86a to
3aa6d40
Compare
|
Thanks for picking this up. Nice to see it go straight to One thing I think is worth handling before this lands: the chunk loop can leave a lifecycle partially applied, and nothing records how much of it landed. Take a segment larger than the 4 MiB block limit, say 10 MiB split into A1, A2, A3:
The blob now holds A1, while the local file still holds A1+A2+A3. On the next upload to the same key,
It needs a second upload against the same key to surface, so in practice a deferrable resume or a reschedule poke whose individual lifecycle writes more than 4 MiB. Rare, but it is the same class of duplication that #70860 just fixed, which is why I thought it worth raising. The awkward part is that
Drafted-by: Claude Code (Opus 5); reviewed by @bmanan7 before posting |
|
Hi @bmanan7 — good catch. Went with your second option: _write_append_blob |
ae0435f to
07137f8
Compare
Summary
WASB task logs are rewritten from scratch on every upload -- the whole
existing blob is downloaded, the new segment appended in memory, and the
full result re-uploaded. For a long-running task this means O(N^2) traffic
across N log writes instead of O(N).
Root cause
WasbRemoteLogIO.write() always calls hook.load_string(..., overwrite=True),
which replaces the entire blob object regardless of how much of it is
actually new.
Fix
Added an opt-in write_mode="append_blob" that uses Azure's native AppendBlob
API (append_block() with a position guard) to append only the new segment,
instead of rewriting the whole object. Falls back to the existing
block-blob rewrite path for any blob already written as a block blob, since
Azure doesn't support converting a blob's type in place. Segments over the
4 MiB per-block limit are chunked automatically, and a concurrent-writer
position mismatch fails safely rather than writing at the wrong offset.
closes: #70867
Was generative AI tooling used ?
Generated-by: Claude following the guidelines