// Token: 0x060004A3 RID: 1187 RVA: 0x00018FBC File Offset: 0x000171BC internal static bool GetAllDatabaseStatuses(AmServerName serverName, bool isBasicInformation, string clientTypeId, TimeSpan?timeout, out MdbStatus[] mdbStatuses, out Exception exception) { bool result = false; exception = null; mdbStatuses = null; try { using (IListMDBStatus storeListMDBStatusInstance = Dependencies.GetStoreListMDBStatusInstance(AmServerName.IsNullOrEmpty(serverName) ? null : serverName.Fqdn, clientTypeId)) { mdbStatuses = storeListMDBStatusInstance.ListMdbStatus(isBasicInformation, timeout); result = true; } } catch (MapiPermanentException ex) { exception = ex; AmTrace.Error("GetAllDatabaseStatuses() exception: {0}", new object[] { ex.Message }); } catch (MapiRetryableException ex2) { exception = ex2; AmTrace.Error("GetAllDatabaseStatuses() exception: {0}", new object[] { ex2.Message }); } return(result); }
// Token: 0x060004A4 RID: 1188 RVA: 0x0001907C File Offset: 0x0001727C internal static void DismountAll(string hint) { AmTrace.Debug("AmStoreHelper.DismountAll( {0} ): Started dismounting all mounted databases.", new object[] { hint }); lock (AmStoreHelper.ForceDismountLocker) { MdbStatus[] array = null; DateTime utcNow = DateTime.UtcNow; if (!AmStoreHelper.GetAllDatabaseStatuses(null, false, out array)) { AmTrace.Error("AmStoreHelper.DismountAll( {0} ): GetAllDatabaseStatuses() failed. Now attempting to kill store to quickly get dismounted databases.", new object[] { hint }); AmStoreServiceMonitor.KillStoreIfRunningBefore(utcNow, "DismountAll"); } else if (array != null && array.Length > 0) { DismountDatabasesInParallel dismountDatabasesInParallel = new DismountDatabasesInParallel(array); dismountDatabasesInParallel.Execute(RegistryParameters.AmDismountOrKillTimeoutInSec * 1000, hint); } else { AmTrace.Debug("Dismount all skipped since there are no mounted databases", new object[0]); } } }
// Token: 0x0600008D RID: 141 RVA: 0x00004904 File Offset: 0x00002B04 private bool IsActiveOnServer(IADDatabase db, AmServerName movingFromServer, out LocalizedString skipReason) { bool result = false; AmDbStateInfo amDbStateInfo = this.m_amConfig.DbState.Read(db.Guid); if (amDbStateInfo.IsEntryExist) { if (AmServerName.IsEqual(movingFromServer, amDbStateInfo.ActiveServer)) { result = true; skipReason = LocalizedString.Empty; } else { AmTrace.Info("IsActiveOnServer: Excluding database {0} from moving since it is not active on {1} (active={2})", new object[] { db.Name, movingFromServer, amDbStateInfo.ActiveServer }); skipReason = ReplayStrings.DbMoveSkippedBecauseNotActive(db.Name, movingFromServer.NetbiosName, amDbStateInfo.ActiveServer.NetbiosName); } } else { AmTrace.Error("IsActiveOnServer: Failed to find db state info from clusdb (db={0})", new object[] { db.Name }); skipReason = ReplayStrings.DbMoveSkippedBecauseNotFoundInClusDb(db.Name); } return(result); }
public void ChangeActiveServerForThirdParty(string newActiveServerName, TimeSpan lockTimeout) { using (AmDatabaseOperationLock.Lock(base.DatabaseGuid, AmDbLockReason.Move, new TimeSpan?(lockTimeout))) { if (!base.State.IsAdminDismounted) { throw new ChangeActiveServerException(base.DatabaseGuid, newActiveServerName, ReplayStrings.TPRChangeFailedBecauseNotDismounted); } AmServerName activeServer = base.State.ActiveServer; AmServerName amServerName = new AmServerName(newActiveServerName); if (activeServer.Equals(amServerName)) { throw new ChangeActiveServerException(base.DatabaseGuid, newActiveServerName, ReplayStrings.TPRChangeFailedBecauseAlreadyActive(activeServer.ToString())); } IAmBcsErrorLogger errorLogger = new AmBcsSingleCopyFailureLogger(); AmBcsServerChecks checks = AmBcsServerChecks.DebugOptionDisabled | AmBcsServerChecks.ClusterNodeUp | AmBcsServerChecks.DatacenterActivationModeStarted | AmBcsServerChecks.AutoActivationAllowed; LocalizedString empty = LocalizedString.Empty; AmBcsServerValidation amBcsServerValidation = new AmBcsServerValidation(amServerName, activeServer, base.Database, base.Config, errorLogger, null); if (!amBcsServerValidation.RunChecks(checks, ref empty)) { AmTrace.Error("ChangeActiveServerForThirdParty: DB {0}: ValidateServer() returned error: {1}", new object[] { base.DatabaseName, empty }); throw new ChangeActiveServerException(base.DatabaseGuid, newActiveServerName, ReplayStrings.TPRChangeFailedServerValidation(base.DatabaseName, newActiveServerName, empty)); } base.WriteStateMountSkipped(amServerName); this.UpdateAdProperties(true, activeServer); ReplayCrimsonEvents.TPRChangeActiveServerSucceeded.Log <string, Guid, AmServerName, AmServerName>(base.DatabaseName, base.DatabaseGuid, activeServer, amServerName); } }
private void SendAllNotificationsInternal() { try { if (!this.m_fInitialized) { List <AmServerName> nodeList = this.DetermineServersToContact(); base.Initialize(nodeList); this.m_fInitialized = true; } base.RunAllRpcs(); } catch (TransientException ex) { AmTrace.Error("SendAllNotificationsInternal(): Exception occurred: {0}", new object[] { ex }); } catch (AmServerException ex2) { AmTrace.Error("SendAllNotificationsInternal(): Exception occurred: {0}", new object[] { ex2 }); } }
private void UpdateAdProperties(bool isOperationSuccess, AmServerName initialActiveServer) { if (!AmServerName.IsNullOrEmpty(base.State.ActiveServer)) { bool isForceUpdate = !AmServerName.IsEqual(initialActiveServer, base.State.ActiveServer); if (isOperationSuccess || isForceUpdate) { base.DbTrace.Debug("Issuing async SetDatabaseLegacyDnAndOwningServer", new object[0]); ThreadPool.QueueUserWorkItem(delegate(object param0) { Exception ex = SharedHelper.RunADOperationEx(delegate(object param0, EventArgs param1) { SharedDependencies.WritableADHelper.SetDatabaseLegacyDnAndOwningServer(this.DatabaseGuid, initialActiveServer, this.State.ActiveServer, isForceUpdate); }); if (ex != null) { this.DbTrace.Error("SetDatabaseLegacyDnAndOwningServer failed: {0}", new object[] { ex }); } }); return; } } else { AmTrace.Error("Skipped updating ad properties for database {0} since active server is empty", new object[] { base.DatabaseName }); } }
// Token: 0x06000144 RID: 324 RVA: 0x00007834 File Offset: 0x00005A34 internal AmNodeState GetNodeState(AmServerName nodeName) { AmNodeState result = AmNodeState.Unknown; try { IAmClusterNode amClusterNode2; IAmClusterNode amClusterNode = amClusterNode2 = this.Cluster.OpenNode(nodeName); try { result = amClusterNode.State; } finally { if (amClusterNode2 != null) { amClusterNode2.Dispose(); } } } catch (ClusterException ex) { AmTrace.Error("Failed to open cluster node {0} (error={1})", new object[] { nodeName, ex.Message }); } return(result); }
// Token: 0x060006D4 RID: 1748 RVA: 0x00020A0C File Offset: 0x0001EC0C private bool CheckDebugOption(ref LocalizedString error) { if (this.AmConfig.IsIgnoreServerDebugOptionEnabled(this.ServerToCheck)) { string text = AmDebugOptions.IgnoreServerFromAutomaticActions.ToString(); AmTrace.Error("AmBcsServerValidation: Rejecting server '{0}' for DB '{1}' because the node is marked in debug option. Debug options: {2}", new object[] { this.ServerToCheck, this.Database.Name, text }); error = ReplayStrings.AmBcsTargetNodeDebugOptionEnabled(this.ServerToCheck.Fqdn, text); if (this.ErrorLogger != null) { this.ErrorLogger.ReportServerFailure(this.ServerToCheck, AmBcsServerChecks.DebugOptionDisabled.ToString(), error, ReplayCrimsonEvents.OperationNotPerformedDueToDebugOption, new object[] { this.ServerToCheck.NetbiosName, text, "Best copy selection" }); } return(false); } return(true); }
private static bool IsMaxActivesUnderThreshold(AmServerName serverName, Func <IADServer, int?> getMaxActiveDbsLimit, out int?maxActiveDatabases) { bool result = true; int? num = null; IADServer iadserver = Dependencies.ReplayAdObjectLookup.ServerLookup.FindServerByFqdn(serverName.Fqdn); if (iadserver != null) { num = getMaxActiveDbsLimit(iadserver); AmDatabaseStateTracker databaseStateTracker = AmSystemManager.Instance.DatabaseStateTracker; if (databaseStateTracker != null && databaseStateTracker.IsMaxActivesExceeded(serverName, num)) { result = false; } } else { AmTrace.Error("Failed to find server {0}", new object[] { serverName }); FailedToFindServerException ex = new FailedToFindServerException(serverName.Fqdn); ReplayCrimsonEvents.ADObjectLookupError.LogPeriodic <string, FailedToFindServerException>(serverName.NetbiosName, DiagCore.DefaultEventSuppressionInterval, ex.Message, ex); } maxActiveDatabases = num; return(result); }
// Token: 0x0600043C RID: 1084 RVA: 0x00016808 File Offset: 0x00014A08 protected override bool SetDebugOptionInternal <T>(string serverName, string propertyName, T propertyValue) { try { if (serverName == null) { this.m_dbgOptionHandle.SetValue(propertyName, propertyValue); } else { using (RegistryKey registryKey = this.m_dbgOptionHandle.CreateSubKey(serverName)) { if (registryKey != null) { registryKey.SetValue(propertyName, propertyValue); } } } } catch (IOException ex) { AmTrace.Error("SetDebugOptionInternal({0}, {1}): m_dbgOptionHandle.SetValue or m_dbgOptionHandle.CreateSubKey failed with error {2}", new object[] { serverName, propertyName, ex.Message }); throw new AmRegistryException("m_dbgOptionHandle.SetValue or m_dbgOptionHandle.CreateSubKey", ex); } return(true); }
// Token: 0x0600019B RID: 411 RVA: 0x00009D6C File Offset: 0x00007F6C internal static bool IsLocalNodePubliclyUp() { AmServerName localComputerName = AmServerName.LocalComputerName; AmConfig config = AmSystemManager.Instance.Config; bool flag = false; if (config.IsUnknown) { AmTrace.Error("IsLocalNodePubliclyUp( {0} ): Returning 'false' since AM role is Unknown.", new object[] { localComputerName }); } else if (config.IsPamOrSam) { flag = config.DagConfig.IsNodePubliclyUp(localComputerName); AmTrace.Debug("IsLocalNodePubliclyUp( {0} ): Returning '{1}' for PAM/SAM role.", new object[] { localComputerName, flag }); } else { AmTrace.Debug("IsLocalNodePubliclyUp( {0} ): Returning 'true' since AM is in Standalone role.", new object[] { localComputerName }); flag = true; } return(flag); }
private List <AmServerName> DetermineServersToContact() { Guid guid = this.Database.Guid; IADDatabase db = this.Database; IADDatabaseCopy[] databaseCopies = AmBestCopySelectionHelper.GetDatabaseCopies(guid, ref db); if (db != null) { this.Database = db; } AmConfig amConfig = AmSystemManager.Instance.Config; if (amConfig.IsUnknown) { AmTrace.Error("AmMultiNodeRpcNotifier: DB {0}: Invalid AM configuration", new object[] { db.Name }); throw new AmInvalidConfiguration(amConfig.LastError ?? string.Empty); } IAmBcsErrorLogger errorLogger = new AmBcsSingleCopyFailureLogger(); AmBcsServerChecks checksToRun = AmBcsServerChecks.ClusterNodeUp; if (this.ActionCode.IsAutomaticOperation) { checksToRun |= AmBcsServerChecks.DebugOptionDisabled; } IEnumerable <AmServerName> source = from dbCopy in databaseCopies where this.ValidateServer(new AmServerName(dbCopy.HostServerName), db, amConfig, checksToRun, errorLogger) select new AmServerName(dbCopy.HostServerName); return(source.ToList <AmServerName>()); }
protected override Exception RunServerRpc(AmServerName node, out object result) { result = null; Exception result2 = null; try { Dependencies.ReplayRpcClientWrapper.NotifyChangedReplayConfiguration(node.Fqdn, this.Database.Guid, AmHelper.GetServerVersion(node), false, this.IsHighPriority, ReplayConfigChangeHints.AmMultiNodeReplicaNotifier); } catch (TransientException ex) { result2 = ex; AmTrace.Error("RunServerRpc(): Exception occurred: {0}", new object[] { ex }); } catch (AmServerException ex2) { result2 = ex2; AmTrace.Error("RunServerRpc(): Exception occurred: {0}", new object[] { ex2 }); } catch (TaskServerException ex3) { result2 = ex3; AmTrace.Error("RunServerRpc(): Exception occurred: {0}", new object[] { ex3 }); } return(result2); }
internal bool Write(AmDbStateInfo state, bool isBestEffort) { bool result = false; try { ActiveManagerServerPerfmon.DatabaseStateInfoWrites.Increment(); ActiveManagerServerPerfmon.DatabaseStateInfoWritesPerSec.Increment(); this.WriteInternal(state.DatabaseGuid.ToString(), state.ToString(), state.ActiveServer); result = true; } catch (ClusterException ex) { AmTrace.Error("Attempt write persistent database state for Database '{0}' failed with error: {1}", new object[] { state.DatabaseGuid, ex }); if (!isBestEffort) { throw; } } return(result); }
private bool RunChecksWrapper(AmBcsChecks checks, out AmServerName selectedCopy, AmServerName targetServer, RpcDatabaseCopyStatus2 copyStatus) { LocalizedString empty = LocalizedString.Empty; selectedCopy = null; AmBcsChecks amBcsChecks; bool flag = this.RunChecks(this.m_bcsContext.SourceServerName, targetServer, copyStatus, checks, out amBcsChecks, ref empty); if (flag) { AmTrace.Info("BCS: DatabaseCopy '{0}' on server '{1}' passed checks: {2}", new object[] { this.m_bcsContext.GetDatabaseNameOrGuid(), targetServer, checks }); selectedCopy = targetServer; ReplayCrimsonEvents.BcsDbNodeChecksPassed.Log <string, Guid, AmServerName, AmBcsChecks>(this.m_bcsContext.GetDatabaseNameOrGuid(), this.m_bcsContext.DatabaseGuid, targetServer, amBcsChecks); } else { AmTrace.Error("BCS: DatabaseCopy '{0}' on server '{1}' failed checks: {2}", new object[] { this.m_bcsContext.GetDatabaseNameOrGuid(), targetServer, checks }); } return(flag); }
// Token: 0x060003FB RID: 1019 RVA: 0x00015764 File Offset: 0x00013964 private void PerformVerification() { AmConfig config = AmSystemManager.Instance.Config; if (config.IsSAM) { AmServerName pam = config.DagConfig.CurrentPAM; AmRole role = AmRole.Unknown; string errorMessage = null; Exception ex = null; bool flag = false; if (this.IsServerDisabled(AmServerName.LocalComputerName)) { AmTrace.Debug("PamMonitor.PerformVerification found local server marked ActivationDisabled", new object[0]); return; } IADServer server = Dependencies.ADConfig.GetServer(pam); if (server == null) { AmTrace.Error("PamMonitor.PerformVerification found pam on {0} but no server data in ADConfig", new object[] { pam.Fqdn }); return; } if (this.IsServerDisabled(server)) { AmTrace.Debug("PamMonitor.PerformVerification found PAM server marked ActivationDisabled", new object[0]); flag = true; } if (!flag) { ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1) { role = Dependencies.AmRpcClientWrapper.GetActiveManagerRole(pam.Fqdn, out errorMessage); }); } if (flag || role != AmRole.PAM) { string text = string.Empty; int num = RegistryParameters.PamMonitorRecoveryDurationInSec; if (flag) { errorMessage = "PAM has been marked ActivationDisabled"; num = 5; } else if (ex != null) { text = ex.Message; } ReplayCrimsonEvents.PamMonitorServerNotInPamRole.Log <AmServerName, AmRole, string, string>(pam, role, errorMessage, text); this.pamServerInVerificationPhase = pam; this.phase = AmPamMonitor.PamMonitorPhase.Recovery; TimeSpan timeSpan = TimeSpan.FromSeconds((double)num); base.ChangeTimer(timeSpan, timeSpan); } } }
public static IADDatabaseAvailabilityGroup GetLocalServerDatabaseAvailabilityGroup(out string errorMessage) { IADDatabaseAvailabilityGroup iaddatabaseAvailabilityGroup = null; Exception ex = null; errorMessage = string.Empty; try { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); IADServer iadserver = iadtoplogyConfigurationSession.FindServerByName(Dependencies.ManagementClassHelper.LocalMachineName); if (iadserver != null) { iaddatabaseAvailabilityGroup = iadtoplogyConfigurationSession.FindDagByServer(iadserver); if (iaddatabaseAvailabilityGroup == null) { ex = new CouldNotFindDagObjectForServer(iadserver.Name); } } else { ex = new CouldNotFindServerObject(Environment.MachineName); } } catch (ADTransientException ex2) { AmTrace.Error("GetLocalServerDatabaseAvailabilityGroup got exception: {0}", new object[] { ex2 }); ex = ex2; } catch (ADExternalException ex3) { AmTrace.Error("GetLocalServerDatabaseAvailabilityGroup got exception: {0}", new object[] { ex3 }); ex = ex3; } catch (ADOperationException ex4) { AmTrace.Error("GetLocalServerDatabaseAvailabilityGroup got exception: {0}", new object[] { ex4 }); ex = ex4; } if (iaddatabaseAvailabilityGroup == null) { errorMessage = ex.Message; if (string.IsNullOrEmpty(errorMessage)) { errorMessage = ex.ToString(); } } return(iaddatabaseAvailabilityGroup); }
// Token: 0x06000442 RID: 1090 RVA: 0x00016A44 File Offset: 0x00014C44 protected override AmDbStateInfo[] ReadAllInternal(bool isBestEffort) { List <AmDbStateInfo> list = new List <AmDbStateInfo>(); try { IEnumerable <Tuple <string, object> > allValues = this.m_regDbHandle.GetAllValues(null); if (allValues != null) { foreach (Tuple <string, object> tuple in allValues) { try { Guid databaseGuid = new Guid(tuple.Item1); string entryStr = (string)tuple.Item2; AmDbStateInfo item = AmDbStateInfo.Parse(databaseGuid, entryStr); list.Add(item); } catch (InvalidCastException ex) { AmTrace.Error("ReadAllInternal invalid cast exception: {0}", new object[] { ex }); if (!isBestEffort) { throw; } } catch (FormatException ex2) { AmTrace.Error("ReadAllInternal format exception: {0}", new object[] { ex2 }); if (!isBestEffort) { throw; } } } } } catch (ClusterException ex3) { AmTrace.Error("ReadAllInternal({0}): GetValueNames() failed with error {1}", new object[] { isBestEffort, ex3.Message }); if (!isBestEffort) { throw; } } return(list.ToArray()); }
// Token: 0x06000823 RID: 2083 RVA: 0x000277FC File Offset: 0x000259FC internal static IADDatabase FindDatabaseByName(string databaseName, bool throwOnError) { Database database = null; Exception innerException = null; try { IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 347, "FindDatabaseByName", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Replay\\ActiveManager\\Util\\AmHelperMethods.cs"); QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, DatabaseSchema.Name, databaseName); Database[] array = tenantOrTopologyConfigurationSession.Find <Database>(null, QueryScope.SubTree, filter, null, 1); if (array != null && array.Length > 0) { database = array[0]; } } catch (ADTransientException ex) { AmTrace.Error("FindDatabaseByName(): ADTransientException occurred for {0} (error={1})", new object[] { databaseName, ex }); innerException = ex; } catch (ADExternalException ex2) { AmTrace.Error("FindDatabaseByName(): ADExternalException occurred for {0} (error={1})", new object[] { databaseName, ex2 }); innerException = ex2; } catch (ADOperationException ex3) { AmTrace.Error("FindDatabaseByName(): ADOperationException occurred for {0} (error={1})", new object[] { databaseName, ex3 }); innerException = ex3; } if (database == null) { AmTrace.Error("Database object not found in AD {0}", new object[] { databaseName }); if (throwOnError) { throw new AmDatabaseNameNotFoundException(databaseName, innerException); } } return(ADObjectWrapperFactory.CreateWrapper(database)); }
// Token: 0x0600019D RID: 413 RVA: 0x00009E8C File Offset: 0x0000808C internal static AmDbStateInfo GetDatabaseStateInfo(Guid dbGuid) { AmConfig config = AmSystemManager.Instance.Config; if (!config.IsUnknown) { return(config.DbState.Read(dbGuid)); } AmTrace.Error("GetDatabaseStateInfo: AmConfig is invalid!", new object[0]); throw new AmInvalidConfiguration(config.LastError); }
private static AmDbStatusInfo2 ConvertToDbStatusInfo(AmDbStateInfo stateInfo) { if (!stateInfo.IsMountSucceededAtleastOnce) { AmTrace.Error("Database does not appear to be ever attempted for mount {0}", new object[] { stateInfo.DatabaseGuid }); throw new AmDatabaseNeverMountedException(); } return(new AmDbStatusInfo2(stateInfo.ActiveServer.Fqdn, 0, stateInfo.LastMountedServer.Fqdn, stateInfo.LastMountedTime)); }
// Token: 0x060001A1 RID: 417 RVA: 0x0000A024 File Offset: 0x00008224 internal static void SetLastLogGenerationTimeStamp(Guid dbGuid, ExDateTime timeStamp) { AmConfig config = AmSystemManager.Instance.Config; if (!config.IsUnknown) { config.DbState.SetLastLogGenerationTimeStamp(dbGuid, timeStamp); return; } AmTrace.Error("SetLastLogGenerationTimeStamp: AmConfig is invalid!", new object[0]); throw new AmInvalidConfiguration(config.LastError); }
// Token: 0x060004B1 RID: 1201 RVA: 0x000194CC File Offset: 0x000176CC public bool Execute(int waitTimeoutMs, string hint) { bool flag = false; Stopwatch stopwatch = new Stopwatch(); AmStoreHelper.DismountDelegate dismountDelegate = new AmStoreHelper.DismountDelegate(AmStoreHelper.RemoteDismount); this.m_completedEvent = new ManualResetEvent(false); stopwatch.Start(); DateTime utcNow = DateTime.UtcNow; try { ReplayCrimsonEvents.ForceDismountingDatabases.Log <AmServerName, string>(AmServerName.LocalComputerName, hint); if (this.m_mdbStatuses != null && this.m_mdbStatuses.Length > 0) { AmTrace.Debug("DismountDatabasesInParallel.Execute() now starting with timeout of {0} ms...", new object[] { waitTimeoutMs }); foreach (MdbStatus mdbStatus in this.m_mdbStatuses) { DismountDatabasesInParallel.AsyncDismountState @object = new DismountDatabasesInParallel.AsyncDismountState(mdbStatus.MdbGuid, dismountDelegate); dismountDelegate.BeginInvoke(null, mdbStatus.MdbGuid, UnmountFlags.SkipCacheFlush, false, new AsyncCallback(this.DismountCompletionCallback), @object); } if (this.m_completedEvent.WaitOne(waitTimeoutMs)) { AmTrace.Debug("DismountDatabasesInParallel.Execute() finished dismounting DBs in {0} ms.", new object[] { stopwatch.ElapsedMilliseconds }); flag = true; } else { AmTrace.Error("DismountDatabasesInParallel.Execute() timed out waiting for DBs to finish dismounting.", new object[0]); AmStoreServiceMonitor.KillStoreIfRunningBefore(utcNow, "DismountDatabasesInParallel"); } } } finally { ReplayCrimsonEvents.ForceDismountAllDatabasesComplete.Log <bool>(flag); lock (this.m_locker) { this.m_completedEvent.Close(); this.m_completedEvent = null; } } return(flag); }
internal void RegisterObject(SafeHandle clusObject, ClusterNotifyFlags eventMask, IntPtr context) { AmTrace.Debug("Registering additional cluster objects for notification", new object[0]); int num = ClusapiMethods.RegisterClusterNotify(this.m_hChange, eventMask, clusObject, context); if (num != 0) { AmTrace.Error("RegisterClusterNotify for group state returned error 0x{0:X8}", new object[] { num }); throw AmExceptionHelper.ConstructClusterApiException(num, "RegisterClusterNotify(CLUSTER_CHANGE_GROUP_STATE)", new object[0]); } }
// Token: 0x06000821 RID: 2081 RVA: 0x000276F8 File Offset: 0x000258F8 internal static IADDatabase FindDatabaseByGuid(Guid dbGuid, bool throwOnError, out Exception exception) { IADDatabase iaddatabase = null; exception = null; try { iaddatabase = Dependencies.ReplayAdObjectLookup.DatabaseLookup.FindAdObjectByGuidEx(dbGuid, AdObjectLookupFlags.ReadThrough); } catch (ADTransientException ex) { AmTrace.Error("FindDatabaseByGuid(): ADTransientException occurred for {0} (error={1})", new object[] { dbGuid, ex }); exception = ex; } catch (ADExternalException ex2) { AmTrace.Error("FindDatabaseByGuid(): ADExternalException occurred for {0} (error={1})", new object[] { dbGuid, ex2 }); exception = ex2; } catch (ADOperationException ex3) { AmTrace.Error("FindDatabaseByGuid(): ADOperationException occurred for {0} (error={1})", new object[] { dbGuid, ex3 }); exception = ex3; } if (iaddatabase == null) { AmTrace.Error("Database object not found in AD {0}", new object[] { dbGuid }); if (throwOnError) { throw new AmDatabaseNotFoundException(dbGuid, exception); } } return(iaddatabase); }
// Token: 0x060006D5 RID: 1749 RVA: 0x00020AD8 File Offset: 0x0001ECD8 private bool IsClusterNodeUp(ref LocalizedString error) { if (this.AmConfig.DagConfig.IsNodePubliclyUp(this.ServerToCheck)) { return(true); } AmTrace.Error("AmBcsServerValidation: Rejecting server '{0}' for DB '{1}' because the node is down.", new object[] { this.ServerToCheck, this.Database.Name }); error = ReplayStrings.AmBcsTargetNodeDownError(this.ServerToCheck.Fqdn); this.ReportServerBlocked(AmBcsServerChecks.ClusterNodeUp, error); return(false); }
// Token: 0x060000DB RID: 219 RVA: 0x00006200 File Offset: 0x00004400 protected override void PollerThread() { AmTrace.Entering("ClusterEventManager.PollerThread", new object[0]); try { lock (this.m_locker) { if (!this.m_fShutdown) { this.CleanupClusterNotify(); this.m_isMonitoring = this.InitializeClusterNotify(); if (!this.m_isMonitoring) { AmTrace.Error("Failed to initialize cluster notification", new object[0]); } } } if (!this.m_fShutdown && this.m_isMonitoring) { this.MonitorClusterEvents(); } } catch (ClusterException ex) { AmTrace.Error("MonitorForClusterEvents() got a cluster api exception: {0}", new object[] { ex }); } catch (AmServerNameResolveFqdnException ex2) { AmTrace.Error("MonitorForClusterEvents() got a AmGetFqdnFailedADErrorException exception: {0}", new object[] { ex2 }); } lock (this.m_locker) { this.CleanupClusterNotify(); this.m_isMonitoring = false; } if (!this.m_fShutdown) { AmClusterEventManager.Tracer.TraceDebug(0L, "Triggering refresh for error recovery"); AmSystemManager.Instance.ConfigManager.TriggerRefresh(true); } AmClusterEventManager.Tracer.TraceDebug(0L, "Leaving ClusterEventManager.PollerThread"); }
internal static AmDbStatusInfo2 GetServerForDatabase(Guid mdbGuid) { AmConfig config = AmSystemManager.Instance.Config; if (config.IsUnknown) { AmTrace.Error("GetSFD: Invalid configuration (db={0})", new object[] { mdbGuid }); throw new AmInvalidConfiguration(config.LastError); } AmDbStateInfo stateInfo = config.DbState.Read(mdbGuid); return(AmServerDbStatusInfoCache.ConvertToDbStatusInfo(stateInfo)); }
// Token: 0x060004A6 RID: 1190 RVA: 0x00019164 File Offset: 0x00017364 internal static bool UpdateIsMountedCounter(Guid mdbGuid, string mdbName, bool isMounted, bool isCheckDbStatus) { if (string.IsNullOrEmpty(mdbName)) { IADDatabase iaddatabase = Dependencies.ReplayAdObjectLookup.DatabaseLookup.FindAdObjectByGuid(mdbGuid); if (iaddatabase != null) { mdbName = iaddatabase.Name; } } if (!string.IsNullOrEmpty(mdbName)) { bool flag = false; try { flag = AmStoreHelper.sm_perfCounterLock.Lock(mdbGuid, AmDbLockReason.UpdatePerfCounter); if (isCheckDbStatus) { isMounted = AmStoreHelper.IsMounted(null, mdbGuid); } AmTrace.Debug("AmStoreHelper.UpdateIsMountedCounter: Database {0} ({1}) IsMounted is {2}", new object[] { mdbGuid, mdbName, isMounted }); ActiveManagerPerfmonInstance instance = ActiveManagerPerfmon.GetInstance(mdbName); if (instance != null) { instance.IsMounted.RawValue = (isMounted ? 1L : 0L); } return(isMounted); } finally { if (flag) { AmStoreHelper.sm_perfCounterLock.Release(mdbGuid, AmDbLockReason.UpdatePerfCounter); } } } AmTrace.Error("AmStoreHelper.UpdateIsMountedCounter: Perfmon update skipped for {0} since mdbName is null", new object[] { mdbGuid }); return(isMounted); }
// Token: 0x06000829 RID: 2089 RVA: 0x00027A30 File Offset: 0x00025C30 internal static EventRecord FindEvent(string logName, int eventId, long occuredBeforeMs) { string query = string.Concat(new string[] { "*[System[(EventID = ", eventId.ToString(), ") and (TimeCreated[timediff(@SystemTime) <= ", occuredBeforeMs.ToString(), "])]]" }); EventLogQuery eventQuery = new EventLogQuery(logName, PathType.LogName, query); EventRecord eventRecord = null; try { using (EventLogReader eventLogReader = new EventLogReader(eventQuery)) { eventRecord = eventLogReader.ReadEvent(); if (eventRecord == null) { AmTrace.Warning("Failed to find an event. (logname={0}, eventId={1}, occuredBefore={2})", new object[] { logName, eventId, occuredBeforeMs }); } else { AmTrace.Debug("Found event (logname={0}, eventId={1}, occuredBefore={2})", new object[] { logName, eventId, occuredBeforeMs }); } } } catch (EventLogException ex) { AmTrace.Error("FindEvent caught {0}", new object[] { ex }); } return(eventRecord); }