Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Synchronous copy of blobs within the same Azure storage account is not working #556

Open
arti-shinde opened this issue Dec 29, 2020 · 0 comments

Comments

@arti-shinde
Copy link

arti-shinde commented Dec 29, 2020

Which service(blob, file, queue, table) does this issue concern?

blob

Which version of the SDK was used?

azure-storage java sdk version 8.6.5

What problem was encountered?

Copy with sync using startCopy API is not working across or within same container within the same storage account. If I use the other API without sync, copy works fine - Here is the sample code:-

import java.net.URISyntaxException;
import com.microsoft.azure.storage.*;
import com.microsoft.azure.storage.blob.CloudBlobClient;
import com.microsoft.azure.storage.blob.CloudBlobContainer;
import com.microsoft.azure.storage.blob.CloudBlockBlob;

public class testAzure {

	public static void main(String[] args) throws URISyntaxException, StorageException {
        String accountname = "---";
        String accountkey = "--";
        String containername = "container02";
        String source_blobname = "test1.txt";
        String sink_blobname = "test2.txt";
        StorageCredentials credentials = new StorageCredentialsAccountAndKey(accountname,accountkey);
        CloudStorageAccount account = new CloudStorageAccount(credentials);
        CloudBlobClient client = account.createCloudBlobClient();

        CloudBlobContainer container = client.getContainerReference(containername);;
        CloudBlockBlob source_cbb = container.getBlockBlobReference(source_blobname);
        CloudBlockBlob sink_cbb = container.getBlockBlobReference(sink_blobname);
        //sink_cbb.startCopy(source_cbb); //This works
        sink_cbb.startCopy(source_cbb,source_cbb.getProperties().getContentMD5(),true,null,null,null,null);
	}
}		

The above is giving the following exception :


[17:25:42.976] - [STDERR] com.microsoft.azure.storage.StorageException: The specified resource does not exist.
[17:25:42.977] - [STDERR]   at com.microsoft.azure.storage.StorageException.translateException(StorageException.java:87)
[17:25:42.977] - [STDERR]   at com.microsoft.azure.storage.core.StorageRequest.materializeException(StorageRequest.java:305)
[17:25:42.977] - [STDERR]   at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:196)
[17:25:42.978] - [STDERR]   at com.microsoft.azure.storage.blob.CloudBlob.startCopy(CloudBlob.java:791)
[17:25:42.978] - [STDERR]   at com.microsoft.azure.storage.blob.CloudBlockBlob.startCopy(CloudBlockBlob.java:302)
[17:25:42.978] - [STDERR]   at com.microsoft.azure.storage.blob.CloudBlockBlob.startCopy(CloudBlockBlob.java:252)

Have you found a mitigation/solution?

No

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant