// Token: 0x0600240B RID: 9227 RVA: 0x000A8368 File Offset: 0x000A6568
        public void ImmediateDismountMailboxDatabase(Guid databaseId)
        {
            ExTraceGlobals.ThirdPartyManagerTracer.TraceDebug(0L, "ImmediateDismountMailboxDatabase called");
            this.CheckForPam("ImmediateDismountMailboxDatabase");
            Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                this.CheckForPam("ImmediateDismountMailboxDatabase");
                IADDatabase db            = this.LookupDatabase(databaseId);
                AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.FailureItem, AmDbActionCategory.Dismount);
                AmConfig config           = AmSystemManager.Instance.Config;
                new AmDbPamAction(config, db, actionCode, this.GenerateUniqueDbActionId())
                {
                    LockTimeout = new TimeSpan?(this.m_openTimeout)
                }.Dismount(UnmountFlags.SkipCacheFlush);
            });

            if (ex == null)
            {
                return;
            }
            if (ex is ThirdPartyReplicationException)
            {
                throw ex;
            }
            throw new ImmediateDismountMailboxDatabaseException(databaseId, ex.Message);
        }
 // Token: 0x06002409 RID: 9225 RVA: 0x000A8280 File Offset: 0x000A6480
 public void AmRoleNotify(AmConfig amConfig)
 {
     if (this.m_tprEnabled || (amConfig.DagConfig != null && amConfig.DagConfig.IsThirdPartyReplEnabled))
     {
         ThreadPool.QueueUserWorkItem(new WaitCallback(this.HandleAmRoleChange), amConfig);
     }
 }
        // Token: 0x06002416 RID: 9238 RVA: 0x000A8B98 File Offset: 0x000A6D98
        private void StartService()
        {
            Exception ex = null;

            this.m_service = ThirdPartyService.StartListening(out ex);
            if (this.m_service == null)
            {
                this.m_serviceStartFailure = ex;
                return;
            }
            ex = this.DoTPRCommunication(delegate(object param0, EventArgs param1)
            {
                TimeSpan timeSpan = new TimeSpan(0, 0, 2);
                using (Notify notify = Notify.Open(timeSpan, timeSpan, timeSpan))
                {
                    notify.GetTimeouts(out this.m_retryDelay, out this.m_openTimeout, out this.m_sendTimeout, out this.m_receiveTimeout);
                    this.m_isAmeListening = true;
                    AmConfig config       = AmSystemManager.Instance.Config;
                    if (config.IsPAM)
                    {
                        this.BecomePame();
                    }
                    else
                    {
                        this.RevokePame();
                    }
                }
            });
            if (ex != null)
            {
                ExTraceGlobals.ThirdPartyManagerTracer.TraceError <Exception>(0L, "StartService fails to contact the AME: {0}", ex);
            }
        }
Esempio n. 4
0
        // Token: 0x06001BD5 RID: 7125 RVA: 0x00078268 File Offset: 0x00076468
        private bool SendUpdatesAndCheckIfLocalUpdateRequired(Dictionary <string, string> clusdbUpdates)
        {
            AmConfig  cfg = AmSystemManager.Instance.Config;
            Exception ex  = null;

            if (cfg.IsPamOrSam)
            {
                ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                {
                    ActiveManagerServerPerfmon.LastLogRemoteUpdateRpcAttempted.Increment();
                    DateTime t = RpcUpdateLastLogImpl.Send(AmServerName.LocalComputerName, cfg.DagConfig.CurrentPAM, clusdbUpdates);
                    if (t > this.mostRecentValidServerUpdateTimeFromPamUtc)
                    {
                        this.mostRecentValidServerUpdateTimeFromPamUtc = t;
                    }
                });
            }
            if (ex != null)
            {
                ActiveManagerServerPerfmon.LastLogRemoteUpdateRpcFailed.Increment();
                ReplayCrimsonEvents.LastLogUpdateRpcFailed.LogPeriodic <AmRole, DateTime, string>(AmServerName.LocalComputerName.NetbiosName, TimeSpan.FromMinutes(5.0), cfg.Role, this.mostRecentValidServerUpdateTimeFromPamUtc, ex.Message);
            }
            ExDateTime lastServerUpdateTimeAsPerClusdbUtc;
            bool       flag = this.IsLocalUpdateRequired(out lastServerUpdateTimeAsPerClusdbUtc);

            this.LogUpdateEvents(flag, lastServerUpdateTimeAsPerClusdbUtc, ex);
            return(flag);
        }
