Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQ] OpenWriteAsync to leave existing blob content alone until Flush() is called on the stream #43242

Open
danielearwicker opened this issue Apr 5, 2024 · 2 comments
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)

Comments

@danielearwicker
Copy link

Library name

Azure.Storage.Blobs

Please describe the feature.

BlockBlobClient's OpenWriteInternal method returns BlockBlobWriteStream. This stages blocks and adds their IDs to a list _blockIds.

The CommitInternal method actually commits the blocks to become the new content of the blob. I only see one call to that, from FlushInternal, which is called from Flush and FlushAsync.

This seems excellent because it suggests I can attempt to write an updated version to the same blob name, and if there is a failure part way through so I never call Flush, the blocks will be abandoned and the previous version of the blob's contents are unharmed.

However, before returning the BlockBlobWriteStream, the OpenWriteInternal does something mystifying!:

// Create Block Blob
await UploadInternal(
    content: new MemoryStream(Array.Empty<byte>()),
    ...

That is, it immediately truncates the blob, destroying its current contents before anything to replace it has been sent.

Is this necessary? Is it possible to add a switch to BlockBlobOpenWriteOptions to make it not do that?

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files) labels Apr 5, 2024
Copy link

github-actions bot commented Apr 5, 2024

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

@danielearwicker
Copy link
Author

Wondering whether this question has reached the appropriate team! 🛩️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

1 participant