Unable to recover deleted file? RRS feed

  • Question

  • Greeting !


    I'm recently working on a project related to sync operations, and tried the file sync example from http://msdn.microsoft.com/en-us/sync/bb887623.aspx, but got several questions.


    Let's say the source replica is A (with content), destination one is B(initially empty).


    After the first invokation of application, content of A would be sync to B.

    But if I delete one file from B and call sync again. The deleted file in B won't be recovered from A, even the file in A would be deleted.

    That's quite strange to me after I read the code. The A-->B sync took place before the B-->A sync, and it supposed to recover the deleted in B in the A-->B sync, isn't it?


    I did another test, comment out the statement for B-->A sync like below,


          SyncFileSystemReplicasOneWay(replica1Id, replica2Id, replica1RootPath, replica2RootPath, filter, options);
          //SyncFileSystemReplicasOneWay(replica2Id, replica1Id, replica2RootPath, replica1RootPath, filter, options);


    and the result is the same, deleted file in B won't be recovered.


    In my project I need the feature to recover the deleted file(folder) from source replica, how can I achieve this by using sync framework? Did I miss some configuration before the SyncFileSystemReplicasOneWay() call?



    • Moved by Max Wang_1983 Thursday, April 21, 2011 9:41 PM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Monday, September 22, 2008 11:52 AM


  • Hi -


    At the end of the first sync after A and B have the same content ( and before any deletions have been made) - both sides are completely synchronized. Then a deletion is done - this is the only change made between the two replicas. So we look at changes - we know that the deletion is the only that should be synchronized. This is how synchronization works.


    From what you describe above - it looks more like you want a replication scenario. File content on both sides need to be the same. The FSP sends out OnApplyingChanges event on every file before it actually does it ( and this will tell you if this is a create/update/delete/rename. You can filter out deletes here by setting the SkipChange to true on the event args. This of course will only take care that the delete does not happen - on the A side.


    To make the file from A flow back to B - you need to make a change to A or appear to do so by "touching" the file on A. Depending on how your app is written you can use the relative path of the file sent on the OnApplyingChange to figure out what the file on A is and touch the file on A by changing the LastModificationTime. This should ensure that on a subsequent sync the file will reappera.


    Thursday, September 25, 2008 6:30 PM