Esempio n. 5
0
        // Token: 0x06000F53 RID: 3923 RVA: 0x00041F2C File Offset: 0x0004012C
        private void Open()
        {
            AmClusterHandle amClusterHandle = null;
            AmSystemManager instance        = AmSystemManager.Instance;

            if (instance != null)
            {
                AmConfig config = instance.Config;
                if (config != null)
                {
                    AmDagConfig dagConfig = config.DagConfig;
                    if (dagConfig != null)
                    {
                        IAmCluster cluster = dagConfig.Cluster;
                        if (cluster != null)
                        {
                            amClusterHandle = cluster.Handle;
                        }
                    }
                }
            }
            if (amClusterHandle == null || amClusterHandle.IsInvalid)
            {
                throw new AmClusterNotRunningException();
            }
            using (IDistributedStoreKey clusterKey = DistributedStore.Instance.GetClusterKey(amClusterHandle, null, null, DxStoreKeyAccessMode.Write, false))
            {
                string keyName = string.Format("{0}\\SafetyNet2\\{1}", "ExchangeActiveManager", this.m_dbGuidStr);
                this.m_dbRegKeyHandle = clusterKey.OpenKey(keyName, DxStoreKeyAccessMode.CreateIfNotExist, false, null);
            }
        }
        // Token: 0x0600241C RID: 9244 RVA: 0x000A8E08 File Offset: 0x000A7008
        private void CheckForPam(string methodName)
        {
            AmConfig config = AmSystemManager.Instance.Config;

            if (!config.IsPAM)
            {
                throw new NotThePamException(methodName);
            }
        }
Esempio n. 7
0
        protected override void TimerCallbackInternal()
        {
            AmConfig config = AmSystemManager.Instance.Config;

            if (config != null && config.IsPAM)
            {
                this.CheckDataStoresBestEffort();
            }
        }
        // Token: 0x06002404 RID: 9220 RVA: 0x000A816C File Offset: 0x000A636C
        public static string GetPrimaryActiveManager()
        {
            AmConfig config = AmSystemManager.Instance.Config;

            if (config.IsPamOrSam)
            {
                return(config.DagConfig.CurrentPAM.Fqdn);
            }
            throw new NoPAMDesignatedException();
        }
Esempio n. 9
0
		private bool IsPAM()
		{
			AmConfig config = AmSystemManager.Instance.Config;
			if (!config.IsPAM && !config.IsSAM)
			{
				NetworkManager.TraceDebug("NetworkManager startup skipped.  Not running in DAG role", new object[0]);
				return false;
			}
			return config.IsPAM;
		}
