4
votes

I'm developing Pipeline in Azure Data Factory V2. It has very simple Copy activity. The Pipeline has to start when a file is added to Azure Data Lake Store Gen 2. In order to do that I have created a Event Trigger attached to ADLS_gen2 on Blob created. Then assigned trigger to pipeline and associate trigger data @triggerBody().fileName to pipeline parameter.

To test this I'm using Azure Storage Explorer and upload file to data lake. The problem is that the trigger in Data Factory is fired twice, resulting pipeline to be started twice. First pipeline run finish as expected and second one stays in processing.

Has anyone faced this issue? I have tried to delete the trigger in DF and create new one but the result was the same with new trigger. enter image description here

enter image description here

2

2 Answers

2
votes

I'm having the same issue myself.

When writing a file to ADLS v2 there is an initial a CreateFile operation and a FlushWithClose operation and they are both triggering a Microsoft.Storage.BlobCreated event type.

https://docs.microsoft.com/en-us/azure/event-grid/event-schema-blob-storage

If you want to ensure that the Microsoft.Storage.BlobCreated event is triggered only when a Block Blob is completely committed, filter the event for the FlushWithClose REST API call. This API call triggers the Microsoft.Storage.BlobCreated event only after data is fully committed to a Block Blob.

https://docs.microsoft.com/en-us/azure/event-grid/how-to-filter-events

You can filter out the CreateFile operation by navigating to Event Subscriptions in the Azure portal and choosing the correct topic type (Storage Accounts) and subscription and location. Once you've done that you should be able to see the trigger and update the filter settings on it. I removed CreateFile.

1
votes

On your Trigger definition, set 'Ignore empty blobs' to Yes.

The comment from @dtape is probably what's happening underneath, and toggling this ignore empty setting on is effectively filtering the Create portion out (but not the data written part).

This fixed the problem for me.