Add opt-in append_blob write mode for WASB task logs - #71064
bujjibabukatta 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
aaron-y-chen
left a comment
There was a problem hiding this comment.
Thanks for the contribution! :)
Could you help resolve the conflict before we get into the review process?
|
Hello @bujjibabukatta - thank you for your contributions to Apache Airflow! The Airflow community has introduced a limit of 5 open pull requests at a time for contributors without write access to the repository. You currently have 16 open pull requests, so - as a one-time step of introducing the limit - we closed the ones where maintainers have not engaged yet:
These pull requests stay open because maintainers are already engaged in them - they count towards your limit:
This is not a judgement of you or of your changes. We never told contributors before that opening many pull requests at once was a problem, so there is nothing to feel bad about - and nothing is lost: your branches, commits and the review history stay where they are. What we ask you to do is to make your first prioritization decision: choose which of the pull requests above matter most to you, and reopen them (up to 5 open at a time, including the ones still open) with the "Reopen pull request" button or While your pull requests are waiting for review, the most valuable thing you can do is help in other ways - reviewing other contributors' pull requests, helping with issues, and taking part in the discussions on the devlist and Slack. Why we introduced the limit, what it means for you and how to reopen or restore a pull request is explained in https://github.com/apache/airflow/blob/main/contributing-docs/32_open_pull_request_limit.rst. Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting |
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