Esempio n. 10
0
        // Token: 0x06001BD9 RID: 7129 RVA: 0x000784E4 File Offset: 0x000766E4
        private bool IsMountingServerTheLocalServer(string dbGuidStr)
        {
            Guid     dbGuid = new Guid(dbGuidStr);
            AmConfig config = AmSystemManager.Instance.Config;

            if (config.IsUnknown)
            {
                ClusterBatchWriter.Tracer.TraceError(0L, "ClusterBatchWriter finds AmConfig is unknown.");
                return(false);
            }
            AmDbStateInfo amDbStateInfo = config.DbState.Read(dbGuid);

            return(amDbStateInfo.IsActiveServerValid && amDbStateInfo.ActiveServer.IsLocalComputerName);
        }
        // Token: 0x06002413 RID: 9235 RVA: 0x000A8984 File Offset: 0x000A6B84
        private void HandleAmRoleChange(object amConfigObj)
        {
            AmConfig amConfig = (AmConfig)amConfigObj;

            lock (this.m_serviceLock)
            {
                if (!this.m_fShutdown)
                {
                    if (amConfig.IsPamOrSam)
                    {
                        this.m_tprEnabled = amConfig.DagConfig.IsThirdPartyReplEnabled;
                        if (!this.m_initialized)
                        {
                            this.m_initialized = true;
                        }
                        if (!this.m_tprEnabled)
                        {
                            this.StopService();
                        }
                        else if (this.m_service == null)
                        {
                            this.TryToStartService();
                        }
                        else if (amConfig.IsPAM)
                        {
                            this.BecomePame();
                        }
                        else
                        {
                            this.RevokePame();
                        }
                    }
                    else if (amConfig.IsStandalone)
                    {
                        this.m_tprEnabled = false;
                        if (!this.m_initialized)
                        {
                            this.m_initialized = true;
                        }
                        this.StopService();
                    }
                    else if (this.IsAmeListening)
                    {
                        this.RevokePame();
                    }
                }
            }
        }
        // Token: 0x0600240C RID: 9228 RVA: 0x000A8464 File Offset: 0x000A6664
        public void ChangeActiveServer(Guid databaseId, string newActiveServerName)
        {
            ExTraceGlobals.ThirdPartyManagerTracer.TraceDebug(0L, "ChangeActiveServer called");
            Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                this.CheckForPam("ChangeActiveServer");
                IADDatabase db = this.LookupDatabase(databaseId);
                this.CheckServerForCopy(db, newActiveServerName);
                AmDbActionCode actionCode   = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.FailureItem, AmDbActionCategory.Move);
                AmConfig config             = AmSystemManager.Instance.Config;
                AmDbPamAction amDbPamAction = new AmDbPamAction(config, db, actionCode, this.GenerateUniqueDbActionId());
                amDbPamAction.ChangeActiveServerForThirdParty(newActiveServerName, this.m_openTimeout);
            });

            if (ex != null)
            {
                throw ex;
            }
        }
 // Token: 0x0600240D RID: 9229 RVA: 0x000A84B4 File Offset: 0x000A66B4
 public void AmeIsStarting(TimeSpan retryDelay, TimeSpan openTimeout, TimeSpan sendTimeout, TimeSpan receiveTimeout)
 {
     lock (this)
     {
         this.SetTimeouts(retryDelay, openTimeout, sendTimeout, receiveTimeout);
         this.m_isAmeListening = true;
         AmConfig config = AmSystemManager.Instance.Config;
         if (config.IsPAM)
         {
             if (this.BecomePame())
             {
             }
         }
         else
         {
             this.RevokePame();
         }
     }
 }
