Using Sitecore 9.0.1 and DEF 2.0.1, I have a pipeline which reads from an API and then resolves matching Sitecore items using the standard ResolveSitecoreItemStepProcessor and ResolveSitecoreItemStepConverter
Locally, this works fine, and if the Sitecore item exists, it is updated rather than a new one created. On our server, duplicate records are created intermittently when the pipeline is run. The issue appears to happen more often when importing large data sets of 1000 records and then sometimes, only for the last 500 records.
ManagedPoolThread #7 05:41:46 DEBUG [Data Exchange] Value converted for search. (pipeline: Experience from Source to Item Sync Pipeline, pipeline step: Resolve Experience Item, pipeline step identifier: 4b865ee9-78f5-49fe-a34e-b595d5d8b426, field: Uuid, original value: a109b95a-8135-4335-a20d-7edef2321a56, converted value: a109b95a-8135-4335-a20d-7edef2321a56)
ManagedPoolThread #7 05:41:46 DEBUG [Data Exchange] Starting search for item. (pipeline: Experience from Source to Item Sync Pipeline, pipeline step: Resolve Experience Item, pipeline step identifier: 4b865ee9-78f5-49fe-a34e-b595d5d8b426, field: Uuid, value: a109b95a-8135-4335-a20d-7edef2321a56)
i.e. ResolveSitecoreItemStepProcessor is searching for an item with a Uuid (our custom field) of { a109b95a-8135-4335-a20d-7edef2321a56}.
We've decompiled ResolveSitecoreItemStepProcessor and added our own debug. From that, we can see that the search isn't able to find the item in the index even when it exists. Also, when we have a duplicate, if we search in the Content Editor for some content which is duplicated across duplicate items, only one result is found until we re-index via the index manager. It therefore seems to be an indexing issue.
"Iterate Rows from Source and Run Pipeline" in turn calls the " Experience from Source to Item Sync Pipeline" pipeline. We added the "Rebuild Index Pipeline" step to try to address this issue but we still get this issue ..
We are considering a number of approaches to fix this including 1) Using our own implementation of ResolveSitecoreItemStepProcessor that doesn't use the index but looks at the Sitecore tree (might be complex and have unforseen consequences) 2) Batching the import into smaller chunks (of say 100 records) as this happens only with large data sets 3) Possibility of turning off indexing during an import (needs research)
Ideally, we would identify the root cause of this issue, rather than one of these workarounds ..
Sitecore.Configuration.Settings.Indexing.Enabled = false;