private void SuspendStateThreadProc(object stateObject) { try { ReplayState replayState = (ReplayState)stateObject; replayState.SuspendLockRemote.EnterSuspend(); this.m_fSuccess = true; } catch (Exception ex) { if (AmExceptionHelper.IsKnownClusterException(this, ex)) { this.m_Exception = ex; } else { this.m_Exception = ex; this.m_Terminating = true; } } }
// Token: 0x0600052D RID: 1325 RVA: 0x00013694 File Offset: 0x00011894 public IEnumerable <Tuple <string, RegistryValueKind> > GetValueInfos(ReadWriteConstraints constraints) { List <Tuple <string, RegistryValueKind> > list = new List <Tuple <string, RegistryValueKind> >(); int num = 128; int num2 = 0; int item = 0; int num5; for (;;) { StringBuilder stringBuilder = new StringBuilder(num); int num3 = num; int num4 = 0; num5 = ClusapiMethods.ClusterRegEnumValue(this.KeyHandle, num2, stringBuilder, ref num3, ref item, IntPtr.Zero, ref num4); if (259 == num5) { return(list); } if (234 != num5 && num5 != 0) { break; } if (num3 > num) { num = num3 + 1; num4 = 0; stringBuilder = new StringBuilder(num); num5 = ClusapiMethods.ClusterRegEnumValue(this.KeyHandle, num2, stringBuilder, ref num3, ref item, IntPtr.Zero, ref num4); } if (234 != num5 && num5 != 0) { goto Block_6; } list.Add(new Tuple <string, RegistryValueKind>(stringBuilder.ToString(), (RegistryValueKind)item)); num2++; } throw AmExceptionHelper.ConstructClusterApiException(num5, "ClusterRegEnumValue(first)", new object[0]); Block_6: throw AmExceptionHelper.ConstructClusterApiException(num5, "ClusterRegEnumValue(second)", new object[0]); }
// Token: 0x06001501 RID: 5377 RVA: 0x00052ED0 File Offset: 0x000510D0 public static MonitoringADConfig GetConfig(AmServerName serverName, IReplayAdObjectLookup adLookup, IReplayAdObjectLookup adLookupPartiallyConsistent, IADToplogyConfigurationSession adSession, IADToplogyConfigurationSession adSessionPartiallyConsistent, Func <bool> isServiceShuttingDownFunc) { ReplayServerPerfmon.ADConfigRefreshCalls.Increment(); ReplayServerPerfmon.ADConfigRefreshCallsPerSec.Increment(); Stopwatch stopwatch = Stopwatch.StartNew(); MonitoringADConfig config = new MonitoringADConfig(serverName, adLookup, adLookupPartiallyConsistent, adSession, adSessionPartiallyConsistent, isServiceShuttingDownFunc); Exception ex = ADUtils.RunADOperation(delegate() { config.Refresh(); }, 2); ReplayServerPerfmon.ADConfigRefreshLatency.IncrementBy(stopwatch.ElapsedTicks); ReplayServerPerfmon.ADConfigRefreshLatencyBase.Increment(); ExTraceGlobals.ADCacheTracer.TraceDebug <TimeSpan>((long)config.GetHashCode(), "MonitoringADConfig.GetConfig took {0}", stopwatch.Elapsed); if (stopwatch.Elapsed > MonitoringADConfig.MaxHealthyADRefreshDuration) { ReplayCrimsonEvents.ADConfigRefreshWasSlow.LogPeriodic <TimeSpan>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, stopwatch.Elapsed); } if (ex != null) { MonitoringADConfig.Tracer.TraceError <string, string>((long)config.GetHashCode(), "MonitoringADConfig.GetConfig( {0} ): Got exception: {1}", serverName.NetbiosName, AmExceptionHelper.GetExceptionToStringOrNoneString(ex)); ReplayCrimsonEvents.ADConfigRefreshFailed.LogPeriodic <string, string>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, ex.ToString(), Environment.StackTrace); throw new MonitoringADConfigException(ex.Message, ex); } return(config); }
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); }
protected override bool IsKnownException(Exception e) { return(AmExceptionHelper.IsKnownClusterException(this, e) || base.IsKnownException(e)); }
protected override bool IsKnownException(Exception exception) { return(base.IsKnownException(exception) || DataAccessHelper.IsDataAccessKnownException(exception) || MonitoringHelper.IsKnownExceptionForMonitoring(exception) || AmExceptionHelper.IsKnownClusterException(this, exception) || exception is ReplicationCheckException); }
private IMonitoringADConfig GetConfig(bool waitForInit, TimeSpan allowedStaleness) { if (waitForInit) { TimeSpan getConfigWaitTimeout = MonitoringADConfigManager.GetConfigWaitTimeout; ManualOneShotEvent.Result result = this.m_firstLookupCompleted.WaitOne(getConfigWaitTimeout); if (result == ManualOneShotEvent.Result.WaitTimedOut) { MonitoringADConfigManager.Tracer.TraceError <TimeSpan>((long)this.GetHashCode(), "MonitoringADConfigManager.GetConfig(): AD initial lookup timed out after {0}.", getConfigWaitTimeout); throw new MonitoringADFirstLookupTimeoutException((int)getConfigWaitTimeout.TotalMilliseconds); } if (result == ManualOneShotEvent.Result.ShuttingDown) { MonitoringADConfigManager.Tracer.TraceError((long)this.GetHashCode(), "MonitoringADConfigManager.GetConfig(): m_firstLookupCompleted event is null, which means the service is shutting down!"); throw new MonitoringADServiceShuttingDownException(); } } Exception ex = null; IMonitoringADConfig monitoringADConfig = null; lock (this.m_locker) { monitoringADConfig = this.m_config; ex = this.LastException; } if (monitoringADConfig != null) { TimeSpan timeSpan = DateTime.UtcNow.Subtract(monitoringADConfig.CreateTimeUtc); if (allowedStaleness != InvokeWithTimeout.InfiniteTimeSpan) { if (timeSpan > allowedStaleness) { MonitoringADConfigManager.Tracer.TraceError <TimeSpan, TimeSpan>((long)this.GetHashCode(), "MonitoringADConfigManager.GetConfig(): Cached config is older ({0}) than max TTL ({1})", timeSpan, allowedStaleness); throw new MonitoringADConfigStaleException(timeSpan.ToString(), allowedStaleness.ToString(), AmExceptionHelper.GetExceptionMessageOrNoneString(ex), ex); } } else { MonitoringADConfigManager.Tracer.TraceDebug((long)this.GetHashCode(), "MonitoringADConfigManager.GetConfig(): Ignoring cached config staleness check."); } MonitoringADConfigManager.Tracer.TraceDebug <TimeSpan, DateTime>((long)this.GetHashCode(), "MonitoringADConfigManager.GetConfig(): Returning cached config of age ({0}), created at '{1} UTC'", timeSpan, monitoringADConfig.CreateTimeUtc); return(monitoringADConfig); } if (ex == null) { MonitoringADConfigManager.Tracer.TraceError((long)this.GetHashCode(), "MonitoringADConfigManager.GetConfig(): AD initial lookup has not completed yet."); throw new MonitoringADInitNotCompleteException(); } MonitoringADConfigManager.Tracer.TraceError <Exception>((long)this.GetHashCode(), "MonitoringADConfigManager.GetConfig(): Throwing last exception: {0}", ex); throw ex; }
protected override bool IsKnownException(Exception e) { return(AmExceptionHelper.IsKnownClusterException(this, e) || SystemConfigurationTasksHelper.IsKnownMapiDotNETException(e) || e is AmServerException || e is ObjectNotFoundException || base.IsKnownException(e)); }
// Token: 0x06001511 RID: 5393 RVA: 0x00053854 File Offset: 0x00051A54 protected virtual IEnumerable <IADDatabaseCopy> LookupDatabaseCopies(IADServer miniServer) { MonitoringADConfig.Tracer.TraceDebug <string>((long)this.GetHashCode(), "LookupDatabases ( {0} ): Searching for all valid/invalid database copies...", miniServer.Name); IEnumerable <IADDatabaseCopy> dbCopies = null; IADToplogyConfigurationSession adSession = this.AdSessionPartiallyConsistent; Exception ex = ADUtils.RunADOperation(delegate() { dbCopies = adSession.GetAllDatabaseCopies(miniServer); }, 2); if (ex != null) { MonitoringADConfig.Tracer.TraceError <string, string>((long)this.GetHashCode(), "LookupDatabases ( {0} ): Got exception: {1}", miniServer.Name, AmExceptionHelper.GetExceptionToStringOrNoneString(ex)); throw new MonitoringCouldNotFindDatabasesException(miniServer.Name, ex.Message, ex); } if (dbCopies == null) { dbCopies = new IADDatabaseCopy[0]; } return(dbCopies); }
// Token: 0x0600195E RID: 6494 RVA: 0x000696C0 File Offset: 0x000678C0 private LocalizedString RunPrereqsForAssignSpare(AutoReseedWorkflowState state) { this.TraceBeginPrereqs(state); if (state.ReseedRecoveryActionRetryCount >= RegistryParameters.AutoReseedDbFailedAssignSpareRetryCountMax) { int autoReseedDbFailedAssignSpareRetryCountMax = RegistryParameters.AutoReseedDbFailedAssignSpareRetryCountMax; base.TraceError("RunPrereqsForAssignSpare(): Failing 'AssignSpare' prereqs since ReseedRecoveryActionRetryCount ({0}) exceeds AutoReseedDbFailedAssignSpareRetryCountMax ({1}). Workflow will try InPlaceReseed stage next.", new object[] { state.ReseedRecoveryActionRetryCount, autoReseedDbFailedAssignSpareRetryCountMax }); ReplayCrimsonEvents.AutoReseedWorkflowDbSpareRetryExceeded.Log <string, Guid, string, string, int>(base.Context.Database.Name, base.Context.Database.Guid, base.WorkflowName, base.WorkflowLaunchReason, autoReseedDbFailedAssignSpareRetryCountMax); state.UpdateReseedRecoveryAction(ReseedState.InPlaceReseed); return(ReplayStrings.AutoReseedFailedSeedRetryExceeded(autoReseedDbFailedAssignSpareRetryCountMax)); } state.UpdateReseedRecoveryAction(ReseedState.AssignSpare); if (string.IsNullOrEmpty(base.Context.TargetCopyStatus.CopyStatus.DatabaseVolumeName) || string.IsNullOrEmpty(base.Context.TargetCopyStatus.CopyStatus.LogVolumeName)) { return(ReplayStrings.AutoReseedFailedToFindTargetVolumeName(AmExceptionHelper.GetMessageOrNoneString(base.Context.TargetCopyStatus.CopyStatus.VolumeInfoLastError))); } MountedFolderPath mountedFolderPath = new MountedFolderPath(base.Context.TargetCopyStatus.CopyStatus.LogVolumeName); MountedFolderPath other = new MountedFolderPath(base.Context.TargetCopyStatus.CopyStatus.DatabaseVolumeName); if (!mountedFolderPath.Equals(other)) { return(ReplayStrings.AutoReseedLogAndDbNotOnSameVolume); } IEnumerable <CopyStatusClientCachedEntry> enumerable = this.FindTargetDbSetFromDatabaseGroup(base.Context); if (enumerable == null) { enumerable = this.FindTargetDbSetFromNeighbors(base.Context); if (enumerable == null) { return(ReplayStrings.AutoReseedFailedToFindVolumeName); } } MountedFolderPath mountedFolderPath2; if (this.IsVolumeRecentlyAssigned(enumerable, out mountedFolderPath2)) { ReplayCrimsonEvents.AutoReseedWorkflowDbSpareRecentlyAssigned.Log <string, Guid, string, string>(base.Context.Database.Name, base.Context.Database.Guid, base.WorkflowName, base.WorkflowLaunchReason); state.AssignedVolumeName = mountedFolderPath2.Path; state.UpdateReseedRecoveryAction(ReseedState.InPlaceReseed); } else if (this.DoesMountPointNeedToBeFixed(enumerable, out mountedFolderPath2)) { base.TraceDebug("Database copy is missing a mount point, and it will be fixed up to point to volume '{0}'", new object[] { mountedFolderPath2 }); this.m_volumeForMissingMountPoint = mountedFolderPath2; } else { string databaseNames = FailedSuspendedCopyAutoReseedWorkflow.GetDatabaseNames(enumerable); if (!enumerable.All((CopyStatusClientCachedEntry status) => !status.IsActive)) { return(ReplayStrings.AutoReseedNotAllCopiesPassive(databaseNames)); } if (!enumerable.All((CopyStatusClientCachedEntry status) => status.Result == CopyStatusRpcResult.Success && status.CopyStatus.CopyStatus == CopyStatusEnum.FailedAndSuspended)) { return(ReplayStrings.AutoReseedNotAllCopiesOnVolumeFailedSuspended(databaseNames)); } } this.m_targetDbSet = enumerable; return(LocalizedString.Empty); }
private void LogWorkflowEnded(Exception exception) { if (exception == null) { AutoReseedWorkflow.Tracer.TraceDebug <string, string, Guid>((long)this.GetHashCode(), "AutoReseed workflow '{0}' for database '{1}' [{2}] completed successfully.", this.WorkflowName, this.Context.Database.Name, this.Context.Database.Guid); ReplayCrimsonEvents.AutoReseedManagerWorkflowCompletedSuccess.Log <string, Guid, string, string>(this.Context.Database.Name, this.Context.Database.Guid, this.WorkflowName, this.m_workflowLaunchReason); return; } if (exception is AutoReseedThrottledException) { AutoReseedWorkflow.Tracer.TraceError((long)this.GetHashCode(), "AutoReseed workflow '{0}' for database '{1}' [{2}] got throttled! Error: {3}", new object[] { this.WorkflowName, this.Context.Database.Name, this.Context.Database.Guid, AmExceptionHelper.GetExceptionMessageOrNoneString(exception) }); ReplayCrimsonEvents.AutoReseedManagerWorkflowThrottled.LogPeriodic <string, Guid, string, string, string>(this.Context.Database.Guid, DiagCore.DefaultEventSuppressionInterval, this.Context.Database.Name, this.Context.Database.Guid, this.WorkflowName, this.m_workflowLaunchReason, AmExceptionHelper.GetExceptionMessageOrNoneString(exception)); return; } AutoReseedWorkflow.Tracer.TraceError((long)this.GetHashCode(), "AutoReseed workflow '{0}' for database '{1}' [{2}] failed! Error: {3}", new object[] { this.WorkflowName, this.Context.Database.Name, this.Context.Database.Guid, AmExceptionHelper.GetExceptionMessageOrNoneString(exception) }); ReplayCrimsonEvents.AutoReseedManagerWorkflowFailed.Log <string, Guid, string, string, string>(this.Context.Database.Name, this.Context.Database.Guid, this.WorkflowName, this.m_workflowLaunchReason, AmExceptionHelper.GetExceptionMessageOrNoneString(exception)); }
protected override bool IsKnownException(Exception ex) { return(ex is WmiException || ex is ArgumentException || AmExceptionHelper.IsKnownClusterException(this, ex) || ex is SeederServerException || ex is TaskServerException || base.IsKnownException(ex)); }
internal static Exception DisableConfigureMountPoints() { MountPointUtil.Tracer.TraceDebug <string>(0L, "DisableConfigureMountPoints() Attempting to reset regkey {0} to 0. This will disable post reinstall mountpoint configuration.", "ConfigureMountPointsPostReInstall"); Exception ex = RegistryUtil.RunRegistryFunction(delegate() { using (RegistryKey registryKey = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\ExchangeServer\\v15\\Replay\\AutoReseed")) { registryKey.SetValue("ConfigureMountPointsPostReInstall", 0, RegistryValueKind.DWord); } }); if (ex != null) { MountPointUtil.Tracer.TraceError <string, string>(0L, "IsConfigureMountPointsEnabled() Unable to set registry key '{0}'. Error {1}", "SOFTWARE\\Microsoft\\ExchangeServer\\v15\\Replay\\AutoReseed", AmExceptionHelper.GetExceptionMessageOrNoneString(ex)); } return(ex); }
internal static bool IsConfigureMountPointsEnabled() { int propertyValue = -1; Exception ex = RegistryUtil.RunRegistryFunction(delegate() { using (RegistryKey registryKey = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\ExchangeServer\\v15\\Replay\\AutoReseed")) { object value = registryKey.GetValue("ConfigureMountPointsPostReInstall"); propertyValue = ((value == null) ? 0 : ((int)value)); } }); if (ex != null) { MountPointUtil.Tracer.TraceError <string, string>(0L, "IsConfigureMountPointsEnabled() Unable to read registry key '{0}'. Error {1}", "SOFTWARE\\Microsoft\\ExchangeServer\\v15\\Replay\\AutoReseed", AmExceptionHelper.GetExceptionMessageOrNoneString(ex)); } if (propertyValue == 0) { MountPointUtil.Tracer.TraceDebug <string, int>(0L, "IsConfigureMountPointsEnabled() key {0} doesn't exist or is set to {1}. Returning false.", "ConfigureMountPointsPostReInstall", propertyValue); return(false); } MountPointUtil.Tracer.TraceDebug <string, int>(0L, "IsConfigureMountPointsEnabled() key {0} exists and is set to {1}. Returning true.", "ConfigureMountPointsPostReInstall", propertyValue); return(true); }
// Token: 0x0600150E RID: 5390 RVA: 0x00053734 File Offset: 0x00051934 protected virtual IADServer LookupMiniServer(string serverShortName) { Exception ex = null; IADServer iadserver = this.AdLookup.MiniServerLookup.FindMiniServerByShortNameEx(serverShortName, out ex); if (iadserver == null) { MonitoringADConfig.Tracer.TraceError <string, string>((long)this.GetHashCode(), "LookupMiniServer( {0} ): Got exception: {1}", serverShortName, AmExceptionHelper.GetExceptionToStringOrNoneString(ex)); throw new MonitoringCouldNotFindMiniServerException(serverShortName, ex); } MonitoringADConfig.Tracer.TraceDebug <string>((long)this.GetHashCode(), "LookupMiniServer( {0} ): Found MiniServer object.", serverShortName); return(iadserver); }
// Token: 0x0600150F RID: 5391 RVA: 0x00053798 File Offset: 0x00051998 protected virtual IADDatabaseAvailabilityGroup LookupDag(ADObjectId dagObjectId) { Exception ex = null; IADDatabaseAvailabilityGroup iaddatabaseAvailabilityGroup = this.AdLookup.DagLookup.ReadAdObjectByObjectIdEx(dagObjectId, out ex); if (iaddatabaseAvailabilityGroup == null) { MonitoringADConfig.Tracer.TraceError <ADObjectId, string>((long)this.GetHashCode(), "LookupDag( {0} ): Got exception: {1}", dagObjectId, AmExceptionHelper.GetExceptionToStringOrNoneString(ex)); throw new MonitoringCouldNotFindDagException(dagObjectId.Name, AmExceptionHelper.GetExceptionMessageOrNoneString(ex), ex); } MonitoringADConfig.Tracer.TraceDebug <ADObjectId>((long)this.GetHashCode(), "LookupDag( {0} ): Found DAG object.", dagObjectId); return(iaddatabaseAvailabilityGroup); }
// Token: 0x06001960 RID: 6496 RVA: 0x00069970 File Offset: 0x00067B70 private LocalizedString RunPrereqsForInPlaceReseed(AutoReseedWorkflowState state) { this.TraceBeginPrereqs(state); int autoReseedDbFailedReseedRetryCountMax = RegistryParameters.AutoReseedDbFailedReseedRetryCountMax; TimeSpan timeSpan = TimeSpan.FromSeconds((double)RegistryParameters.AutoReseedDbFailedSuspendedWorkflowResetIntervalInSecs); timeSpan = this.GetWorkflowSuppressionInterval(timeSpan); if (state.ReseedRecoveryActionRetryCount >= RegistryParameters.AutoReseedDbFailedReseedRetryCountMax) { state.WriteWorkflowNextExecutionDueTime(timeSpan); base.TraceError("RunPrereqsForInPlaceReseed(): Failing 'InPlaceReseed' prereqs since ReseedRecoveryActionRetryCount ({0}) exceeds AutoReseedDbFailedReseedRetryCountMax ({1}). Workflow will next run after {2}.", new object[] { state.ReseedRecoveryActionRetryCount, autoReseedDbFailedReseedRetryCountMax, timeSpan }); ReplayCrimsonEvents.AutoReseedWorkflowDbReseedRetryExceeded.Log <string, Guid, string, string, int, TimeSpan>(base.Context.Database.Name, base.Context.Database.Guid, base.WorkflowName, base.WorkflowLaunchReason, autoReseedDbFailedReseedRetryCountMax, timeSpan); return(ReplayStrings.AutoReseedFailedSeedRetryExceeded(autoReseedDbFailedReseedRetryCountMax)); } if (base.Context.TargetCopyStatus.CopyStatus.InPlaceReseedBlocked) { IEnumerable <CopyStatusClientCachedEntry> enumerable = this.FindTargetDbSetFromDatabaseGroup(base.Context); if (enumerable == null) { enumerable = this.FindTargetDbSetFromNeighbors(base.Context); if (enumerable == null) { return(ReplayStrings.AutoReseedFailedToFindVolumeName); } } MountedFolderPath mountedFolderPath; if (!this.IsVolumeRecentlyAssigned(enumerable, out mountedFolderPath)) { string messageOrNoneString = AmExceptionHelper.GetMessageOrNoneString(base.Context.TargetCopyStatus.CopyStatus.ErrorMessage); state.WriteWorkflowNextExecutionDueTime(timeSpan); state.ReseedRecoveryActionRetryCount = RegistryParameters.AutoReseedDbFailedReseedRetryCountMax; base.TraceError("RunPrereqsForInPlaceReseed(): Failing 'InPlaceReseed' prereqs since in-place reseed is blocked. DatabaseCopy has ErrorMessage: {0}. Workflow will next run after {1}.", new object[] { messageOrNoneString, timeSpan }); ReplayCrimsonEvents.AutoReseedWorkflowDbInPlaceReseedBlocked.Log <string, Guid, string, string, string>(base.Context.Database.Name, base.Context.Database.Guid, base.WorkflowName, base.WorkflowLaunchReason, messageOrNoneString); return(ReplayStrings.AutoReseedFailedInPlaceReseedBlocked(messageOrNoneString)); } } string edbFilePath = base.Context.Database.EdbFilePath.PathName; if (File.Exists(edbFilePath) && !state.IgnoreInPlaceOverwriteDelay) { DateTime lastWriteTimeUtc = DateTime.MaxValue; Exception ex = MountPointUtil.HandleIOExceptions(delegate { FileInfo fileInfo = new FileInfo(edbFilePath); lastWriteTimeUtc = fileInfo.LastWriteTimeUtc; }); if (ex != null) { lastWriteTimeUtc = base.Context.TargetCopyStatus.CopyStatus.LastStatusTransitionTime; base.TraceError("RunPrereqsForInPlaceReseed(): Failed to read LastWriteTimeUtc of edb file '{0}'. Using LastStatusTransitionTime of '{1}' instead. Exception: {2}", new object[] { edbFilePath, lastWriteTimeUtc, ex }); } TimeSpan timeSpan2 = DateTime.UtcNow.Subtract(lastWriteTimeUtc); TimeSpan timeSpan3 = TimeSpan.FromSeconds((double)RegistryParameters.AutoReseedDbFailedInPlaceReseedDelayInSecs); base.TraceDebug("RunPrereqsForInPlaceReseed(): Found EDB file at '{0}'. The copy was last FailedAndSuspended '{1}' duration ago. Configured reseed delay is: '{2}'.", new object[] { edbFilePath, timeSpan2, timeSpan3 }); if (timeSpan2 <= timeSpan3) { TimeSpan workflowSuppressionInterval = this.GetWorkflowSuppressionInterval(timeSpan3); state.WriteWorkflowNextExecutionDueTime(workflowSuppressionInterval); base.TraceError("RunPrereqsForInPlaceReseed(): EDB file exists and Reseed is being attempted too soon. Reseed will be blocked until the configured reseed delay period. Workflow will next run after {0}.", new object[] { workflowSuppressionInterval }); ReplayCrimsonEvents.AutoReseedWorkflowInPlaceReseedTooSoon.Log <string, Guid, string, string, string, TimeSpan, TimeSpan, TimeSpan>(base.Context.Database.Name, base.Context.Database.Guid, base.WorkflowName, base.WorkflowLaunchReason, edbFilePath, timeSpan2, timeSpan3, workflowSuppressionInterval); return(ReplayStrings.AutoReseedInPlaceReseedTooSoon(timeSpan2.ToString(), timeSpan3.ToString())); } } int num; if (!base.Context.ReseedLimiter.TryStartSeed(out num)) { base.TraceError("RunPrereqsForInPlaceReseed(): Seed is being skipped for now because maximum number of concurrent seeds has been reached: {0}", new object[] { num }); return(ReplayStrings.AutoReseedTooManyConcurrentSeeds(num)); } return(LocalizedString.Empty); }
public void CheckReseedBlocked() { lock (this.m_instance) { if (this.m_replayState.ReseedBlocked) { ExTraceGlobals.ReplicaInstanceTracer.TraceError <string>((long)this.GetHashCode(), "CheckReseedBlocked: {0}: ReseedBlocked is set, so throwing.", this.m_displayName); throw new SeederInstanceReseedBlockedException(this.m_displayName, AmExceptionHelper.GetMessageOrNoneString(this.ErrorMessage)); } } }
// Token: 0x06000F1E RID: 3870 RVA: 0x00040268 File Offset: 0x0003E468 public static SafetyNetInfo Deserialize(string dbName, string blob, Trace tracer, bool throwOnError) { Exception ex = null; SafetyNetInfo safetyNetInfo = null; object obj = SerializationUtil.XmlToObject(blob, typeof(SafetyNetInfo), out ex); if (ex == null) { safetyNetInfo = (obj as SafetyNetInfo); if (safetyNetInfo == null && tracer != null) { tracer.TraceError <string, string>(0L, "Deserialized object {0} was not compatible with expected type {1}.", (obj != null) ? obj.GetType().Name : "(null)", typeof(SafetyNetInfo).Name); } else { safetyNetInfo.m_version = new Version(safetyNetInfo.m_versionString); safetyNetInfo.m_fModified = false; safetyNetInfo.m_serializedForm = blob; } } if (ex != null && tracer != null) { tracer.TraceError <string, string>(0L, "Deserialization of object {0} failed:\n{1}", typeof(SafetyNetInfo).Name, ex.ToString()); } if (safetyNetInfo == null && throwOnError) { throw new FailedToDeserializeDumpsterRequestStrException(dbName, blob, typeof(SafetyNetInfo).Name, AmExceptionHelper.GetExceptionMessageOrNoneString(ex), ex); } return(safetyNetInfo); }
private void UpdateVolumeForNeverMountedActives(IMonitoringADConfig adConfig) { IEnumerable <IADDatabase> enumerable = adConfig.DatabaseMap[adConfig.TargetServerName]; IEnumerable <CopyStatusClientCachedEntry> copyStatusesByServer = this.m_statusLookup.GetCopyStatusesByServer(adConfig.TargetServerName, enumerable, CopyStatusClientLookupFlags.None); Exception ex = null; List <IADDatabase> neverMountedActives = this.m_volumeManager.GetNeverMountedActives(enumerable, adConfig, copyStatusesByServer); if (neverMountedActives != null && neverMountedActives.Count > 0) { ICollection <string> source = from db in neverMountedActives select db.Name; DiskReclaimerManager.Tracer.TraceDebug <int, string>((long)this.GetHashCode(), "DiskReclaimer: UpdateVolumeForNeverMountedActives() Number of never mounted active databases missing volume = {0}. Databases: '{1}'", neverMountedActives.Count, string.Join(",", source.ToArray <string>())); ReplayCrimsonEvents.DiskReclaimerNeverMountedActives.Log <int, string>(neverMountedActives.Count, string.Join(",", source.ToArray <string>())); } foreach (IADDatabase iaddatabase in neverMountedActives) { bool flag = false; DatabaseVolumeInfo instance = DatabaseVolumeInfo.GetInstance(iaddatabase.EdbFilePath.PathName, iaddatabase.LogFolderPath.PathName, iaddatabase.Name, adConfig.Dag.AutoDagVolumesRootFolderPath.PathName, adConfig.Dag.AutoDagDatabasesRootFolderPath.PathName, adConfig.Dag.AutoDagDatabaseCopiesPerVolume); if (instance.IsValid && MountPointUtil.IsDirectoryAccessibleMountPoint(instance.DatabaseVolumeMountPoint.Path, out ex)) { flag = true; } else { ReplayCrimsonEvents.DiskReclaimerNeverMountedActiveMissingVolume.Log <string>(iaddatabase.Name); if (this.m_volumeManager.FixActiveDatabaseMountPoint(iaddatabase, enumerable, adConfig, out ex, true)) { flag = true; this.m_volumeManager.UpdateVolumeInfoCopyState(iaddatabase.Guid, this.m_replicaInstanceManager); } else { DiskReclaimerManager.Tracer.TraceError <string, string>((long)this.GetHashCode(), "DiskReclaimer: UpdateVolumeForNeverMountedActives() failed to fix up active database: '{0}' mountpoint. Error: {1}", iaddatabase.Name, AmExceptionHelper.GetExceptionMessageOrNoneString(ex)); ReplayCrimsonEvents.DiskReclaimerFixActiveMountPointError.Log <string, string>(iaddatabase.Name, ex.Message); } } if (flag) { ex = this.MountDatabaseWrapper(iaddatabase); if (ex != null) { DiskReclaimerManager.Tracer.TraceError <string, string>((long)this.GetHashCode(), "DiskReclaimer: UpdateVolumeForNeverMountedActives() failed to mount active database: '{0}' mountpoint. Error: {1}", iaddatabase.Name, ex.Message); ReplayCrimsonEvents.DiskReclaimerMountActiveDatabaseError.Log <string, string>(iaddatabase.Name, ex.Message); } } } ReplayCrimsonEvents.DiskReclaimerFixActiveMountPointCompleted.Log <string>(adConfig.TargetServerName.NetbiosName); this.m_volumeManager.Refresh(adConfig); }
protected override bool IsKnownException(Exception exception) { return(exception is IdentityNotMappedException || exception is AmClusterException || exception is ADTransientException || exception is ADExternalException || exception is ADOperationException || exception is AmServerException || exception is ObjectNotFoundException || AmExceptionHelper.IsKnownClusterException(this, exception) || base.IsKnownException(exception)); }