Esempio n. 14
0
        // Token: 0x0600214D RID: 8525 RVA: 0x0009A344 File Offset: 0x00098544
        private List <DatabaseServerInformation> GetActiveCopiesForDatabaseAvailabilityGroupInternal(bool cachedData)
        {
            ServerLocator.Tracer.TraceDebug <bool, DateTime>(0L, "Receieved GetActiveCopiesForDatabaseAvailabilityGroup(CachedData = {0}) call at {1}.", cachedData, DateTime.UtcNow);
            ServerLocatorManager.Instance.Counters.RecordOneWCFGetAllCall();
            Stopwatch stopwatch = Stopwatch.StartNew();
            List <DatabaseServerInformation> list = new List <DatabaseServerInformation>();

            if (cachedData)
            {
                try
                {
                    IMonitoringADConfig recentConfig  = ServerLocatorManager.Instance.ADConfigProvider.GetRecentConfig(false);
                    List <AmServerName> amServerNames = recentConfig.AmServerNames;
                    Dictionary <AmServerName, IEnumerable <IADDatabase> > databaseMap = recentConfig.DatabaseMap;
                    foreach (AmServerName amServerName in amServerNames)
                    {
                        IEnumerable <CopyStatusClientCachedEntry> copyStatusesByServer = ServerLocatorManager.Instance.CopyStatusLookup.GetCopyStatusesByServer(amServerName, databaseMap[amServerName], CopyStatusClientLookupFlags.None);
                        foreach (CopyStatusClientCachedEntry copyStatusClientCachedEntry in copyStatusesByServer)
                        {
                            if (copyStatusClientCachedEntry.IsActive)
                            {
                                ServerLocator.Tracer.TraceDebug <Guid, string>(0L, "GetActiveCopiesForDatabaseAvailabilityGroup found database {0} active on server {1}.", copyStatusClientCachedEntry.DbGuid, copyStatusClientCachedEntry.ActiveServer.Fqdn);
                                DatabaseServerInformation databaseServerInformation = new DatabaseServerInformation();
                                databaseServerInformation.DatabaseGuid = copyStatusClientCachedEntry.DbGuid;
                                databaseServerInformation.ServerFqdn   = copyStatusClientCachedEntry.ActiveServer.Fqdn;
                                if (this.TryPopulateServerVersionFromAdCache(copyStatusClientCachedEntry.ActiveServer, ref databaseServerInformation))
                                {
                                    list.Add(databaseServerInformation);
                                }
                            }
                        }
                    }
                    goto IL_328;
                }
                catch (MonitoringADConfigException ex)
                {
                    ServerLocator.Tracer.TraceError <string>(0L, "ADConfigProvider.GetRecentConfig() call returned error {0}", ex.Message);
                    ServerLocator.HandleException(DatabaseServerInformationFaultType.TransientError, ex);
                    goto IL_328;
                }
            }
            try
            {
                AmConfig config = AmSystemManager.Instance.Config;
                if (config.IsUnknown)
                {
                    AmInvalidConfiguration ex2 = new AmInvalidConfiguration(config.LastError);
                    ServerLocator.Tracer.TraceError <string>(0L, "GetActiveCopiesForDatabaseAvailabilityGroup failed because of invalid AM configuration on the node. Erorr: {0}", config.LastError);
                    ServerLocator.HandleException(DatabaseServerInformationFaultType.TransientError, ex2);
                }
                else
                {
                    AmDbStateInfo[] array   = config.DbState.ReadAll();
                    HashSet <Guid>  hashSet = null;
                    try
                    {
                        IMonitoringADConfig recentConfig2 = ServerLocatorManager.Instance.ADConfigProvider.GetRecentConfig(false);
                        hashSet = new HashSet <Guid>(recentConfig2.DatabaseByGuidMap.Keys);
                    }
                    catch (MonitoringADConfigException ex3)
                    {
                        ServerLocator.Tracer.TraceError <string>(0L, "ADConfigProvider.GetRecentConfig() call returned error {0}", ex3.Message);
                    }
                    if (array != null)
                    {
                        foreach (AmDbStateInfo amDbStateInfo in array)
                        {
                            DatabaseServerInformation item = new DatabaseServerInformation();
                            if (this.TryGetDatabaseServerInformationFromStateInfo(amDbStateInfo, ref item))
                            {
                                if (hashSet != null && hashSet.Contains(amDbStateInfo.DatabaseGuid))
                                {
                                    hashSet.Remove(amDbStateInfo.DatabaseGuid);
                                }
                                list.Add(item);
                            }
                        }
                    }
                    if (hashSet != null && hashSet.Count > 0)
                    {
                        foreach (Guid dbGuid in hashSet)
                        {
                            AmDbStateInfo             stateInfo = config.DbState.Read(dbGuid);
                            DatabaseServerInformation item2     = new DatabaseServerInformation();
                            if (this.TryGetDatabaseServerInformationFromStateInfo(stateInfo, ref item2))
                            {
                                list.Add(item2);
                            }
                        }
                    }
                }
            }
            catch (AmInvalidDbStateException ex4)
            {
                ServerLocator.Tracer.TraceError <string>(0L, "GetActiveCopiesForDatabaseAvailabilityGroup returned error {0}", ex4.Message);
                ServerLocator.HandleException(DatabaseServerInformationFaultType.TransientError, ex4);
            }
            catch (ClusterException ex5)
            {
                ServerLocator.Tracer.TraceError <string>(0L, "GetActiveCopiesForDatabaseAvailabilityGroup returned error {0}", ex5.Message);
                ServerLocator.HandleException(DatabaseServerInformationFaultType.TransientError, ex5);
            }
IL_328:
            ServerLocator.Tracer.TraceDebug <int>(0L, "GetActiveCopiesForDatabaseAvailabilityGroup processed the call and found {0} active databases in the Dag.", list.Count);
            ServerLocatorManager.Instance.Counters.RecordWCFGetAllCallLatency(stopwatch.ElapsedTicks);
            return(list);
        }
