locked
Please help. How to clean up metadata for filesyncprovider. 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,
    Sunday, July 26, 2009 9:38 AM

Answers

  • It works with english culture:

    using (var sqlMetadataStore = SqlMetadataStore.OpenStore(filename, CultureInfo.GetCultureInfo(1033)))
    Monday, July 27, 2009 6:21 AM