none
What might be causing this error - "The simple provider found an item in the metadata store with the same identity fields as the current item." RRS feed

  • Question

  • I am performing a one-way synchronisation from a source replica using a FileSyncProvider to a custom class deriving from FullEnumerationSimpleSyncProvider which uses IsolatedFileStorage as a storage mechanism. The error occurs when I run the synchronisation for a second time, after it has copied a single file from the source replica to the destination replica. I'm not sure how to find out what could be causing this error and which provider's metadata store it refers to.
    Thursday, May 6, 2010 12:31 PM

Answers

  • Please check whether you are reusing the same metadata store for the SimpleSyncProvider, this metadata store should be created and initialized once likely in first sync, then later sync should not recreate a new one.

    If it's reused, you can look into the metadata store on the fileSyncProvider side (a hidden file called metdataFSP.Harmonica) and simpeSyncProvider side. You can copy the FSP metadata store and also simple provider metadata store to a different directory and open with Sqlserver management studio (SSMS)

    Compare the items in both the metadata stores , after the initial sync, you should see 2 sides have same number of items and with same global item id.

     

    Friday, May 7, 2010 5:37 PM
    Answerer
  • It turns that we were generating a new Replica ID for the FileSyncProvider each time a synchronisation was run. Using the same Replica ID each time appears to be the solution. Many thanks.

    • Marked as answer by tjrobinson Tuesday, May 11, 2010 12:05 PM
    Tuesday, May 11, 2010 12:05 PM

All replies

  • Some investigation needs to be done for the implementation:

    When the first time the file is synced to the SimpleSyncProvider, a InsertItem is called and you will return the file item properties such as primary key, for example, relative path.

    When a second sync is started, the SimpleSyncProvider's EnumerateItems will be called, please check in this call, the last inserted file will be reported with the right file item properties including the primary key.

    If on the file sync provider side, the file is updated again, on the SimpleSyncProvider side, an UpdateItem should be called instead of a new InsertItem for the same file. If it's not updated, there shouldn't be any call on SimpleProvider side for the same file.

    Thursday, May 6, 2010 5:15 PM
    Answerer
  • InsertItem is being called again on the second synchronisation, even though the file uploaded by the first synchronisation is being listed by the SimpleSyncProvider's EnumerateItems() call. The filename (key) is as I would expect it to be. I am calling context.ReportItems() with a List<ItemFieldDictionary> at the end of the overridden EnumerateItems() method.

    I will keep investigating but any further suggestions would be much appreciated.

    Friday, May 7, 2010 12:38 PM
  • Please check whether you are reusing the same metadata store for the SimpleSyncProvider, this metadata store should be created and initialized once likely in first sync, then later sync should not recreate a new one.

    If it's reused, you can look into the metadata store on the fileSyncProvider side (a hidden file called metdataFSP.Harmonica) and simpeSyncProvider side. You can copy the FSP metadata store and also simple provider metadata store to a different directory and open with Sqlserver management studio (SSMS)

    Compare the items in both the metadata stores , after the initial sync, you should see 2 sides have same number of items and with same global item id.

     

    Friday, May 7, 2010 5:37 PM
    Answerer
  • It turns that we were generating a new Replica ID for the FileSyncProvider each time a synchronisation was run. Using the same Replica ID each time appears to be the solution. Many thanks.

    • Marked as answer by tjrobinson Tuesday, May 11, 2010 12:05 PM
    Tuesday, May 11, 2010 12:05 PM
  • Wednesday, June 9, 2010 2:18 PM