none
Urgent... how to thrink the metadata file. RRS feed

  • Question

  • Hi All,

    Use file sync in one of application to sync to network folders. There're are lot of changes on the folders. One folder will copy files from another folder, and files were deleted after processing. Most of time there're only 5-10 files. But the metadata grows very quickly. After 2 month usage, the size of the metadata was 4MB. How do I remove the some of the information stored in the metadata such as files deleted 10 days ago.

    I had a look at the documentation, it seemed that metadataStore and replicaMetadata can clean up the data.

    Then I tried the following code to clean up, but it failed.. Received MetadataStorageEngineException.... looks like the file cannot be openned for some reason. and the codes was run in beginning of the session before open the filesyncprovider. 

    var metadataStore = SqlMetadataStore.OpenStore(Path.Combine(sourceReplicaRootPath, @"metadata\" + sourceReplicaId + @".metadata"), CultureInfo.CurrentCulture);
    var replicaMetadata = metadataStore.GetReplicaMetadata(sourceFormatGroup, new SyncId(sourceReplicaId));
    replicaMetadata.CleanupDeletedItems(new TimeSpan(1, 0, 0));

    Could anyone give any help please? Any suggestion will be highly appreciated.

    Regards,
    Saturday, July 25, 2009 2:38 PM

Answers

  • Thanks a lot for reply.

    It works with english culture:

    using (var sqlMetadataStore = SqlMetadataStore.OpenStore(filename, CultureInfo.GetCultureInfo(1033)))

    But I've done a quite work around:

    1. Save the metadata file in local folder instead of both local and remote. Because the service is only running locally.
    2. If there's no files to sync, delete the metadata file.

    Monday, July 27, 2009 6:19 AM

All replies

  • Hi -

    Can you copy-paste the entire stack here? Also open the file in English ( 1033) culture instead of current culture. CleanupDeletedItems is the right API to use - be careful to do this only after your system is in a steady state ( everything has been synchronized to everything else and that there are no new changes)

    Thanks
    Deepa
    Deepa ( Microsoft Sync Framework)
    Monday, July 27, 2009 1:26 AM
    Moderator
  • Thanks a lot for reply.

    It works with english culture:

    using (var sqlMetadataStore = SqlMetadataStore.OpenStore(filename, CultureInfo.GetCultureInfo(1033)))

    But I've done a quite work around:

    1. Save the metadata file in local folder instead of both local and remote. Because the service is only running locally.
    2. If there's no files to sync, delete the metadata file.

    Monday, July 27, 2009 6:19 AM
  • Hi -

    If you delete the metadata file - this means that the next time you sync we start afresh and have to o through every single file both locally and remotely. We then will detect conflicts on every single file and will have to resolve this so your sync will be slower the first time after you delete this file. The better thing to do would definitely be to clean up tombstones to reduce the size of your file.

    Thanks
    Deepa
    Deepa ( Microsoft Sync Framework)
    Tuesday, July 28, 2009 7:25 PM
    Moderator