Deepak Kumar Mishra, Support Engineer, EMEA TFS Team, brings this knowledge experience while working with one of his customers and had discussions with US Escalations and this information was really recommended to be published as an important piece of information which might help a lot of users .
Recently I was working on a case which was for version control data corruption in TFS. On checking the issue I found that few files in tfs were showing incorrect data which did not match the previous versions of the file in any way (the contents of the file looked to be xml tags but actually it was a .cs file). While doing a get operation on the file we got the error as shown in Screenshot 1. On checking the results for annotate as shown in the below screenshot 2 , it did not show the actual changes in the files done by all users instead it showed only one user who did all the changes and so user felt that they have lost data and some data has got corrupted. On digging deeper in to the issue I came to know that user did a tfs server rollback after TFS upgrade failed and after that they were facing this issue.
Screenshot 1: Get operation for a specific file
Screenshot 2: Annotate operation for a specific file
So one thing was clear that the failed upgrade is what transpired such an issue in customer environment. On checking further I found that this is not actually a case of version control data corruption in tfs database, this was due to the tfs server cache corruption due to the rollback which was done in this case. Each application tier in TFS maintains a file cache to help users download their files faster.
Users can get such issues due to some of the following reasons:
- In case of an upgrade roll back as is mentioned here
- After a recent tfs upgrade
- After getting back tfs server up and running after a tfs server crash
So Users need not panic in such cases as it’s a case of Tfs server cache corruption as mentioned above. Please find the safe and effective solution in such situations:
- Go to \%programfiles%\Microsoft Team Foundation Server <version installed>\Application Tier\Web Services\_tfs_data
- Rename the folder inside _tfs_data something like Old data or delete it
- Do an iisreset from admin command prompt.
- Then check for the files which were having issues. By now they should work fine.