After restoring Team Project Collection database from a backup, TFS VersionControl download returns incorrect files


Symptoms


 

After restoring a Team Project Collection (TPC) from a backup, files downloaded from Team Foundation Server through version control operations may have incorrect contents.

Cause


To improve download performance for files in version control, the TFS application tier (AT) utilizes a file cache for files retrieved from the data tier (DT).  Any time files are cached on the AT, they are identified by a FileID that is supplied to new files at check-in time.  In the event of a TPC restore, it is possible that files added since the last backup was taken will be cached on the AT with a FileID that was assigned between the time backup was taken and the restore was applied.  If the version control cache was not purged prior to the TPC restore, FileIDs that were reassigned to new files may result in false positive cache-hits, leading to the download of incorrect file contents.

Resolution


After any restoration of a TFS database (i.e. TPC restore, TPC Move), the administrator will need to purge the version control file cache on all TFS ATs and all TFS proxy servers that service the TFS instance prior to putting the TPC back online.

For each application tier and each proxy server, the administrator needs to do the following to purge the cache:

1.       Log on to the AT machine.

2.       Navigate to the cache folder (the default is C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Services\_tfs_data\%tfsInstanceGuid%\Proxy

a.       If you do not know the GUID for the TPC, just purge everything under the _tfs_data folder.

 

Important: If the cache for every AT and proxy is not purged prior to restoration, it is possible that some users will continue to experience the symptoms above.