internal static DateTime GetBootTime(AmServerName machineName) { System.Management.ManagementScope managementScope = AmHelper.GetManagementScope(machineName); ManagementPath path = new ManagementPath("Win32_OperatingSystem"); ObjectGetOptions options = null; DateTime bootTimeWithWmi; using (ManagementClass managementClass = new ManagementClass(managementScope, path, options)) { bootTimeWithWmi = AmHelper.GetBootTimeWithWmi(managementClass, machineName); } return(bootTimeWithWmi); }
// Token: 0x0600048E RID: 1166 RVA: 0x00018564 File Offset: 0x00016764 internal void UpdateStatus(string serviceName, AmServerName serverName, ExDateTime timeStampInUtc) { lock (this.m_locker) { Dictionary <AmServerName, ExDateTime> dictionary = null; if (!this.m_killHistoryMap.TryGetValue(serviceName, out dictionary)) { dictionary = new Dictionary <AmServerName, ExDateTime>(); this.m_killHistoryMap[serviceName] = dictionary; } dictionary[serverName] = timeStampInUtc; } }
// Token: 0x06001F2A RID: 7978 RVA: 0x0008D73C File Offset: 0x0008B93C private static void RunRpcOperationDbName(AmServerName serverName, string databaseName, int timeoutMs, IHaRpcExceptionWrapper rpcExceptionWrapperInstance, ReplayRpcClientWrapper.InternalRpcOperation rpcOperation) { RpcErrorExceptionInfo errorInfo = null; rpcExceptionWrapperInstance.ClientRetryableOperation(serverName.Fqdn, delegate { using (ReplayRpcClient replayRpcClient = ReplayRpcClientWrapper.RpcClientFactory(serverName, timeoutMs)) { errorInfo = rpcOperation(replayRpcClient); } }); rpcExceptionWrapperInstance.ClientRethrowIfFailed(databaseName, serverName.Fqdn, errorInfo); }
// Token: 0x060002EE RID: 750 RVA: 0x00011224 File Offset: 0x0000F424 private void HandleMountTimeout(AmServerName serverThatFailedToMount, AmMountTimeoutException timeoutException) { ReplayCrimsonEvents.MountTimeout.Log <string, Guid, string, string>(base.DatabaseName, base.DatabaseGuid, serverThatFailedToMount.Fqdn, timeoutException.Message); AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.TimeoutFailure, AmDbActionCategory.Move); AmDbMoveOperation amDbMoveOperation = new AmDbMoveOperation(base.Database, actionCode); AmDbMoveArguments arguments = amDbMoveOperation.Arguments; arguments.MountDialOverride = DatabaseMountDialOverride.None; arguments.MoveComment = timeoutException.Message; arguments.SourceServer = serverThatFailedToMount; amDbMoveOperation.Arguments = arguments; amDbMoveOperation.Enqueue(); }
// Token: 0x060001AA RID: 426 RVA: 0x0000A74C File Offset: 0x0000894C internal List <AmDatabaseMoveResult> ServerMoveAllDatabases(AmServerName sourceServer, AmServerName targetServer, MountFlags mountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialOverride, bool tryOtherHealthyServers, AmBcsSkipFlags skipValidationChecks, AmDbActionCode actionCode, string moveComment, string componentName) { AmTrace.Debug("ServerMoveAllDatabases() called: sourceServer='{0}', targetServer='{1}', mountFlags='{2}', dismountFlags='{3}', mountDialOverride='{4}', tryOtherHealthyServers='{5}', skipValidationChecks='{6}', actionCode='{7}', MoveComment='{8}' Component='{9}'", new object[] { sourceServer, targetServer, mountFlags, dismountFlags, mountDialOverride, tryOtherHealthyServers, skipValidationChecks, actionCode, moveComment, componentName }); ActiveManagerCore.ValidatePamOrStandalone("ServerMoveAllDatabases"); ThirdPartyManager.PreventOperationWhenTPREnabled("ServerMoveAllDatabases"); AmDbMoveArguments amDbMoveArguments = new AmDbMoveArguments(actionCode); amDbMoveArguments.SourceServer = sourceServer; amDbMoveArguments.TargetServer = targetServer; amDbMoveArguments.MountFlags = mountFlags; amDbMoveArguments.DismountFlags = dismountFlags; amDbMoveArguments.MountDialOverride = mountDialOverride; amDbMoveArguments.TryOtherHealthyServers = tryOtherHealthyServers; amDbMoveArguments.SkipValidationChecks = skipValidationChecks; amDbMoveArguments.MoveComment = moveComment; amDbMoveArguments.ComponentName = componentName; if (string.IsNullOrEmpty(sourceServer.Fqdn)) { return(MoveBackToServer.Move(amDbMoveArguments)); } AmEvtMoveAllDatabasesBase amEvtMoveAllDatabasesBase; if (actionCode.IsAutomaticManagedAvailabilityFailover) { amEvtMoveAllDatabasesBase = new AmEvtMoveAllDatabasesOnComponentRequest(sourceServer); } else { amEvtMoveAllDatabasesBase = new AmEvtMoveAllDatabasesOnAdminRequest(sourceServer); } amEvtMoveAllDatabasesBase.MoveArgs = amDbMoveArguments; amEvtMoveAllDatabasesBase.Notify(); amEvtMoveAllDatabasesBase.WaitForSwitchoverComplete(); AmTrace.Debug("ServerMoveAllDatabases({0}) completed", new object[] { sourceServer }); return(amEvtMoveAllDatabasesBase.GetMoveResultsForOperationsRun()); }
internal void MarkFailedTime(Guid dbGuid, AmServerName nodeName, AmDbActionCode actionCode) { lock (this.m_locker) { Dictionary <AmServerName, AmDbAttemptInfo> dictionary = null; if (!this.m_dbMap.TryGetValue(dbGuid, out dictionary)) { dictionary = new Dictionary <AmServerName, AmDbAttemptInfo>(); this.m_dbMap[dbGuid] = dictionary; } AmDbAttemptInfo value = new AmDbAttemptInfo(dbGuid, actionCode, (DateTime)ExDateTime.Now); dictionary[nodeName] = value; } }
// Token: 0x06000729 RID: 1833 RVA: 0x000230DC File Offset: 0x000212DC private bool TargetHasBeenTried(ref LocalizedString error) { if (!AmServerName.IsNullOrEmpty(this.m_serverAlreadyTried)) { AmTrace.Debug("BCS: Target server '{0}' has already been tried for database '{1}'.", new object[] { this.m_serverAlreadyTried.NetbiosName, this.m_bcsContext.GetDatabaseNameOrGuid() }); error = ReplayStrings.AmBcsDatabaseCopyAlreadyTried(this.m_bcsContext.GetDatabaseNameOrGuid(), this.m_serverAlreadyTried.ToString()); return(true); } return(false); }
// Token: 0x060011C8 RID: 4552 RVA: 0x00049A30 File Offset: 0x00047C30 public void ReportDbCopyFoundInAD(IADDatabase db, AmServerName serverName) { base.WriterLockedOperation(delegate { DbHealthInfo orAddDbHealthInfo = this.GetOrAddDbHealthInfo(db.Guid, db.Name); this.ReportTransition(orAddDbHealthInfo.DbFoundInAD, true); bool conditionMet = !DatabaseHealthMonitor.ShouldMonitorDatabase(db); this.ReportTransition(orAddDbHealthInfo.SkippedFromMonitoring, conditionMet); DbCopyHealthInfo orAddDbCopy = orAddDbHealthInfo.GetOrAddDbCopy(serverName); DateTime utcNow = DateTime.UtcNow; orAddDbCopy.LastTouchedTime = utcNow; this.ReportTransition(orAddDbCopy.CopyFoundInAD, true); }); }
// Token: 0x06000638 RID: 1592 RVA: 0x0001ED1C File Offset: 0x0001CF1C internal bool RemoveEntry(AmServerName serverName, bool isRemoveFromClusdb, string hint) { bool flag = false; lock (this.m_locker) { flag = this.RemoveEntryInternal(serverName, isRemoveFromClusdb); } if (flag) { ReplayCrimsonEvents.RemovingDelayedFailoverEntry.Log <AmServerName, string>(serverName, hint); } return(flag); }
internal static long RequestGlobalTruncationCoordination(long localTruncationPoint, string sourceMachineFqdn, string localNodeName, Guid identityGuid, string logPrefix, string destLogPath, bool circularLogging, ManualOneShotEvent cancelEvent) { long num = -1L; TimeSpan timeout = TimeSpan.FromSeconds((double)RegistryParameters.LogTruncationOpenContextTimeoutInSec); localNodeName = AmServerName.GetSimpleName(localNodeName); using (LogShipContextWrapper logShipContextWrapper = new LogShipContextWrapper(TestSupport.UseLocalMachineNameOnZerobox(sourceMachineFqdn), localNodeName, identityGuid, logPrefix, destLogPath, circularLogging, timeout, cancelEvent)) { LogTruncater.Tracer.TraceDebug <Guid, string, long>(0L, "RequestGlobalTruncationCoordination for db {0}: Calling Notify() to source server {1}, with local truncation point of {2}.", identityGuid, sourceMachineFqdn, localTruncationPoint); logShipContextWrapper.Notify(localTruncationPoint, ref num); LogTruncater.Tracer.TraceDebug <Guid, long, long>(0L, "RequestGlobalTruncationCoordination for db {0} notified our lowest is 0x{1:X}, learned the global truncation is 0x{2:X}", identityGuid, localTruncationPoint, num); } return(num); }
// Token: 0x06000624 RID: 1572 RVA: 0x0001E57C File Offset: 0x0001C77C internal static AmFailoverEntry ReadFromPersistentStoreBestEffort(AmServerName serverName) { AmFailoverEntry entry = null; Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1) { entry = AmFailoverEntry.ReadFromPersistentStore(serverName); }); if (ex != null) { ReplayCrimsonEvents.TransientFailoverSuppressionPersistentStoreFailure.Log <string, AmServerName, string>("Read", serverName, ex.Message); } return(entry); }
public DumpClusterTopology(string nameCluster, ITaskOutputHelper output) { this.m_ownsClusterHandle = true; base..ctor(); this.m_nodeNameToConnect = nameCluster; this.m_output = output; this.m_indentlevel = 0U; Exception ex = null; try { if (string.IsNullOrEmpty(nameCluster)) { this.WriteLine("DumpClusterTopology: Opening local cluster.", new object[0]); this.m_cluster = AmCluster.Open(); } else { this.WriteLine("DumpClusterTopology: Opening remote cluster {0}.", new object[] { nameCluster }); AmServerName serverName = new AmServerName(nameCluster); this.m_cluster = AmCluster.OpenByName(serverName); } } catch (ClusterException ex2) { ex = ex2; } catch (AmCommonTransientException ex3) { ex = ex3; } catch (AmCommonException ex4) { ex = ex4; } catch (TransientException ex5) { ex = ex5; } if (ex != null) { this.WriteLine("DumpClusterTopology: Failed opening with {0}", new object[] { ex }); } }
// Token: 0x060004E5 RID: 1253 RVA: 0x0001A440 File Offset: 0x00018640 private bool CheckIfEventMarked(AmServerName serverName, AmSystemEventCode compareEventCode, bool isRemove) { AmSystemEventCode amSystemEventCode; if (this.m_storeStateMap.TryGetValue(serverName, out amSystemEventCode) && amSystemEventCode == compareEventCode) { if (isRemove) { this.m_storeStateMap.Remove(serverName); } return(true); } return(false); }
// Token: 0x06001236 RID: 4662 RVA: 0x0004B3C8 File Offset: 0x000495C8 public DbCopyHealthInfo(Guid dbGuid, string dbName, AmServerName serverName) { this.DbGuid = dbGuid; this.DbName = dbName; this.DbIdentity = dbGuid.ToString(); this.ServerName = serverName; this.CopyIsAvailable = new StateTransitionInfo(); this.CopyIsRedundant = new StateTransitionInfo(); this.CopyStatusRetrieved = new StateTransitionInfo(); this.CopyStatusHealthy = new StateTransitionInfo(); this.CopyStatusActive = new StateTransitionInfo(); this.CopyStatusMounted = new StateTransitionInfo(); this.CopyFoundInAD = new StateTransitionInfo(); }
internal TData GetMostRecentActionData(AmServerName node) { TData result = default(TData); lock (this.locker) { LinkedList <TData> linkedList; if (this.actionHistory.TryGetValue(node, out linkedList) && linkedList != null && linkedList.Count > 0) { result = linkedList.First <TData>(); } } return(result); }
// Token: 0x060001C9 RID: 457 RVA: 0x00008554 File Offset: 0x00006754 internal static AmServerName GetNameById(int nodeId) { AmServerName result = null; string name = string.Format("Cluster\\Nodes\\{0}", nodeId); using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(name)) { if (registryKey != null) { result = new AmServerName((string)registryKey.GetValue("NodeName")); } } return(result); }
// Token: 0x060011B9 RID: 4537 RVA: 0x0004960C File Offset: 0x0004780C public void ReportDbCopiesFoundInAD(IEnumerable <IADDatabase> databases, AmServerName serverName) { DbCopyHealthInfoInternalTable dbCopyHealthInfoInternalTable = null; lock (this.m_locker) { dbCopyHealthInfoInternalTable = this.m_healthTable; } foreach (IADDatabase iaddatabase in databases) { DbCopyHealthInfoTable.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "Reporting that database copy '{0}\\{1}' was found in the AD.", iaddatabase.Name, serverName.NetbiosName); dbCopyHealthInfoInternalTable.ReportDbCopyFoundInAD(iaddatabase, serverName); } }
private void DestroyCluster() { bool flag = false; string verboseData = null; string serverName = "<unknown>"; try { this.m_output.WriteProgressSimple(Strings.RemoveDagDestroyingCluster(this.m_dagName, this.m_mailboxServerName, this.m_dagName)); try { using (IAmClusterGroup amClusterGroup = this.m_clusDag.FindCoreClusterGroup()) { AmServerName ownerNode = amClusterGroup.OwnerNode; serverName = ownerNode.Fqdn; ReplayRpcClientWrapper.RunDestroyCluster(ownerNode, this.m_dagName, out verboseData); } } catch (LocalizedException error) { this.m_output.AppendLogMessage(ReplayStrings.DagTaskRemoteOperationLogBegin(serverName)); this.m_output.AppendLogMessage(ReplayStrings.DagTaskRemoteOperationLogData(verboseData)); this.m_output.WriteErrorSimple(error); } this.m_output.AppendLogMessage(ReplayStrings.DagTaskRemoteOperationLogBegin(serverName)); this.m_output.AppendLogMessage(ReplayStrings.DagTaskRemoteOperationLogData(verboseData)); this.m_output.AppendLogMessage(ReplayStrings.DagTaskRemoteOperationLogEnd(serverName)); flag = true; this.m_output.WriteProgressSimple(Strings.RemoveDagDestroyedCluster(this.m_dagName, this.m_mailboxServerName, this.m_dagName)); } catch (ClusCommonTransientException ex) { uint status = 0U; Win32Exception ex2 = ex.InnerException as Win32Exception; if (ex2 != null) { status = (uint)ex2.NativeErrorCode; } this.m_output.WriteErrorSimple(new RemoveDagFailedToDestroyClusterException(this.m_dagName, this.m_dagName, status)); } finally { if (flag) { this.m_clusDag.Dispose(); this.m_clusDag = null; } } }
internal ExDateTime GetReplayDownFromTime(AmServerName node) { ExDateTime result; lock (this.locker) { ExDateTime minValue; if (!this.replayDownMap.TryGetValue(node, out minValue)) { minValue = ExDateTime.MinValue; } result = minValue; } return(result); }
private void UpdateMap(AmServerName node, Exception ex, object result) { lock (this.m_locker) { this.m_rpcAttemptMap[node] = ex; this.UpdateStatus(node, result); this.m_completionCount++; if (this.m_completionCount == this.m_expectedCount - this.m_skippedCount) { this.Tracer.TraceDebug <string>((long)this.GetHashCode(), "{0}: All RPCs completed. Signalling completion event.", this.m_name); this.m_completionEvent.Set(); this.m_completionEvent.Close(); } } }
private string GetAllNodesStillInList(AmServerName nodeToExclude) { string result = string.Empty; lock (this.locker) { if (this.nodeActionMap.Count > 0) { result = this.GetNodeInfoListAsString(from nodeInfo in this.nodeActionMap.Values where !AmServerName.IsEqual(nodeInfo.Name, nodeToExclude) select nodeInfo); } } return(result); }
// Token: 0x06001217 RID: 4631 RVA: 0x0004AFB0 File Offset: 0x000491B0 public DbCopyHealthInfo GetOrAddDbCopy(AmServerName serverName) { DbCopyHealthInfo dbCopyHealthInfo; if (!this.ContainsDbCopy(serverName)) { dbCopyHealthInfo = new DbCopyHealthInfo(this.DbGuid, this.DbName, serverName); this.DbServerInfos[serverName] = dbCopyHealthInfo; } else { dbCopyHealthInfo = this.DbServerInfos[serverName]; } return(dbCopyHealthInfo); }
public static bool MovePrimaryActiveManagerRole(string CurrentPrimaryName) { AmServerName serverName = new AmServerName(CurrentPrimaryName); bool result; using (IAmCluster amCluster = ClusterFactory.Instance.OpenByName(serverName)) { using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup()) { string text; result = amClusterGroup.MoveGroupToReplayEnabledNode((string targetNode) => AmHelper.IsReplayRunning(targetNode), "Network Name", new TimeSpan(0, 3, 0), out text); } } return(result); }
// Token: 0x060011D2 RID: 4562 RVA: 0x0004A798 File Offset: 0x00048998 private ServerHealthInfo GetOrAddServerHealthInfo(AmServerName serverName) { ServerHealthInfo serverHealthInfo; if (!this.m_serverInfos.ContainsKey(serverName)) { serverHealthInfo = new ServerHealthInfo(serverName); this.m_serverInfos[serverName] = serverHealthInfo; } else { serverHealthInfo = this.m_serverInfos[serverName]; } return(serverHealthInfo); }
private ClusterDB(AmServerName serverName) { using (DisposeGuard disposeGuard = default(DisposeGuard)) { disposeGuard.Add <ClusterDB>(this); this.isInstalled = AmCluster.IsInstalled(serverName); if (AmCluster.IsRunning(serverName)) { this.amCluster = AmCluster.OpenByName(serverName); this.rootHandle = DistributedStore.Instance.GetClusterKey(this.amCluster.Handle, null, serverName.Fqdn, DxStoreKeyAccessMode.Read, false); this.openWriteBatches = new List <ClusterDB.WriteBatch>(10); } disposeGuard.Success(); } }
// Token: 0x060001E2 RID: 482 RVA: 0x0000C554 File Offset: 0x0000A754 private bool IsMaxActivesExceededInternal(AmServerName serverName, int?maxActivesConfigured) { if (maxActivesConfigured == null) { AmDatabaseStateTracker.Tracer.TraceDebug <AmServerName>(0L, "IsMaxActivesExceededInternal(): maxActivesConfigured is null for {0}. Skipping", serverName); return(false); } AmDatabaseStateTracker.ServerInfo serverInfo; if (this.serverInfoMap.TryGetValue(serverName, out serverInfo) && serverInfo.ActiveDatabases.Count >= maxActivesConfigured.Value) { AmDatabaseStateTracker.Tracer.TraceError <AmServerName>(0L, "MaxActives exceeded on server {0}", serverName); return(true); } return(false); }
// Token: 0x060001A9 RID: 425 RVA: 0x0000A6F4 File Offset: 0x000088F4 internal void ServerSwitchOver(AmServerName sourceServer) { AmTrace.Debug("ServerSwitchover({0}) called", new object[] { sourceServer }); ActiveManagerCore.ValidatePamOrStandalone("ServerSwitchOver"); AmEvtSwitchoverOnShutdown amEvtSwitchoverOnShutdown = new AmEvtSwitchoverOnShutdown(sourceServer); amEvtSwitchoverOnShutdown.Notify(); amEvtSwitchoverOnShutdown.WaitForSwitchoverComplete(); AmTrace.Debug("ServerSwitchover({0}) completed", new object[] { sourceServer }); }
// Token: 0x06000851 RID: 2129 RVA: 0x00028398 File Offset: 0x00026598 public IADServer GetServer(AmServerName serverName) { IMonitoringADConfig currentConfig = this.GetCurrentConfig(); if (currentConfig == null) { return(null); } IADServer iadserver = currentConfig.LookupMiniServerByName(serverName); if (iadserver == null) { iadserver = this.HandleMissingServer(serverName); } return(iadserver); }
// Token: 0x060011BA RID: 4538 RVA: 0x000496B0 File Offset: 0x000478B0 public void ReportDbCopyStatusesFound(IMonitoringADConfig adConfig, AmServerName serverName, IEnumerable <CopyStatusClientCachedEntry> statuses) { DbCopyHealthInfoInternalTable dbCopyHealthInfoInternalTable = null; lock (this.m_locker) { dbCopyHealthInfoInternalTable = this.m_healthTable; } foreach (CopyStatusClientCachedEntry copyStatusClientCachedEntry in statuses) { IADDatabase iaddatabase; string text = adConfig.DatabaseByGuidMap.TryGetValue(copyStatusClientCachedEntry.DbGuid, out iaddatabase) ? iaddatabase.Name : copyStatusClientCachedEntry.DbGuid.ToString(); DbCopyHealthInfoTable.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "Reporting that a copy status for database copy '{0}\\{1}' was possibly retrieved.", text, serverName.NetbiosName); dbCopyHealthInfoInternalTable.ReportDbCopyStatusFound(copyStatusClientCachedEntry.DbGuid, text, serverName, copyStatusClientCachedEntry); } }
protected override bool TryStartRpc(AmServerName server) { bool inProgress = false; bool flag = this.m_rpcThreadsInProgress.TryGetValue(server, out inProgress); if (flag && inProgress) { return(false); } this.m_rpcThreadsInProgress.AddOrUpdate(server, true, delegate(AmServerName serverName, bool oldValue) { inProgress = oldValue; return(true); }); return(!inProgress); }