// 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: 0x0600214C RID: 8524 RVA: 0x0009A2B4 File Offset: 0x000984B4 private bool TryGetDatabaseServerInformationFromStateInfo(AmDbStateInfo stateInfo, ref DatabaseServerInformation information) { if (stateInfo.IsEntryExist) { information.DatabaseGuid = stateInfo.DatabaseGuid; information.ServerFqdn = stateInfo.ActiveServer.Fqdn; information.MountedTimeUtc = stateInfo.LastMountedTime; if (!string.IsNullOrEmpty(stateInfo.LastMountedServer.Fqdn)) { information.LastMountedServerFqdn = stateInfo.LastMountedServer.Fqdn; } else { information.LastMountedServerFqdn = null; } information.FailoverSequenceNumber = stateInfo.FailoverSequenceNumber; this.TryPopulateServerVersionFromAdCache(stateInfo.ActiveServer, ref information); return(true); } return(false); }
internal bool IsMountingServerTheLocalServer(AmConfig cfg) { AmDbStateInfo amDbStateInfo = cfg.DbState.Read(this.m_dbfi.Guid); return(amDbStateInfo.IsActiveServerValid && amDbStateInfo.ActiveServer.IsLocalComputerName); }
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); }
// 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); }
// 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); }