Esempio n. 15
0
        internal bool IsMountingServerTheLocalServer(AmConfig cfg)
        {
            AmDbStateInfo amDbStateInfo = cfg.DbState.Read(this.m_dbfi.Guid);

            return(amDbStateInfo.IsActiveServerValid && amDbStateInfo.ActiveServer.IsLocalComputerName);
        }
Esempio n. 16
0
        private bool ExecuteInternal()
        {
            Exception ex = null;

            this.CopyRoleIsActive = false;
            if (this.m_database == null)
            {
                return(true);
            }
            if (RegistryParameters.DisableFailureItemProcessing)
            {
                this.Trace("Execute(): FailureItem processing has been disabled by a registry override.", new object[0]);
                return(true);
            }
            try
            {
                AmConfig config = AmSystemManager.Instance.Config;
                if (config.IsUnknown)
                {
                    this.TraceError("Execute(): AmConfig is unknown. Returning false.", new object[0]);
                    return(false);
                }
                if (config.IsIgnoreServerDebugOptionEnabled(AmServerName.LocalComputerName))
                {
                    ReplayCrimsonEvents.OperationNotPerformedDueToDebugOption.Log <string, AmDebugOptions, string>(AmServerName.LocalComputerName.NetbiosName, AmDebugOptions.IgnoreServerFromAutomaticActions, "FailureItemProcessing");
                    return(true);
                }
                if (ThirdPartyManager.IsThirdPartyReplicationEnabled)
                {
                    if (!this.IsMountingServerTheLocalServer(config))
                    {
                        return(true);
                    }
                    this.CopyRoleIsActive = true;
                    if (this.IsTPRMoveTheActiveRecoveryAction)
                    {
                        this.Trace("Execute(): TPR FailureItem with move action. Forwarding to vendor", new object[0]);
                        AmDbStateInfo amDbStateInfo = config.DbState.Read(this.m_dbfi.Guid);
                        if (ThirdPartyManager.Instance.DatabaseMoveNeeded(this.m_dbfi.Guid, AmServerName.LocalComputerName.Fqdn, !amDbStateInfo.IsAdminDismounted) == NotificationResponse.Complete)
                        {
                            return(true);
                        }
                        this.TraceError("Execute(): TPR FailureItem was incomplete. Need to retry later", new object[0]);
                        return(false);
                    }
                    else
                    {
                        this.Trace("Execute(): TPR FailureItem is not a move, so executing the appropriate handler", new object[0]);
                        this.ActiveRecoveryAction();
                    }
                }
                else if (this.IsMountingServerTheLocalServer(config))
                {
                    this.CopyRoleIsActive = true;
                    this.ActiveRecoveryAction();
                }
                else
                {
                    this.PassiveRecoveryAction();
                }
                this.RaiseSuccessActionEvent9a(this.CopyRoleIsActive);
            }
            catch (ClusterException ex2)
            {
                this.TraceError("Execute(): ClusterException occurred. Returning false. Exception: {0}", new object[]
                {
                    ex2
                });
                return(false);
            }
            catch (TPRInitException ex3)
            {
                this.TraceError("Execute(): TPRInitException. Returning false to retry later: {0}", new object[]
                {
                    ex3
                });
                return(false);
            }
            catch (DatabaseFailoverFailedException ex4)
            {
                ex = ex4;
            }
            catch (DatabaseRemountFailedException ex5)
            {
                ex = ex5;
            }
            catch (ActiveRecoveryNotApplicableException ex6)
            {
                ex = ex6;
            }
            catch (DatabaseCopySuspendException ex7)
            {
                ex = ex7;
            }
            catch (DatabaseLogCorruptRecoveryException ex8)
            {
                ex = ex8;
            }
            catch (FailureItemRecoveryException ex9)
            {
                ex = ex9;
            }
            catch (TransientException ex10)
            {
                ex = ex10;
            }
            if (ex != null)
            {
                this.RaiseFailureActionEvent9b(ex, this.CopyRoleIsActive);
            }
            return(true);
        }
