locked
ConflictType : ErrorsOccured RRS feed

  • Question

  • Dear all,

    first let's give you some infos :

    • Synchronization is between a Windows Mobile 6.5 device (running SQL CE) and a Windows Server 2008 R2 with SQL Express
    • Synchronization is encapsulated in a WCF (basichttpbinding, no encryption at this time) service.
    • On the same database table, called "orders", I have 1 huge problem and 1 issue. The primary key on the table is a GUID. There are some others fields.
    • Sync Framework is 2.1

    1. I often have a conflict type, called : ClientInsertServerInsert. But for the line I have the conflict, the line is only inserted on the mobile database. More than that, the synchronisation direction is "Upload Only". It works the line is well inserted, but if someone has an explanation to help me understand why such a conflict type is raised. For me, there is no conflict. The line is not on the server size.

    2. The real problem is the following : often, I get a "ErrorOccurs" conflict. I don't know why, I don't know how to debug. I wasn't able to find a difference between a line that is inserted well and a line that get an ErrorOccurs. How can I debug this ?

    Here is an example of a log file (on the server side) I produced to try to understand :

    >>This order is OK

    11/10/2011 18:03:58 : *** Starting ORDER resolution
    11/10/2011 18:03:58 :  Conflict Type : ClientInsertServerInsert
    11/10/2011 18:03:58 :    Id = b673701a-1835-4f46-9f32-5e0b8d911517

    >>This order is not OK


    11/10/2011 18:03:58 : Conflict detection on TableName : Order
    11/10/2011 18:03:58 : *** Starting ORDER resolution
    11/10/2011 18:03:58 :  Conflict Type : ErrorsOccurred
    11/10/2011 18:03:58 :    Id = 39253c16-4eef-4b3f-8456-c0d633c82901
    11/10/2011 18:03:58 :    CardSerial = F44FC62D
    11/10/2011 18:03:58 :    MobileId = 3
    11/10/2011 18:03:58 :    PlaceId = 4
    11/10/2011 18:03:58 :    SellerMatricule = 06
    11/10/2011 18:03:58 :    Date = 11/10/2011 15:04:58
    11/10/2011 18:03:58 :    Old Money = 0,00
    11/10/2011 18:03:58 :    New Money = 0,00
    11/10/2011 18:03:58 :    Old Fidelity = 0
    11/10/2011 18:03:58 :    New Fidelity = 0

    >> this order is not OK


    11/10/2011 18:03:58 : Conflict detection on TableName : Order
    11/10/2011 18:03:58 : *** Starting ORDER resolution
    11/10/2011 18:03:58 :  Conflict Type : ErrorsOccurred
    11/10/2011 18:03:58 :    Id = f99d4743-2800-4153-a398-ec8ea382fd08
    11/10/2011 18:03:58 :    CardSerial = F44FC62D
    11/10/2011 18:03:58 :    MobileId = 3
    11/10/2011 18:03:58 :    PlaceId = 4
    11/10/2011 18:03:58 :    SellerMatricule = 06
    11/10/2011 18:03:58 :    Date = 11/10/2011 15:05:01
    11/10/2011 18:03:58 :    Old Money = 0,00
    11/10/2011 18:03:58 :    New Money = 10,00
    11/10/2011 18:03:58 :    Old Fidelity = 0
    11/10/2011 18:03:58 :    New Fidelity = 0

    I'm lost !! I don't know how to advance now ...

     

    If someone can help or give me a track to understand,  it will be great.

     

    Sylvain

    Wednesday, October 12, 2011 9:22 AM

Answers

  • Thanks a lot.

     

    After some tests, the problem is the foreign key. For now, I removed it, it's not a big deal to finalize my test.

     

     

    • Marked as answer by Sylvain_D Wednesday, October 12, 2011 12:30 PM
    Wednesday, October 12, 2011 12:30 PM

All replies

  • subscribe to the ApplyChangeFailed event in the remote provider so you get details on the error.

    the conflict ClientInsertServerInsert is actually a bit misleading as it could mean there is indeed an insert conflict or there was an error trying to apply the Insert.

    Wednesday, October 12, 2011 9:37 AM
  • How can I subscribe on the remote provider ? As I'm using a WCF, I don't have to possibility to get the event.

    Here's my code at mobile level (remote side) :

    SyncService.CS_LocalDbSyncService syncService = new SyncService.CS_LocalDbSyncService();
                                   //Proxy
                    Microsoft.Synchronization.Data.ServerSyncProviderProxy serverProxy = new Microsoft.Synchronization.Data.ServerSyncProviderProxy(syncService);
                    //Sync Agent
                    _syncAgent = new CS_LocalDbSyncAgent(Config.DbCONNECTIONSTRING);
                  
                    _syncAgent.RemoteProvider = serverProxy;
    SyncStatistics stats = _syncAgent.Synchronize();
    

    Thanks
    Wednesday, October 12, 2011 9:49 AM
  • I think I found something.

    In the table "order", I have a external foreign key to another table called "card".

    I remarked that the order that are not synchronized are always linked to also a new "card" in the table "card".

    I think the problem could come from the fact that my table "order" is synchronized before the table "card". So when the sync service try to add the "order", it cannot find the link with the "card" which is not synchronized.

    Two solutions :

    1. I remove the foreign key to the "card" table in my server DB

    2. I'm able to first sync the "card" table and then the "order" table

    Any idea ?

    I'm still interesting by the answer of the previous post if there is one.

     

    Sylvain

    Wednesday, October 12, 2011 10:08 AM
  • if you have foreign key dependencies, make sure you add the parent/referenced table first before the tables referencing it.

    as for the ApplyChangeFailed event, you cant subscribed to it from your client app as you client app only holds a proxy to the provider on the WCF side.

    you will have to do the checking of the ApplyChangeFailed event on the WCF service side.


    • Edited by JuneT Wednesday, October 12, 2011 12:33 PM
    Wednesday, October 12, 2011 12:10 PM
  • Thanks a lot.

     

    After some tests, the problem is the foreign key. For now, I removed it, it's not a big deal to finalize my test.

     

     

    • Marked as answer by Sylvain_D Wednesday, October 12, 2011 12:30 PM
    Wednesday, October 12, 2011 12:30 PM