Copy activity failed because you have multiple concurrent copy activities runs writing to the same file

Magarde, A (Ankit) 0 Reputation points
2024-10-24T11:00:55.3666667+00:00

Hi All,

 

I am migrating 1000 of SQL tables from on premise SQL server to Azure Blob storage. I am using ADF for each and copy activity to do so. However, while processing the tables in parallel/concurrent, I am getting below error -  

 

Failure happened on 'Sink' side. ErrorCode=AdlsGen2OperationFailedConcurrentWrite,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Error occurred when trying to upload a file. It's possible because you have multiple concurrent copy activities runs writing to the same file '<<filepath>>.parquet'. Check your ADF configuration.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=Microsoft.Azure.Storage.Data.Models.ErrorSchemaException,Message=Operation returned an invalid status code 'PreconditionFailed',Source=Microsoft.DataTransfer.ClientLibrary,'

User's image

 

Note - I am using max concurrent connection at sink as 1 and still i am getting above error.

Azure Database Migration service
Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,307 questions
Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,491 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,934 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,873 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AnnuKumari-MSFT 33,476 Reputation points Microsoft Employee
    2024-10-24T11:44:29.8633333+00:00

    Hi Magarde, A (Ankit) ,

    Welcome to Microsoft Q&A platform and thanks for posting your query here.

    It seems like you are encountering an error when using Azure Data Factory to copy SQL tables from an on-premises SQL Server to Azure Blob Storage. The error code "AdlsGen2OperationFailedConcurrentWrite" indicates that there is a problem with concurrent writes to the same file in Azure Blob Storage.

    The error you are encountering occurs when multiple concurrent activities attempt to write to the same file in Azure Data Lake Storage Gen2 (ADLS Gen2). Even though you've set the max concurrent connections to 1, the issue can still arise due to:

    • Multiple copy activities targeting the same file path concurrently.
    • Overlapping pipeline executions (manual or by trigger run)
    1. Ensure Unique File Names for Each Copy Activity . You can include timestamps or GUIDs in the file name to ensure uniqueness . Example: table_name_@{formatDateTime(utcnow(),'yyyyMMddHHmmss')}.parquet
    2. Disable Parallel Execution by setting Sequential option to Truewithin ForEach activity.
    3. Check if there is any overlapping pipeline runs/trigger runs.

    Hope it helps. Kindly let us know how it goes. Thankyou.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.