Esempio n. 17
0
		private void ClusterNotificationThread()
		{
			if (this.RefreshClusterHandles())
			{
				this.TryDriveMapRefresh();
			}
			while (!this.m_shutdown)
			{
				Exception ex = null;
				try
				{
					AmConfig config = AmSystemManager.Instance.Config;
					if (!config.IsPAM && !config.IsSAM)
					{
						NetworkManager.TraceDebug("NetworkManager sleeping.  Not running in DAG role", new object[0]);
						Thread.Sleep(NetworkManager.GetInitializationTimeoutInMsec());
					}
					else if (this.RefreshClusterHandles())
					{
						this.MonitorEvents();
					}
					else
					{
						Thread.Sleep(NetworkManager.GetInitializationTimeoutInMsec());
					}
				}
				catch (ClusterException ex2)
				{
					ex = ex2;
				}
				catch (DataSourceTransientException ex3)
				{
					ex = ex3;
				}
				catch (DataSourceOperationException ex4)
				{
					ex = ex4;
				}
				catch (TransientException ex5)
				{
					ex = ex5;
				}
				catch (COMException ex6)
				{
					ex = ex6;
				}
				catch (Win32Exception ex7)
				{
					ex = ex7;
				}
				if (ex != null)
				{
					NetworkManager.TraceError("ClusterNotificationThread monitoring encountered an exception: {0}", new object[]
					{
						ex
					});
					ReplayEventLogConstants.Tuple_NetworkMonitoringError.LogEvent(ex.Message.GetHashCode().ToString(), new object[]
					{
						ex.ToString()
					});
				}
				if (!this.m_shutdown)
				{
					Thread.Sleep(1000);
				}
			}
			NetworkManager.TraceDebug("ClusterNotificationThread exiting", new object[0]);
		}
Esempio n. 18
0
		private void EnumerateNetworkMap()
		{
			NetworkManager.TraceDebug("EnumerateNetworkMap: attempting to reload", new object[0]);
			using (IAmCluster amCluster = ClusterFactory.Instance.Open())
			{
				PersistentDagNetworkConfig persistentDagNetworkConfig = null;
				string text = null;
				Exception ex = null;
				using (DagConfigurationStore dagConfigurationStore = new DagConfigurationStore())
				{
					dagConfigurationStore.Open();
					persistentDagNetworkConfig = dagConfigurationStore.LoadNetworkConfig(out text);
					PersistentDagNetworkConfig persistentDagNetworkConfig2;
					if (persistentDagNetworkConfig == null)
					{
						persistentDagNetworkConfig2 = new PersistentDagNetworkConfig();
					}
					else
					{
						persistentDagNetworkConfig2 = persistentDagNetworkConfig.Copy();
					}
					IADDatabaseAvailabilityGroup localDag = Dependencies.ADConfig.GetLocalDag();
					if (localDag == null)
					{
						NetworkManager.TraceError("EnumerateNetworkMap can't get the DAG!", new object[0]);
					}
					else
					{
						if (persistentDagNetworkConfig2.NetworkCompression != localDag.NetworkCompression)
						{
							persistentDagNetworkConfig2.NetworkCompression = localDag.NetworkCompression;
						}
						if (persistentDagNetworkConfig2.NetworkEncryption != localDag.NetworkEncryption)
						{
							persistentDagNetworkConfig2.NetworkEncryption = localDag.NetworkEncryption;
						}
						if (persistentDagNetworkConfig2.ManualDagNetworkConfiguration != localDag.ManualDagNetworkConfiguration)
						{
							persistentDagNetworkConfig2.ManualDagNetworkConfiguration = localDag.ManualDagNetworkConfiguration;
						}
					}
					this.NetworkCompression = persistentDagNetworkConfig2.NetworkCompression;
					this.NetworkEncryption = persistentDagNetworkConfig2.NetworkEncryption;
					this.ReplicationPort = persistentDagNetworkConfig2.ReplicationPort;
					this.ManualDagNetworkConfiguration = persistentDagNetworkConfig2.ManualDagNetworkConfiguration;
					if (this.m_portInLocalRegistry != this.ReplicationPort && TcpPortFallback.StorePortNumber(this.ReplicationPort))
					{
						this.m_portInLocalRegistry = this.ReplicationPort;
					}
					NetworkDiscovery networkDiscovery = new NetworkDiscovery();
					networkDiscovery.LoadClusterObjects(amCluster);
					if (this.ManualDagNetworkConfiguration)
					{
						networkDiscovery.LoadExistingConfiguration(persistentDagNetworkConfig2);
					}
					networkDiscovery.DetermineDnsStatus();
					networkDiscovery.AggregateNetworks(true);
					if (!this.ManualDagNetworkConfiguration)
					{
						networkDiscovery.RemoveEmptyNets();
					}
					ExchangeNetworkMap exchangeNetworkMap = new ExchangeNetworkMap(this);
					exchangeNetworkMap.Load(networkDiscovery);
					AmConfig config = AmSystemManager.Instance.Config;
					if (config.IsPAM)
					{
						try
						{
							exchangeNetworkMap.SynchronizeClusterNetworkRoles(amCluster);
						}
						catch (ClusCommonFailException ex2)
						{
							NetworkManager.TraceError("SynchronizeClusterNetworkRoles threw: {0}", new object[]
							{
								ex2
							});
							ex = ex2;
						}
					}
					exchangeNetworkMap.SetupPerfmon();
					persistentDagNetworkConfig2 = exchangeNetworkMap.BuildPersistentDagNetworkConfig();
					string text2 = persistentDagNetworkConfig2.Serialize();
					bool flag = false;
					if (config.IsPAM)
					{
						if (persistentDagNetworkConfig == null || text != text2)
						{
							flag = true;
							Interlocked.Exchange(ref this.m_skipNextClusterRegistryEvent, 1);
							dagConfigurationStore.StoreNetworkConfig(text2);
							if (persistentDagNetworkConfig != null)
							{
								ReplayEventLogConstants.Tuple_DagNetworkConfigOld.LogEvent("DAGNET", new object[]
								{
									text
								});
							}
						}
					}
					else if (this.m_lastWrittenClusterNetConfigXML != null && this.m_lastWrittenClusterNetConfigXML != text2)
					{
						flag = true;
					}
					if (flag)
					{
						ReplayEventLogConstants.Tuple_DagNetworkConfigNew.LogEvent("DAGNET", new object[]
						{
							text2
						});
					}
					this.m_lastWrittenClusterNetConfigXML = text2;
					DagNetConfig dagNetConfig = this.Convert2DagNetConfig(networkDiscovery);
					string text3 = dagNetConfig.Serialize();
					if (this.m_lastWrittenEseReplNetConfigXML == null || this.EseReplDagNetConfigIsStale || text3 != this.m_lastWrittenEseReplNetConfigXML)
					{
						DagNetEnvironment.PublishDagNetConfig(text3);
						this.EseReplDagNetConfigIsStale = false;
					}
					this.m_lastWrittenEseReplNetConfigXML = text3;
					this.m_mapLoadTime = ExDateTime.Now;
					this.m_netMap = exchangeNetworkMap;
					NetworkManager.TraceDebug("EnumerateNetworkMap: completed reload", new object[0]);
					AmSystemManager instance = AmSystemManager.Instance;
					if (instance != null)
					{
						AmNetworkMonitor networkMonitor = instance.NetworkMonitor;
						if (networkMonitor != null)
						{
							networkMonitor.RefreshMapiNetwork();
						}
					}
					if (ex != null)
					{
						throw ex;
					}
				}
			}
		}
