Added database mirroring failover logic