1

We have TFS Version 15.105.27412.0 installed on a server (Server A) and have it configured to point at our database server (Server B).

We have the two TFS databases (tfs_defaultcollection and tfs_configuration) on ServerB and they are mirrored with ServerC, however the connection string in the configuration manager for TFS is not "mirroring aware" - see screenshot below from TFS Administration Console

image

Furthermore, if I interrogate the TFS configuration database as follows

SELECT * FROM Tfs_configuration.dbo.tbl_Database

This confirms the connection strings for both databases do not have failover partners specified.

enter image description here

We had a planned failover this morning from ServerB to ServerC which included both of the TFS databases and much to everyone's surprise, TFS continued to function with the databases failover and running on ServerC.

I stopped the SQL Server service on ServerB and ran an ExtendedEvents session on ServerC (looking for queries that accessed the TFS databases) and can confirm that the TFS application was indeed querying ServerC.

How did this happen? The TFS installation has no idea that ServerC exists, is something happening at the SQL Server level?

  • Are you sure TFS was really getting its data from Server C and not from Server B? Next time, check active connections on both servers, from that app, in sys.dm_exec_connections/sessions. Try an operation in TFS that requires an update, and validate that the update happened on the server you think it's using. Try powering down or stopping the instance on the server you think it's not using. Without more info, my guess is that TFS was still reading from Server B. – Aaron Bertrand Aug 14 '19 at 14:12
3
+100

Specifying Failover Partner in the connection string is only for an initial connection. After connecting the client is notified of the failover partner, and will use that for reconnecting in case of a failover.

[After connecting to the principal] the data access provider downloads the server instance name of the current mirror server. This name is stored in the cache as the failover partner name, overwriting the client-supplied failover partner name, if any.

Connect Clients to a Database Mirroring Session

So even applications not specifically configured for database mirroring will discover the failover partner at startup.

our TFS installation has no failover partner specified

So on reboot or cold start TFS will fail to connect if server specified in its connection string is not available and hosting the principal database. But if a failover occurs after TFS has succesfully connected to the principal it will know to reconnect to the failover partner.

  • That makes sense and was my understanding of how it works. However, our TFS installation has no failover partner specified (see images in the question) – SEarle1986 Aug 21 '19 at 13:07
  • Thanks - your update makes sense now. I never realised that was how it works, so once the connection pool is closed, the app would be unable to connect the next time it tries (If a fail-over partner is not specified)? – SEarle1986 Aug 21 '19 at 14:40
  • Correct. For .NET if the Application Pool (or process) is restarted the failover partner information is lost. – David Browne - Microsoft Aug 21 '19 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.