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

[QUERY] Understanding copy status when blob is deleted after (?during) async copy operation within same storage account #46385

Open
potomato opened this issue Oct 1, 2024 · 1 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 Workflow: 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 Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)

Comments

@potomato
Copy link

potomato commented Oct 1, 2024

Library name and version

Azure.Storage.Blobs 12.21.2

Query/Question

Hi,

We are copying blobs from one container to another within the same storage account, as we would like it to be an atomic operation (we use Event Hub to push the Blob Created message to a storage queue which is consumed by an Azure function to process the blob).

We are using this code:

var blobServiceClient = new BlobServiceClient(connectionString);
var sourceBlobContainerClient = blobServiceClient.GetBlobContainerClient(fileDetails.TemporaryContainerName);
var sourceBlobClient = sourceBlobContainerClient.GetBlobClient(fileDetails.FileName);
var destBlobContainerClient = blobServiceClient.GetBlobContainerClient(fileDetails.ContainerName);
var destBlobClient = destBlobContainerClient.GetBlobClient(fileDetails.FileName);

var status = await destBlobClient.StartCopyFromUriAsync(sourceBlobClient.Uri);
await status.WaitForCompletionAsync();

We are finding that the blob is collected and deleted before the final WaitForCompletionAsync, so this receives 404 and throws an exception. This isn't wrong but makes it hard to understand what has happened. Did the copy complete successfully?

These are the sanitised blob storage logs:
3:04:05.424 PM,Writer,/storageaccount/tempcontainer/blobname,PutBlob,201,Success
3:04:05.435 PM,Writer,/storageaccount/finalcontainer/blobname,CopyBlob,202,Success
3:04:05.435 PM,Writer,https://storageaccount.blob.core.windows.net/tempcontainer/blobname,CopyBlobSource,202,Success
3:04:05.435 PM,Writer,/storageaccount/finalcontainer/blobname,CopyBlobDestination,202,Success
3:04:05.707 PM,Consumer,/storageaccount/finalcontainer/blobname,GetBlobProperties,200,Success
3:04:05.712 PM,Consumer,/storageaccount/finalcontainer/blobname,GetBlobProperties,200,Success
3:04:05.719 PM,Consumer,/storageaccount/finalcontainer/blobname,GetBlob,200,Success
3:04:05.770 PM,Consumer,/storageaccount/finalcontainer/blobname,GetBlobProperties,200,Success
3:04:05.777 PM,Consumer,/storageaccount/finalcontainer/blobname,GetBlob,200,Success
3:04:05.823 PM,Consumer,/storageaccount/finalcontainer/blobname,GetBlobProperties,200,Success
3:04:05.828 PM,Consumer,/storageaccount/finalcontainer/blobname,DeleteBlob,202,Success
3:04:06.405 PM,Writer,/storageaccount/finalcontainer/blobname,GetBlobProperties,404,BlobNotFound

The last two lines show the consumer deleting the blob before the writer has done its final check as part of WaitForCompletionAsync.

How do I interpret this in my client code? Does a 404 in WaitForCompletionAsync guarantee that the copy completed successfully and that the file was subsequently deleted?
If not how do I tell the difference between this condition and 'some other error condition where the blob disappeared'.

Environment

Azure Function, Isolated model on .net 8

@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 Workflow: 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 Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files) labels Oct 1, 2024
Copy link

github-actions bot commented Oct 1, 2024

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

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 Workflow: 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 Workflow: 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