Answered by:
SyncFX 2.1 _tracking Table Cleanup

Question
-
I've provisioned a scope in a SQL Server 2008 database. Provisioning creates a number of _tracking tables that now have thousands of records, which were created during my testing. The records have aged over a week, and it has me wondering if there is something in the Sync Framework that will monitor these tables and clean them up or if I need to write something to do this on my database.
I haven't come across any discussion on this yet, and am really hoping for something similar to what SQL Change Tracking (CT) will provide. Any advice would be appreciated.
Thank you,
Jeff
JeffGWMWednesday, December 29, 2010 5:46 PM
Answers
-
Sync framework will not do the cleanup automatically. Deprovision needs to be done explicitly by user application because deprovision a sync scope will remove all the sync metadata for that scope, though leaving other shared stuff not touched if you have other sync scopes for the table or in the database. You can even deprovision the entire database then all sync metadata (for all sync scopes) in that database will be removed.
If a scope is deprovisioned then you won't be able to sync again for that scope. Later if you need, you can reprovision to set up the sync.
If you just want to cleanup the deleted records which are tracked by Sync framework, you can consider Tombstone cleanup feature http://msdn.microsoft.com/en-us/library/ee617373(v=SQL.110).aspx
- Marked as answer by JeffGWM Friday, December 31, 2010 7:12 PM
Thursday, December 30, 2010 6:11 PMAnswerer
All replies
-
Which version of sync framework and database provider are you using?
if you are using Sync Framework 2.1 SqlSyncProvider, there is a deprovisiong functionality you can use to clean up the tracking tables, actually all sync metadata. if you are using Sync 2.0, you can upgrade to 2.1 and use the 2.1 deprovision.- Proposed as answer by jigu2014Microsoft employee, Editor Wednesday, December 29, 2010 7:44 PM
Wednesday, December 29, 2010 6:31 PMAnswerer -
I'm looking at this from a maintenance perspective. Throughout the life of this application, will Sync Framework 2.1 clear these _tracking tables of old records, or is that something I need to handle outside the framework?
JeffGWMWednesday, December 29, 2010 8:31 PM -
Sync framework will not do the cleanup automatically. Deprovision needs to be done explicitly by user application because deprovision a sync scope will remove all the sync metadata for that scope, though leaving other shared stuff not touched if you have other sync scopes for the table or in the database. You can even deprovision the entire database then all sync metadata (for all sync scopes) in that database will be removed.
If a scope is deprovisioned then you won't be able to sync again for that scope. Later if you need, you can reprovision to set up the sync.
If you just want to cleanup the deleted records which are tracked by Sync framework, you can consider Tombstone cleanup feature http://msdn.microsoft.com/en-us/library/ee617373(v=SQL.110).aspx
- Marked as answer by JeffGWM Friday, December 31, 2010 7:12 PM
Thursday, December 30, 2010 6:11 PMAnswerer -
Deprovisioning the Framework doesn't seem like an appropriate strategy unless I am missing something.
From what I am understanding, once Sync Framework is provisioned on a database, the _tracking tables will continue to fill and it is up to the developer to provide a mechanism to purge these tables of stale records.
It would be beneficial if the Framework had a way of doing this.
JeffGWMThursday, December 30, 2010 9:50 PM -
Please provide more details about "the _tracking tables will continue to fill "? Maybe I misunderstood part of your questions.
If you have a table of 500 records, you will normally have 500 track records for existing rows in tracking table and those are fixed. These records can not be cleaned up if you want to keep syncing.
The only records which may keep growing are the deleted records (or called tombstones), which you can cleanup with the tombstone cleanup feature mentioned above.
Thanks.
Friday, December 31, 2010 6:17 PMAnswerer -
I did not read the entire message from your 12/30 post. It is the tombstone cleanup that I am concerned with and your last paragraph is exactly what I was looking for.
Thank you Jin.
JeffGWMFriday, December 31, 2010 7:12 PM