I have a situation where I am copying lots of blobs from one storage container to another and some of the blobs have copied but a lot of them are still pending after two days since I initiated the copy. I am making this determination based on the fact that if I try to do anything with the destination blob I am getting the below error:
Microsoft.WindowsAzure.StorageClient.StorageClientException : There is currently a pending copy operation. ----> System.Net.WebException : The remote server returned an error: (409) Conflict.
Is there anything I can do about this? For example can I abort the copy after the fact?
Here is the copy code I am using to perform the copy.
try
{
destinationBlob.StartCopyFromBlob(
new Uri(sourceBlob.Uri.AbsoluteUri + signature));
System.Diagnostics.Trace.TraceInformation(
"Copying: {0}", destinationEndpoint.EndpointState.BlobName);
}
catch (Exception ex)
{
var we = ex.InnerException as WebException;
if (we != null && we.Status == WebExceptionStatus.ProtocolError)
{
System.Diagnostics.Trace.TraceError(
"conflict with blob copy for blob {0}", sourceBlob.Uri.AbsoluteUri);
return 0;
}
}
As you already know that Copy Blob operation is now asynchronous. Thus when you call StartCopyFromBlob
operation on a blob, Blob Storage Service puts the copy operation in a queue. Since it's an async operation you wouldn't know when it will be processed. From what I understand, that the maximum time for that is 2 weeks 7 days i.e. a copy operation can take a maximum of 2 weeks 7 days and if it is not completed in 2 weeks 7 days, it will be cancelled by the service.
Now coming to your questions:
Is there anything i can do about this?
I don't think so. You can't change the queue priority.
For example can i abort the copy after the fact?
Yes, you can. When you call StartCopyFromBlob
, you get back a string which identifies the copy operation (it's called copy id). You could use this copy id and call AbortCopy
operation on that blob. You could also get this copy id after the fact by fetching blob properties using FetchAttributes
method. The property you would want to inspect is CopyState
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With