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)); }
// 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); }
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 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); }
// 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); }
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); }
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; }