Esempio n. 19
0
        // Token: 0x06002150 RID: 8528 RVA: 0x0009A78C File Offset: 0x0009898C
        DatabaseServerInformation IServerLocator.GetServerForDatabase(DatabaseServerInformation database)
        {
            DateTime utcNow = DateTime.UtcNow;

            ServerLocator.Tracer.TraceDebug <Guid, DateTime>(0L, "Receieved GetServerForDatabase call for database {0} at {1}.", database.DatabaseGuid, utcNow);
            ServerLocatorManager.Instance.Counters.RecordOneWCFCall();
            Stopwatch stopwatch    = Stopwatch.StartNew();
            Guid      databaseGuid = database.DatabaseGuid;

            if (database.DatabaseGuid == Guid.Empty)
            {
                ServerLocator.Tracer.TraceError <Guid>(0L, "GetServerForDatabase active manager client call for database {0} cannot be performed because Guid is empty.", database.DatabaseGuid);
                ServerLocator.HandleException(DatabaseServerInformationFaultType.PermanentError, new ArgumentException("DatabaseGuid cannot be Empty."), database.DatabaseGuid);
            }
            DatabaseServerInformation databaseServerInformation = new DatabaseServerInformation();

            databaseServerInformation.RequestSentUtc        = database.RequestSentUtc;
            databaseServerInformation.RequestReceivedUtc    = utcNow;
            databaseServerInformation.ServerFqdn            = database.ServerFqdn;
            databaseServerInformation.ServerVersion         = database.ServerVersion;
            databaseServerInformation.MountedTimeUtc        = database.MountedTimeUtc;
            databaseServerInformation.LastMountedServerFqdn = database.LastMountedServerFqdn;
            try
            {
                ServerLocator.Tracer.TraceDebug <Guid>(0L, "Looking up clusdb registry for database {0}.", database.DatabaseGuid);
                AmConfig config = AmSystemManager.Instance.Config;
                if (config.IsUnknown)
                {
                    AmInvalidConfiguration ex = new AmInvalidConfiguration(config.LastError);
                    ServerLocator.Tracer.TraceError <Guid, string>(0L, "GetServerForDatabase for database {0} cannot find database because of invalid AM configuration on the node. Erorr: {1}", database.DatabaseGuid, config.LastError);
                    ServerLocator.HandleException(DatabaseServerInformationFaultType.TransientError, ex, database.DatabaseGuid);
                }
                else
                {
                    AmDbStateInfo amDbStateInfo = config.DbState.Read(database.DatabaseGuid);
                    if (this.TryGetDatabaseServerInformationFromStateInfo(amDbStateInfo, ref databaseServerInformation))
                    {
                        ServerLocator.Tracer.TraceDebug <Guid, string>(0L, "GetServerForDatabase call for database {0} returned server {1}.", database.DatabaseGuid, amDbStateInfo.ActiveServer.Fqdn);
                    }
                    else
                    {
                        DatabaseNotFoundException ex2 = new DatabaseNotFoundException(database.DatabaseGuid.ToString());
                        ServerLocator.Tracer.TraceError <Guid>(0L, "GetServerForDatabase for database {0} cannot find database in the clussdb, it could be a brand new database.", database.DatabaseGuid);
                        ServerLocator.HandleException(DatabaseServerInformationFaultType.TransientError, ex2, database.DatabaseGuid);
                    }
                }
            }
            catch (AmInvalidDbStateException ex3)
            {
                ServerLocator.Tracer.TraceError <Guid, string>(0L, "GetServerForDatabase active manager client call for database {0} returned error {1}", database.DatabaseGuid, ex3.Message);
                ServerLocator.HandleException(DatabaseServerInformationFaultType.TransientError, ex3, database.DatabaseGuid);
            }
            catch (ClusterException ex4)
            {
                ServerLocator.Tracer.TraceError <Guid, string>(0L, "GetServerForDatabase active manager client call for database {0} returned error {1}", database.DatabaseGuid, ex4.Message);
                ServerLocator.HandleException(DatabaseServerInformationFaultType.TransientError, ex4, database.DatabaseGuid);
            }
            databaseServerInformation.ReplySentUtc = DateTime.UtcNow;
            ServerLocator.Tracer.TraceDebug <Guid, DateTime>(0L, "GetServerForDatabase call for database {0} finished server processing at {1}.", database.DatabaseGuid, databaseServerInformation.ReplySentUtc);
            ServerLocatorManager.Instance.Counters.RecordWCFCallLatency(stopwatch.ElapsedTicks);
            return(databaseServerInformation);
        }