internal static void Remount(IADDatabase database, string from) { Exception ex = null; DatabaseTasks.Trace("Database '{0}' is attempting to remount on '{1}'", new object[] { database.Name, from }); try { DatabaseTasks.WaitUntilDatabaseIsNotMounted(database, 5); AmRpcClientHelper.RemountDatabase(database, 0, -1, from); } catch (AmServerException ex2) { DatabaseTasks.Trace("RemountDatabase() failed with {0}", new object[] { ex2 }); ex = ex2; } catch (AmServerTransientException ex3) { DatabaseTasks.Trace("RemountDatabase() failed with {0}", new object[] { ex3 }); ex = ex3; } if (ex != null) { throw new DatabaseRemountFailedException(database.Name, ex.ToString(), ex); } }
private static Exception MoveDatabase(FailedSuspendedCatalogRebuildWorkflow workflow) { Exception result = null; try { AmDatabaseMoveResult amDatabaseMoveResult = null; AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.CatalogFailureItem, AmDbActionCategory.Move); string serverName; AmRpcClientHelper.MoveDatabaseEx(workflow.Context.Database, 0, 16, 0, null, workflow.Context.TargetServerName.Fqdn, false, 2, actionCode, ReplayStrings.AutoReseedMoveActiveBeforeRebuildCatalog, out serverName, ref amDatabaseMoveResult); AmRpcExceptionWrapper.Instance.ClientRethrowIfFailed(amDatabaseMoveResult.DbName, serverName, amDatabaseMoveResult.ErrorInfo); } catch (AmReplayServiceDownException ex) { result = ex; } catch (AmServerException ex2) { result = ex2; } catch (AmServerTransientException ex3) { result = ex3; } return(result); }
private void MoveDatabasesBackToServer() { Exception ex = null; try { int mountDialOverride = (int)this.MountDialOverride; AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.Cmdlet, AmDbActionCategory.Move); List <AmDatabaseMoveResult> moveResults = AmRpcClientHelper.ServerMoveAllDatabases(null, this.m_targetServer.Fqdn, 0, 16, mountDialOverride, false, (int)this.GetSkipFlags(), (int)actionCode, this.MoveComment, out this.m_lastServerContacted); this.m_output.WriteProgress(Strings.ProgressStatusCompleted, this.GetRpcDoneProgressString(), 100); this.WriteMoveBackResults(moveResults); } catch (AmReplayServiceDownException ex2) { ex = new InvalidOperationException(Strings.ErrorActiveManagerIsNotReachable(ex2.ServerName, ex2.RpcErrorMessage)); } catch (AmServerException ex3) { ex = ex3; } catch (AmServerTransientException ex4) { ex = ex4; } if (ex != null) { TaskLogger.Trace("MoveActiveMdb.MoveDatabasesBackToServer raised exception while moving databases: {0}", new object[] { ex }); this.m_output.WriteError(ex, ErrorCategory.InvalidOperation, this.m_targetServer.Identity); } }
internal static List <AmDatabaseMoveResult> PerformSystemFailover(string componentName, string comment, string fromServerFqdn) { AmDbActionCode amDbActionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.ManagedAvailability, AmDbActionCategory.Move); string text; return(AmRpcClientHelper.ServerMoveAllDatabases(fromServerFqdn, null, 0, 16, -1, true, 0, amDbActionCode.IntValue, comment, componentName, out text)); }
protected override void InternalRun() { if (!ReplicationCheckGlobals.ThirdPartyReplCheckHasRun) { ReplicationCheckGlobals.ThirdPartyReplCheckHasRun = true; } else { ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "ThirdPartyReplCheck skipping because it has already been run once."); base.Skip(); } if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ReplayServiceCheck)))) { ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayServiceCheck didn't pass! Skipping {0}.", base.Title); base.Skip(); } if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.Stopped) == ServerConfig.Stopped) { ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Stopped server! Skipping {0}.", base.Title); base.Skip(); } string error = null; bool flag = false; Exception ex = null; try { if (AmRpcVersionControl.IsCheckThirdPartyListenerSupported(ReplicationCheckGlobals.Server.AdminDisplayVersion)) { if (ReplicationCheckGlobals.WriteVerboseDelegate != null) { ReplicationCheckGlobals.WriteVerboseDelegate(Strings.TestRHCheckTPRListener(ReplicationCheckGlobals.Server.AdminDisplayVersion.ToString(), AmRpcVersionControl.ThirdPartyReplListenerSupportedVersion.ToString())); } flag = AmRpcClientHelper.CheckThirdPartyListener(base.ServerName, out error); } else { ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ThirdPartyReplCheck skipping because server {0} doesn't support the CheckThirdPartyListener RPC.", base.ServerName); base.Skip(); } } catch (AmServerException ex2) { ex = ex2; } catch (AmServerTransientException ex3) { ex = ex3; } if (ex != null) { base.Fail(Strings.ErrorCheckingTPRListener(base.ServerName, ex.Message)); } ExTraceGlobals.HealthChecksTracer.TraceDebug <string, bool>((long)this.GetHashCode(), "TPR is healthy on server {0}: {1}", base.ServerName, flag); if (!flag) { base.Fail(Strings.TPRListenerNotHealthy(base.ServerName, error)); } }
internal static AmDatabaseMoveResult PerformDatabaseFailover(string componentName, string comment, Database database) { AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.FailureItem, AmDbActionCategory.Move); AmDatabaseMoveResult result = null; string text; AmRpcClientHelper.MoveDatabaseEx(ADObjectWrapperFactory.CreateWrapper(database), 0, 16, -1, AmServerName.LocalComputerName.Fqdn, null, true, 0, actionCode, comment, out text, ref result); return(result); }
private void RequestMount(MountFlags storeMountFlags) { AmMountFlags amMountFlags = AmMountFlags.None; if (this.Force) { amMountFlags |= AmMountFlags.MountWithForce; } AmRpcClientHelper.MountDatabase(ADObjectWrapperFactory.CreateWrapper(this.DataObject), (int)storeMountFlags, (int)amMountFlags, 0); }
public static T RunRpcAndGetReply <T>(RpcGenericRequestInfo requestInfo, string serverName, int timeoutInMSec) where T : class { RpcGenericReplyInfo replyInfo = null; AmRpcClientHelper.RunRpcOperation(AmRpcOperationHint.GenericRpc, serverName, new int?(timeoutInMSec), delegate(AmRpcClient rpcClient, string rpcServerName) { ExTraceGlobals.ActiveMonitoringRpcTracer.TraceDebug <string>(0L, "GenericRequest(): Now making GenericRequest RPC to server {0}.", serverName); return(rpcClient.GenericRequest(requestInfo, out replyInfo)); }); return(SerializationServices.Deserialize <T>(replyInfo.AttachedData)); }
private void SetAutomountConsensusOnStartedServers(Dictionary <AmServerName, Server> serversToStart) { TimeSpan timeout = TimeSpan.FromSeconds(17.0); foreach (AmServerName amServerName in serversToStart.Keys) { this.m_output.AppendLogMessage("notify replayservice on {0} with consensus state 1", new object[] { amServerName.NetbiosName }); AmRpcClientHelper.RpcchSetAutomountConsensusStateBestEffort(amServerName.Fqdn, 1, timeout); } }
public static void SetDagNetwork(DatabaseAvailabilityGroup dag, SetDagNetworkRequest change) { if (dag.Servers.Count == 0) { return; } AmPamInfo primaryActiveManager = AmRpcClientHelper.GetPrimaryActiveManager(ADObjectWrapperFactory.CreateWrapper(dag)); string targetServerName = primaryActiveManager.ServerName; byte[] changeAsBytes = Serialization.ObjectToBytes(change); DagNetworkRpc.RunRpcOperation(targetServerName, delegate(ReplayRpcClient rpcClient) { ExTraceGlobals.DatabaseAvailabilityGroupTracer.TraceDebug <string>(0L, "SetDagNetwork sending RPC to {0}", targetServerName); return(rpcClient.SetDagNetwork(changeAsBytes)); }); }
private Exception MountDatabaseWrapper(IADDatabase database) { Exception result = null; try { AmRpcClientHelper.MountDatabase(database, 0, 0, 0); } catch (AmServerException ex) { result = ex; } catch (AmServerTransientException ex2) { result = ex2; } return(result); }
internal static Exception TryToDismountClean(IADDatabase database) { Exception result = null; try { AmRpcClientHelper.DismountDatabase(database, 0); } catch (AmServerException ex) { result = ex; } catch (AmServerTransientException ex2) { result = ex2; } return(result); }
private static bool ReportStoreStatus(AmServerName serverToContact, AmSystemEventCode eventCode, AmServerName reportingServer) { Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1) { AmRpcClientHelper.ReportSystemEvent(serverToContact.Fqdn, (int)eventCode, reportingServer.Fqdn); }); if (ex != null) { AmServiceMonitor.Tracer.TraceError(0L, "Failed to report status to PAM (pam={0}, eventCode={1}, reportingServer={2}): error={3}", new object[] { serverToContact, eventCode, reportingServer, ex.Message }); return(false); } return(true); }
private void MoveSingleDatabase() { AmDatabaseMoveResult result = null; try { int mountDialOverride = (int)this.MountDialOverride; bool tryOtherHealthyServers = !this.TargetServerSpecified; AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.Cmdlet, AmDbActionCategory.Move); AmRpcClientHelper.MoveDatabaseEx(ADObjectWrapperFactory.CreateWrapper(this.m_database), 0, 16, mountDialOverride, null, this.TargetServerSpecified ? this.m_targetServer.Fqdn : null, tryOtherHealthyServers, (int)this.GetSkipFlags(), actionCode, this.MoveComment, out this.m_lastServerContacted, ref result); this.m_output.WriteProgress(Strings.ProgressStatusCompleted, this.GetRpcDoneProgressString(), 100); this.WriteMoveResult(this.DataObject, this.m_startingServer, result, null); } catch (AmReplayServiceDownException ex) { TaskLogger.Trace("MoveMdbMaster.MoveSingleDatabase raised exception while moving database: {0}", new object[] { ex }); this.WriteMoveResult(this.DataObject, this.m_startingServer, result, ex); this.m_output.WriteError(new InvalidOperationException(Strings.ErrorActiveManagerIsNotReachable(ex.ServerName, ex.RpcErrorMessage)), ErrorCategory.InvalidOperation, this.m_database.Identity); } catch (AmServerException ex2) { TaskLogger.Trace("MoveMdbMaster.MoveSingleDatabase raised exception while moving database: {0}", new object[] { ex2 }); this.WriteMoveResult(this.DataObject, this.m_startingServer, result, ex2); this.m_output.WriteError(ex2, ErrorCategory.InvalidOperation, this.m_database.Identity); } catch (AmServerTransientException ex3) { TaskLogger.Trace("MoveMdbMaster.MoveSingleDatabase raised exception while moving database: {0}", new object[] { ex3 }); this.WriteMoveResult(this.DataObject, this.m_startingServer, result, ex3); this.m_output.WriteError(ex3, ErrorCategory.InvalidOperation, this.m_database.Identity); } }
protected override Exception ExecuteInternal(AutoReseedWorkflowState state) { Exception ex = null; bool flag = false; IVolumeManager volumeManager = base.Context.VolumeManager; IADDatabase database = base.Context.Database; MountedFolderPath databaseMountedFolderPath = VolumeManager.GetDatabaseMountedFolderPath(base.Context.Dag.AutoDagDatabasesRootFolderPath, database.Name); if (MountPointUtil.IsDirectoryAccessibleMountPoint(databaseMountedFolderPath.Path, out ex)) { flag = true; } else { ReplayCrimsonEvents.AutoReseedNeverMountedActiveMissingVolume.Log <string>(database.Name); if (volumeManager.FixActiveDatabaseMountPoint(database, base.Context.Databases, base.Context.AdConfig, out ex, true)) { flag = true; volumeManager.UpdateVolumeInfoCopyState(database.Guid, base.Context.ReplicaInstanceManager); ReplayCrimsonEvents.AutoReseedNeverMountedActiveAllocatedVolume.Log <string, string>(database.Name, base.Context.TargetCopyStatus.CopyStatus.LogVolumeName); } else { AutoReseedWorkflow.Tracer.TraceError <string, string>((long)this.GetHashCode(), "DiskReclaimer: UpdateVolumeForNeverMountedActives() failed to fix up active database: '{0}' mountpoint. Error: {1}", database.Name, AmExceptionHelper.GetExceptionMessageOrNoneString(ex)); ReplayCrimsonEvents.AutoReseedFixActiveMountPointError.Log <string, string>(database.Name, AmExceptionHelper.GetExceptionMessageOrNoneString(ex)); } } if (!flag) { AutoReseedWorkflow.Tracer.TraceError <string, string>((long)this.GetHashCode(), "DiskReclaimer: UpdateVolumeForNeverMountedActives() active database: '{0}' does not have a mountpoint. Skip issuing Store Mount. Error: {1}", database.Name, AmExceptionHelper.GetExceptionMessageOrNoneString(ex)); return(ex); } ex = AmRpcClientHelper.AdminMountDatabaseWrapper(database); if (ex != null) { AutoReseedWorkflow.Tracer.TraceError <string, string>((long)this.GetHashCode(), "DiskReclaimer: UpdateVolumeForNeverMountedActives() failed to mount active database: '{0}' mountpoint. Error: {1}", database.Name, ex.Message); ReplayCrimsonEvents.AutoReseedMountActiveDatabaseError.Log <string, string>(database.Name, ex.Message); } return(ex); }
internal static void Move(IADDatabase database, string from, AmDbActionCode actionCode, DatabaseMountDialOverride mountDialOverride) { Exception ex = null; AmDatabaseMoveResult amDatabaseMoveResult = null; DatabaseTasks.Trace("Database '{0}' moved from '{1}'", new object[] { database.Name, from }); try { string text; AmRpcClientHelper.MoveDatabaseEx(database, 0, 16, (int)mountDialOverride, from, null, true, 0, actionCode, null, out text, ref amDatabaseMoveResult); } catch (AmServerException ex2) { DatabaseTasks.Trace("MoveDatabase() failed with {0}; Exception: {1}", new object[] { amDatabaseMoveResult, ex2 }); ex = ex2; } catch (AmServerTransientException ex3) { DatabaseTasks.Trace("MoveDatabase() failed with {0}; Exception: {1}", new object[] { amDatabaseMoveResult, ex3 }); ex = ex3; } if (ex != null) { throw new DatabaseFailoverFailedException(database.Name, ex.ToString(), ex); } }
internal void NotifyServiceKillToOtherServers(string serviceName, ExDateTime timeInUtc) { AmLastKnownGoodConfig lastKnownGoodConfig = AmSystemManager.Instance.LastKnownGoodConfig; if (lastKnownGoodConfig != null && lastKnownGoodConfig.Role != AmRole.Unknown && lastKnownGoodConfig.Members != null) { timeInUtc.ToString("s"); AmServerName[] members = lastKnownGoodConfig.Members; for (int i = 0; i < members.Length; i++) { AmServerName serverName = members[i]; ThreadPool.QueueUserWorkItem(delegate(object param0) { AmServerName serverToRpc = serverName; AmServerName reportingServer = AmServerName.LocalComputerName; AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1) { AmRpcClientHelper.AmReportServiceKill(serverToRpc.NetbiosName, AmRpcClientHelper.RpcTimeoutShort, serviceName, reportingServer.NetbiosName, timeInUtc.ToString("u")); }); }); } } }
private void MoveAllDatabasesFromSourceServer() { try { this.PopulateDatabaseCache(); int mountDialOverride = (int)this.MountDialOverride; bool tryOtherHealthyServers = !this.TargetServerSpecified; AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.Cmdlet, AmDbActionCategory.Move); List <AmDatabaseMoveResult> moveResults = AmRpcClientHelper.ServerMoveAllDatabases(this.m_sourceServer.Fqdn, this.TargetServerSpecified ? this.m_targetServer.Fqdn : null, 0, 16, mountDialOverride, tryOtherHealthyServers, (int)this.GetSkipFlags(), (int)actionCode, this.MoveComment, out this.m_lastServerContacted); this.m_output.WriteProgress(Strings.ProgressStatusCompleted, this.GetRpcDoneProgressString(), 100); this.WriteAllMoveResults(moveResults); } catch (AmReplayServiceDownException ex) { TaskLogger.Trace("MoveMdbMaster.MoveAllDatabasesFromSourceServer raised exception while moving databases: {0}", new object[] { ex }); this.m_output.WriteError(new InvalidOperationException(Strings.ErrorActiveManagerIsNotReachable(ex.ServerName, ex.RpcErrorMessage)), ErrorCategory.InvalidOperation, this.m_sourceServer.Identity); } catch (AmServerException ex2) { TaskLogger.Trace("MoveMdbMaster.MoveAllDatabasesFromSourceServer raised exception while moving databases: {0}", new object[] { ex2 }); this.m_output.WriteError(ex2, ErrorCategory.InvalidOperation, this.m_sourceServer.Identity); } catch (AmServerTransientException ex3) { TaskLogger.Trace("MoveMdbMaster.MoveAllDatabasesFromSourceServer raised exception while moving databases: {0}", new object[] { ex3 }); this.m_output.WriteError(ex3, ErrorCategory.InvalidOperation, this.m_sourceServer.Identity); } }
// Token: 0x0600083B RID: 2107 RVA: 0x000281C0 File Offset: 0x000263C0 public bool IsReplayRunning(AmServerName serverName) { bool result = false; try { result = AmRpcClientHelper.IsRunning(serverName.Fqdn); } catch (AmServerException ex) { AmTrace.Error("IsReplayRunning() failed with {0}", new object[] { ex }); } catch (AmServerTransientException ex2) { AmTrace.Error("IsReplayRunning() failed with {0}", new object[] { ex2 }); } return(result); }
// Token: 0x0600083F RID: 2111 RVA: 0x00028251 File Offset: 0x00026451 public void DismountDatabase(IADDatabase database, int flags) { AmRpcClientHelper.DismountDatabase(database, flags); }
// Token: 0x060001A2 RID: 418 RVA: 0x0000A078 File Offset: 0x00008278 internal static bool AttemptServerSwitchoverOnShutdown() { AmTrace.Entering("ActiveManagerCore.AttemptServerSwitchoverOnShutdown", new object[0]); ExDateTime utcNow = ExDateTime.UtcNow; ReplayEventLogConstants.Tuple_PreShutdownStart.LogEvent(null, new object[0]); Exception ex = null; bool result = false; try { AmConfig config = AmSystemManager.Instance.Config; if (config.IsPamOrSam) { string fqdn = config.DagConfig.CurrentPAM.Fqdn; AmTrace.Debug("{0} Trying to mount all the databases on other servers", new object[] { ExDateTime.Now }); AmRpcClientHelper.ServerSwitchOver(fqdn, AmServerName.LocalComputerName.Fqdn); if (config.IsPAM) { AmTrace.Debug("{0} Trying to move PAM off this node", new object[] { ExDateTime.Now }); using (IAmCluster amCluster = ClusterFactory.Instance.Open()) { using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup()) { TimeSpan ts = ExDateTime.UtcNow.Subtract(utcNow); TimeSpan timeSpan = TimeSpan.FromSeconds(115.0).Subtract(ts); if (!(timeSpan <= TimeSpan.Zero)) { if (amClusterGroup.MoveGroupToReplayEnabledNode((string targetNode) => AmHelper.IsReplayRunning(targetNode), "Network Name", timeSpan, out fqdn)) { ReplayEventLogConstants.Tuple_SuccMovePAM.LogEvent(null, new object[] { Environment.MachineName, fqdn }); AmTrace.Debug("{0} Moved PAM to another node", new object[] { ExDateTime.Now }); goto IL_197; } } ReplayEventLogConstants.Tuple_FailedMovePAM.LogEvent(null, new object[] { Environment.MachineName }); IL_197 :; } } } result = true; ReplayEventLogConstants.Tuple_PreShutdownOK.LogEvent(null, new object[0]); } } catch (ClusterException ex2) { ex = ex2; } catch (AmRpcException ex3) { ex = ex3; } catch (AmServerTransientException ex4) { ex = ex4; } catch (AmServerException ex5) { ex = ex5; } finally { if (ex != null) { ReplayEventLogConstants.Tuple_PreShutdownFailed.LogEvent(null, new object[] { ex.Message }); } AmTrace.Leaving("ActiveManagerCore.AttemptServerSwitchoverOnShutdown", new object[0]); } return(result); }
// Token: 0x0600083E RID: 2110 RVA: 0x00028247 File Offset: 0x00026447 public void MountDatabaseDirectEx(string serverToRpc, Guid dbGuid, AmMountArg mountArg) { AmRpcClientHelper.MountDatabaseDirectEx(serverToRpc, dbGuid, mountArg); }
internal static void HandleSourceLogCorruption(IADDatabase database, string from) { Exception ex = null; AmDatabaseMoveResult amDatabaseMoveResult = null; DatabaseTasks.Trace("HandleSourceLogCorruption for Database '{0}' from '{1}'", new object[] { database.Name, from }); ReplayEventLogConstants.Tuple_CorruptLogRecoveryIsAttempted.LogEvent(null, new object[] { database.Name }); try { AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.FailureItem, AmDbActionCategory.Move); string text; AmRpcClientHelper.MoveDatabaseEx(database, 0, 0, RegistryParameters.MaxAutoDatabaseMountDial, from, null, true, 0, actionCode, "HandleSourceLogCorruption", out text, ref amDatabaseMoveResult); } catch (AmServerException ex2) { ex = ex2; } catch (AmServerTransientException ex3) { ex = ex3; } if (ex != null) { DatabaseTasks.Tracer.TraceError <Exception>(0L, "HandleSourceLogCorruption: Move failed: {0}", ex); } bool flag = false; Exception ex4 = null; try { string text2; ActiveManagerCore.GetDatabaseMountStatus(database.Guid, out text2); if (!string.IsNullOrEmpty(text2) && !Cluster.StringIEquals(text2, Dependencies.ManagementClassHelper.LocalMachineName)) { flag = true; } } catch (ClusterException ex5) { ex4 = ex5; } catch (AmServerException ex6) { ex4 = ex6; } if (ex4 != null) { DatabaseTasks.Tracer.TraceError <Exception>(0L, "HandleSourceLogCorruption: Determine active failed: {0}", ex4); if (ex == null) { ex = ex4; } } if (flag) { Exception ex7 = DatabaseTasks.ResumeLocalDatabaseCopy(database); if (ex7 != null) { DatabaseTasks.Tracer.TraceError <Exception>(0L, "HandleSourceLogCorruption: Resume failed: {0}", ex7); ReplayEventLogConstants.Tuple_ResumeFailedDuringFailureItemProcessing.LogEvent(database.Name, new object[] { database.Name, ex7.Message }); } } if (ex != null) { throw new DatabaseLogCorruptRecoveryException(database.Name, ex.ToString(), ex); } }
// Token: 0x06000841 RID: 2113 RVA: 0x00028264 File Offset: 0x00026464 public void AttemptCopyLastLogsDirect(string serverToRpc, Guid dbGuid, DatabaseMountDialOverride mountDialOverride, int numRetries, int e00timeoutMs, int networkIOtimeoutMs, int networkConnecttimeoutMs, string sourceServer, int actionCode, int skipValidationChecks, bool mountPending, string uniqueOperationId, int subactionAttemptNumber, ref AmAcllReturnStatus acllStatus) { AmRpcClientHelper.AttemptCopyLastLogsDirect(serverToRpc, dbGuid, mountDialOverride, numRetries, e00timeoutMs, networkIOtimeoutMs, networkConnecttimeoutMs, sourceServer, actionCode, skipValidationChecks, mountPending, uniqueOperationId, subactionAttemptNumber, ref acllStatus); }
// Token: 0x0600083D RID: 2109 RVA: 0x0002823E File Offset: 0x0002643E public AmRole GetActiveManagerRole(string serverToRpc, out string errorMessage) { return(AmRpcClientHelper.GetActiveManagerRole(serverToRpc, out errorMessage)); }
protected override void InternalRun() { if (!ReplicationCheckGlobals.ActiveManagerCheckHasRun) { ReplicationCheckGlobals.ActiveManagerCheckHasRun = true; } else { ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "ActiveManagerCheck skipping because it has already been run once."); base.Skip(); } if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ReplayServiceCheck)))) { ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayServiceCheck didn't pass! Skipping {0}.", base.Title); base.Skip(); } if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.Stopped) == ServerConfig.Stopped) { ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Stopped server! Skipping {0}.", base.Title); base.Skip(); } string error = null; AmRole amRole = AmRole.Unknown; try { if (AmRpcVersionControl.IsGetAmRoleRpcSupported(ReplicationCheckGlobals.Server.AdminDisplayVersion)) { if (ReplicationCheckGlobals.WriteVerboseDelegate != null) { ReplicationCheckGlobals.WriteVerboseDelegate(Strings.TestRHGetAmRoleRpc(ReplicationCheckGlobals.Server.AdminDisplayVersion.ToString(), AmRpcVersionControl.GetAMRoleSupportVersion.ToString())); } amRole = AmRpcClientHelper.GetActiveManagerRole(base.ServerName, out error); ReplicationCheckGlobals.ActiveManagerRole = amRole; } else { ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ActiveManagerCheck skipping because server {0} doesn't support the GetActiveManagerRole RPC.", base.ServerName); base.Skip(); } } catch (AmServerException ex) { base.Fail(Strings.ErrorReadingAMRole(base.ServerName, ex.Message)); } catch (AmServerTransientException ex2) { base.Fail(Strings.ErrorReadingAMRole(base.ServerName, ex2.Message)); } ExTraceGlobals.HealthChecksTracer.TraceDebug <AmRole, string>((long)this.GetHashCode(), "AM has role {0} on server {1}.", amRole, base.ServerName); if (amRole == AmRole.Unknown) { base.Fail(Strings.AmUnknownRole(base.ServerName, error)); } if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.DagMember) == ServerConfig.DagMember) { if (amRole == AmRole.Standalone) { base.Fail(Strings.AmInvalidRoleDagServer(base.ServerName)); return; } } else if (amRole != AmRole.Standalone) { base.Fail(Strings.AmInvalidRoleStandaloneServer(base.ServerName)); } }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(new object[] { this.DataObject }); try { Server server = this.DataObject.GetServer(); if (server == null) { base.WriteError(new InvalidOperationException(Strings.ErrorDBOwningServerNotFound(this.DataObject.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity); } base.WriteVerbose(Strings.VerboseConnectionAdminRpcInterface(server.Fqdn)); base.WriteVerbose(Strings.VerboseUnmountDatabase(this.DataObject.Identity.ToString())); AmRpcClientHelper.DismountDatabase(ADObjectWrapperFactory.CreateWrapper(this.DataObject), 0); } catch (AmServerException ex) { Exception ex2; if (ex.TryGetInnerExceptionOfType(out ex2)) { TaskLogger.Trace("DismountDatabase.InternalProcessRecord ignoring exception while unmounting database: {0}", new object[] { ex2.Message }); } else if (ex.TryGetInnerExceptionOfType(out ex2)) { TaskLogger.Trace("DismountDatabase.InternalProcessRecord ignoring exception while unmounting database: {0}", new object[] { ex2.Message }); } else if (ex.TryGetInnerExceptionOfType(out ex2)) { TaskLogger.Trace("DismountDatabase.InternalProcessRecord ignoring exception while unmounting database: {0}", new object[] { ex2.Message }); } else if (ex is AmDatabaseNeverMountedException) { TaskLogger.Trace("DismountDatabase.InternalProcessRecord ignoring exception while unmounting database: {0}", new object[] { ex.Message }); } else { TaskLogger.Trace("DismountDatabase.InternalProcessRecord raises exception while dismounting database: {0}", new object[] { ex.Message }); base.WriteError(new InvalidOperationException(Strings.ErrorFailedToUnmountDatabase(this.Identity.ToString(), ex.Message), ex), ErrorCategory.InvalidOperation, this.DataObject.Identity); } } catch (AmServerTransientException ex3) { TaskLogger.Trace("DismountDatabase.InternalProcessRecord raises exception while dismounting database: {0}", new object[] { ex3.Message }); base.WriteError(new InvalidOperationException(Strings.ErrorFailedToUnmountDatabase(this.Identity.ToString(), ex3.Message), ex3), ErrorCategory.InvalidOperation, this.DataObject.Identity); } TaskLogger.LogExit(); }
// Token: 0x0600083A RID: 2106 RVA: 0x000281B8 File Offset: 0x000263B8 public int RpcchGetAutomountConsensusState(string serverName) { return(AmRpcClientHelper.RpcchGetAutomountConsensusState(serverName)); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(new object[] { this.DataObject }); bool flag = false; bool flag2 = false; bool flag3 = true; bool flag4 = false; bool flag5 = false; Server server = this.OwnerServer; ADObjectId id = new ADObjectId(this.OwnerServer.Guid); if (server == null) { base.WriteError(new InvalidOperationException(Strings.ErrorDBOwningServerNotFound(this.DataObject.Identity.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Identity); } try { if ((!this.IsEdbFilePathChanged && !this.isLogFolderPathChanged) || (base.ConfigurationOnly && !this.shouldContinueToDoConfigurationOnly)) { TaskLogger.LogExit(); } else { if (this.needReportProgress) { base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressCheckingReplayState, 10); } base.WriteVerbose(Strings.VerboseConnectionAdminRpcInterface(this.OwnerServer.Fqdn)); MdbStatus mdbStatus = AmStoreHelper.GetMdbStatus(this.OwnerServer.Fqdn, this.DataObject.Guid); if (mdbStatus == null) { base.WriteError(new InvalidOperationException(Strings.ErrorFailedToGetDatabaseStatus(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.Identity); } if ((mdbStatus.Status & MdbStatusFlags.Backup) != MdbStatusFlags.Offline) { base.WriteError(new InvalidOperationException(Strings.ErrorBackupInProgress(this.Identity.ToString())), ErrorCategory.InvalidOperation, this.Identity); } else if ((mdbStatus.Status & MdbStatusFlags.Online) != MdbStatusFlags.Offline) { if (!this.Force && !base.ShouldContinue(base.ConfigurationOnly ? Strings.WarningDismountDatabaseToDoConfigurationOnly(this.Identity.ToString()) : Strings.WarningDismountDatabaseToContinue(this.Identity.ToString()))) { TaskLogger.LogExit(); return; } if (this.needReportProgress) { base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressDismountingDatabase(this.Identity.ToString()), 20); } base.WriteVerbose(TaskVerboseStringHelper.GetReadObjectVerboseString(id, base.DataSession, typeof(Server))); try { base.WriteVerbose(Strings.VerboseUnmountDatabase(this.DataObject.Identity.ToString())); AmRpcClientHelper.DismountDatabase(ADObjectWrapperFactory.CreateWrapper(this.DataObject), 0); } catch (AmServerException ex) { Exception ex2; if (ex.TryGetInnerExceptionOfType(out ex2)) { TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while unmounting database: {0}", new object[] { ex2.Message }); } else if (ex.TryGetInnerExceptionOfType(out ex2)) { TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while unmounting database: {0}", new object[] { ex2.Message }); } else if (ex is AmDatabaseNeverMountedException) { TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while unmounting database: {0}", new object[] { ex.Message }); } else { TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while unmounting database: {0}", new object[] { ex.Message }); base.WriteError(ex, ErrorCategory.InvalidOperation, this.DataObject.Identity); } } catch (AmServerTransientException ex3) { TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while dismounting database: {0}", new object[] { ex3.Message }); base.WriteError(ex3, ErrorCategory.InvalidOperation, this.DataObject.Identity); } flag = true; } if (!base.ConfigurationOnly) { if (this.IsDatabaseFilesCreated && this.IsEdbFilePathChanged) { if (this.needReportProgress) { base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressCopyingEdbFile, 25); } if (!this.TryCopyFile(this.OriginalEdbFilePath.PathName, this.TargetEdbFilePath.PathName)) { base.WriteError(new InvalidOperationException(Strings.ErrorFailedToMoveEdbFile(this.OriginalEdbFilePath.PathName, this.TargetEdbFilePath.PathName)), ErrorCategory.InvalidOperation, this.Identity); } flag2 = true; } if (this.isLogFolderPathChanged) { if (this.needReportProgress) { base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressCopyingLogFiles, 45); } base.WriteVerbose(Strings.VerboseCopyDatabaseLogFiles(base.OwnerServerName, this.OldLogFolderPath.PathName, this.LogFolderPath.PathName)); if (!this.TryCopyPath(this.OldLogFolderPath.PathName, this.LogFolderPath.PathName, new WmiWrapper.FileFilter(this.LogFileFilter))) { base.WriteError(new InvalidOperationException(Strings.ErrorFailedToMoveDatabaseLogFiles(this.OldLogFolderPath.PathName, this.LogFolderPath.PathName)), ErrorCategory.InvalidOperation, this.DataObject.Identity); } flag4 = true; } } if (this.needReportProgress) { base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressSavingADObject, 69); } base.InternalProcessRecord(); flag3 = false; if (flag2) { if (this.needReportProgress) { base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressDeletingEdbFile, 72); } if (!this.TryDeleteFile(this.OriginalEdbFilePath.PathName)) { this.WriteWarning(Strings.FailedToDeleteOldEdbFile(this.OriginalEdbFilePath.PathName)); TaskLogger.Trace("MoveDatabasePath: delete edb \"{0}\" file failed", new object[] { this.OriginalEdbFilePath.PathName }); } } if (flag4) { if (this.needReportProgress) { base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressDeletingLogFiles, 81); } base.WriteVerbose(Strings.VerboseDeleteDatabaseLogFiles(this.OwnerServer.Fqdn, this.OldLogFolderPath.PathName)); if (!WmiWrapper.DeleteFilesInDirectory(this.OwnerServer.Fqdn, this.OldLogFolderPath.PathName, new WmiWrapper.FileFilter(this.LogPathFilter))) { this.WriteWarning(Strings.FailedDeleteOldDatabaseLogFiles(this.OwnerServer.Fqdn, this.OldLogFolderPath.PathName)); TaskLogger.Trace("Failed to delete some of the orignal log files.", new object[0]); } } if (this.moveCatalogs && SystemConfigurationTasksHelper.TryCreateDirectory(this.OwnerServer.Fqdn, this.targetCatalogsPath, null, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning))) { if (this.needReportProgress) { base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressCopyingCatalog, 87); } try { base.WriteVerbose(Strings.VerboseCopyDatabaseCatalogFiles(this.OwnerServer.Fqdn, this.originalCatalogsPath, this.targetCatalogsPath)); if (WmiWrapper.CopyFilesInDirectory(this.OwnerServer.Fqdn, this.originalCatalogsPath, this.targetCatalogsPath, new WmiWrapper.FileFilter(MoveDatabasePath.ReturnAllFiles))) { if (this.needReportProgress) { base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressDeletingCatalog, 92); } base.WriteVerbose(Strings.VerboseDeleteDatabaseCatalogFiles(this.OwnerServer.Fqdn, this.originalCatalogsPath)); WmiWrapper.DeleteFilesInDirectory(this.OwnerServer.Fqdn, this.originalCatalogsPath, new WmiWrapper.FileFilter(MoveDatabasePath.ReturnAllFiles)); base.WriteVerbose(Strings.VerboseDeleteDirectory(this.OwnerServer.Fqdn, this.originalCatalogsPath)); WmiWrapper.RemoveDirectory(this.OwnerServer.Fqdn, this.originalCatalogsPath); } } catch (ManagementException ex4) { TaskLogger.Trace("MoveDatabasePath raised exception {0} while moving catalog files", new object[] { ex4.ToString() }); this.WriteWarning(Strings.ErrorMovingCatalogs(this.Identity.ToString(), ex4.Message)); } catch (ArgumentException ex5) { TaskLogger.Trace("MoveDatabasePath raised exception {0} while moving catalog files", new object[] { ex5.ToString() }); this.WriteWarning(Strings.ErrorMovingCatalogs(this.Identity.ToString(), ex5.Message)); } } this.SendNotificationRpcToReplayService(); flag5 = true; } } catch (WmiException ex6) { base.WriteError(new InvalidOperationException(Strings.ErrorFailedToConnectToServer(base.OwnerServerName, ex6.Message)), ErrorCategory.InvalidOperation, this.Identity); } catch (UnauthorizedAccessException ex7) { base.WriteError(new InvalidOperationException(Strings.ErrorFailedToConnectToServer(base.OwnerServerName, ex7.Message)), ErrorCategory.InvalidOperation, this.Identity); } finally { if (flag3) { if (flag2 && !this.TryDeleteFile(this.TargetEdbFilePath.PathName)) { this.WriteWarning(Strings.FailedToDeleteTempEdbFile(this.TargetEdbFilePath.PathName)); TaskLogger.Trace("MoveDatabasePath: delete edb \"{0}\" file failed", new object[] { this.TargetEdbFilePath.PathName }); } if (flag4) { TaskLogger.Trace("Error occurs when Copying path. delete copied log files", new object[0]); base.WriteVerbose(Strings.VerboseDeleteDatabaseLogFiles(this.OwnerServer.Fqdn, this.LogFolderPath.PathName)); if (!WmiWrapper.DeleteFilesInDirectory(this.OwnerServer.Fqdn, this.LogFolderPath.PathName, new WmiWrapper.FileFilter(this.LogFileFilter))) { this.WriteWarning(Strings.FailedDeleteTempDatabaseLogFiles(base.OwnerServerName, this.LogFolderPath.PathName)); TaskLogger.Trace("Failed to delete some of the copied log files.", new object[0]); } } } if (!base.ConfigurationOnly && flag) { if (this.needReportProgress) { base.WriteProgress(Strings.ProgressMoveDatabasePath(this.Identity.ToString()), Strings.ProgressRestoringDatabaseStatus, 95); } base.WriteVerbose(TaskVerboseStringHelper.GetReadObjectVerboseString(id, base.DataSession, typeof(Server))); try { if (!flag5) { this.SendNotificationRpcToReplayService(); flag5 = true; } base.WriteVerbose(Strings.VerboseMountDatabase(this.Identity.ToString())); AmRpcClientHelper.MountDatabase(ADObjectWrapperFactory.CreateWrapper(this.DataObject), 0, 0, 0); } catch (AmServerException ex8) { string message = ex8.Message; TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while re-mounting Mdb status: {0}", new object[] { message }); this.WriteWarning(Strings.ErrorFailedToRestoreDatabaseStatus(this.Identity.ToString(), message)); } catch (AmServerTransientException ex9) { string message2 = ex9.Message; TaskLogger.Trace("MoveDatabasePath.InternalProcessRecord raises exception while re-mounting Mdb status: {0}", new object[] { message2 }); this.WriteWarning(Strings.ErrorFailedToRestoreDatabaseStatus(this.Identity.ToString(), message2)); } } TaskLogger.LogExit(); } }
// Token: 0x06000840 RID: 2112 RVA: 0x0002825A File Offset: 0x0002645A public void DismountDatabaseDirect(string serverToRpc, Guid dbGuid, AmDismountArg dismountArg) { AmRpcClientHelper.DismountDatabaseDirect(serverToRpc, dbGuid, dismountArg); }