sp_mergemetadataretentioncleanup - To Use Or Not To Use?

  • I have around 4k mobile merge subscribers to two publications, one of which makes many changes. This system has been working well for over two years, but I noticed today that the row counts of the merge system tables seem high:

    msmerge_genhistory: 156k

    _contents: 763k

    _tombstone: 885k

    _past_partition: 865k

    _current_partition: 747k

    I see the default merge agent profile uses a value of -MetadataRetentionCleanup = 0, but I'm looking into whether this profile is being over-riden by the programming on the subscribers.

    Anyway, I've read differing opinions as to whether you can run sp_mergemetadataretentioncleanup manually...What do you think?

    Thanks!

  • I run it weekly in order to keep the metadata under control (generate 8M+ contents rows per week).

    I keep retention period long by default and simply shorten it while I run the cleanup.

    Only caveat is that you must have all servers in your topology up at the time of cleanup and run the cleanup on the subscribers first.

    That is to avoid the error "The Merge Agent failed after detecting that retention-based metadata cleanup has deleted metadata at the Publisher for changes not yet sent to the Subscriber. You must reinitialize the subscription (without upload)."

  • The subscribers are mobile Windows CE devices...That sync at different times. I cannot run this proc on the devices....

    I cannot risk a re-init...Are you sure about that statement?

  • In the case of mobile devices, i am not sure what the best strategy is.

    How is the metadata situation on the devices?

    Google that error message. There are ways to recover without reinit. you simply clear a flag in the subscriptions table.

    But you must be sure that all devices have received all data that is being cleaned up, and I am not sure how you can accomplish that.

    If you have a Microsoft TAM, this would be good question to ask.

  • Hello,

    I am looking to run this as well, are you saying that sp_mergemetadataretentioncleanup needs to be run on the subscriber first and then the publisher to avoid any issues?

    You mentioned you shortened the retention period first, is this a must do? Does it not clean up much (or anything ) if this is not done first?

    Regards,

    D.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply