none
What algorithm is used if FileSyncOptions.CompareFileStreams is not set? RRS feed

  • Question

  • According to the documentation for Microsoft.Synchronisation.Files.FileSyncOptions, if the FileSyncOptions.CompareFileStreams flag is not set "an algorithm that compares modification times, file sizes, file names, and file attributes will be used to determine whether a file has changed".

    Can you explain this algorithm in more detail? Specifically the importance of attributes.

    Thanks, this will help me to understand how the Sync Framework works so I can diagnose an issue.
    Friday, October 22, 2010 3:57 PM

Answers

  • File Sync provider detects changes for below file attributes today:

    FILE_ATTRIBUTE_DIRECTORY

    FILE_ATTRIBUTE_READONLY

    FILE_ATTRIBUTE_HIDDEN

    FILE_ATTRIBUTE_SYSTEM

    FILE_ATTRIBUTE_TEMPORARY

     

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    • Marked as answer by tjrobinson Tuesday, October 26, 2010 1:06 PM
    Monday, October 25, 2010 9:50 PM
    Moderator

All replies

  • CompareFileStreams computes hashvalue of physical file and compares against previous value to determine whether file has actually changed.

    If this CompareFileStreams is not used, change detection will depend on changes in the file attributes: modification times, file sizes, file names, and file attributes.

    The former is more accurate as change detection does not solely rely on the metadata, but it has performance cost as hash calculation for a large file, as you can imagine, is probably costly.

    Hope this helps,

    Patrick

    Friday, October 22, 2010 6:31 PM
  • Thanks, I was really wondering if there was any information about how the various inputs (modification times, file sizes, file names, and file attributes) are used internally. I am concerned about the I Not content-indexed attribute as it appears that this is changed/set by the operating system if I download a file into my local filesystem for a remote store (via. the Sync Framework). I want to be sure that this isn't causing it to appear to have been altered as far as the Sync Framework is concerned.
    Monday, October 25, 2010 12:25 PM
  • Hi,

    MSDN has a section to describe the details of "Detecting File Changes" - http://msdn.microsoft.com/en-us/library/bb902836.aspx. It should contain all the information that we used internally.

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Monday, October 25, 2010 7:33 PM
    Moderator
  • Thanks, though the documentation mentions that the Sync Framework checks "Any of the file attributes that are handled by the provider" - to me this could suggest that not all file attributes are used by the algorithm?
    Monday, October 25, 2010 8:43 PM
  • File Sync provider detects changes for below file attributes today:

    FILE_ATTRIBUTE_DIRECTORY

    FILE_ATTRIBUTE_READONLY

    FILE_ATTRIBUTE_HIDDEN

    FILE_ATTRIBUTE_SYSTEM

    FILE_ATTRIBUTE_TEMPORARY

     

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    • Marked as answer by tjrobinson Tuesday, October 26, 2010 1:06 PM
    Monday, October 25, 2010 9:50 PM
    Moderator