// Token: 0x0600131A RID: 4890 RVA: 0x0004D088 File Offset: 0x0004B288 public bool DatabaseHasSufficientAvailability() { if (this.LastReading != null) { if (!(ExDateTime.UtcNow - this.LastReadingTime >= this.MaxProbeFreq)) { goto IL_C6; } } try { IMonitoringADConfig configIgnoringStaleness = this.ADConfigProvider.GetConfigIgnoringStaleness(true); DatabaseAvailabilityValidator databaseAvailabilityValidator = new DatabaseAvailabilityValidator(this.Database, this.MinAvailableCopies, this.CopyStatusLookup, configIgnoringStaleness, null, true); this.LastReading = databaseAvailabilityValidator.Run(); this.LastReadingTime = ExDateTime.Now; } catch (MonitoringADServiceShuttingDownException arg) { AvailabilitySensor.Tracer.TraceError <MonitoringADServiceShuttingDownException>((long)this.GetHashCode(), "AvailabilitySensor: Got service shutting down exception when retrieving AD config: {0}", arg); } catch (MonitoringADConfigException ex) { this.FailedToRead = true; AvailabilitySensor.Tracer.TraceError <MonitoringADConfigException>((long)this.GetHashCode(), "AvailabilitySensor: Got exception when retrieving AD config: {0}", ex); ReplayCrimsonEvents.AvailabilitySensorError.LogPeriodic <string, MonitoringADConfigException>(this.GetHashCode(), DiagCore.DefaultEventSuppressionInterval, ex.Message, ex); } IL_C6: return(this.LastReading != null && this.LastReading.HealthyCopiesCount >= this.MinAvailableCopies); }
private void ProcessDatabaseInternal(IADDatabase db, IMonitoringADConfig adConfig) { if (db.ReplicationType != ReplicationType.Remote) { ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Database '{0}' is not a replicated database. Skipping this database.", db.Name); return; } IADDatabaseCopy databaseCopy = this.GetDatabaseCopy(db, AmServerName.LocalComputerName); EnhancedTimeSpan replayLagTime = databaseCopy.ReplayLagTime; if (replayLagTime == EnhancedTimeSpan.Zero) { ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' is not a lag copy. Skipping this database.", db.Name); return; } ReplayLagManager.Tracer.TraceDebug <string, EnhancedTimeSpan>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' is a lag copy. Configured lag: {1}. Processing this database.", db.Name, replayLagTime); DatabaseAvailabilityValidator databaseAvailabilityValidator = new DatabaseAvailabilityValidator(db, ReplayLagManager.NUM_AVAILABLE_NONLAG_COPIES_MIN, this.m_statusLookup, adConfig, null, true); IHealthValidationResult healthValidationResult = databaseAvailabilityValidator.Run(); int num = ReplayLagManager.NUM_AVAILABLE_NONLAG_COPIES_MIN; if (healthValidationResult.IsTargetCopyHealthy) { num++; ReplayLagManager.Tracer.TraceDebug <string, int>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local lag-copy of Database '{0}' is available. Increasing the minimum available copy count to: {1}", db.Name, num); } CopyStatusClientCachedEntry targetCopyStatus = healthValidationResult.TargetCopyStatus; if (healthValidationResult.HealthyCopiesCount >= num) { ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' has met availability critera. Replay Lag will be re-instated as necessary.", db.Name); if (this.m_errorSuppression.ReportSuccess(db.Guid, ReplayLagManager.EnableLagSuppressionWindow)) { this.EnableReplayLag(db, targetCopyStatus); return; } ReplayLagManager.Tracer.TraceDebug <string, double>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: '{0}': Skipping EnableReplayLag() due to transient suppression of {1} secs", db.Name, ReplayLagManager.EnableLagSuppressionWindow.TotalSeconds); return; } else { ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' has *NOT* met availability critera. Replay Lag will be played down as necessary.", db.Name); string errorMessageWithoutFullStatus = healthValidationResult.ErrorMessageWithoutFullStatus; if (this.m_errorSuppression.ReportFailure(db.Guid, ReplayLagManager.DisableLagSuppressionWindow)) { this.DisableReplayLag(db, targetCopyStatus, errorMessageWithoutFullStatus); return; } ReplayLagManager.Tracer.TraceDebug <string, double>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: '{0}': Skipping DisableReplayLag() due to transient suppression of {1} secs", db.Name, ReplayLagManager.DisableLagSuppressionWindow.TotalSeconds); ReplayCrimsonEvents.RLMDisableReplayLagRequestSuppressed.LogPeriodic <string, string, Guid, string, TimeSpan>(Environment.MachineName, DateTimeHelper.FourHours, db.Name, Environment.MachineName, db.Guid, errorMessageWithoutFullStatus, ReplayLagManager.DisableLagSuppressionWindow); return; } }
private void RaiseDatabaseAvailabilityAlertIfNecessary(IADDatabase db, IMonitoringADConfig adConfig) { DatabaseHealthMonitor.Tracer.TraceDebug <string>((long)this.GetHashCode(), "DatabaseHealthMonitor.RaiseDatabaseAvailabilityAlertIfNecessary: DB '{0}': Starting DB-level availability checks.", db.Name); DatabaseAvailabilityValidator databaseAvailabilityValidator = new DatabaseAvailabilityValidator(db, DatabaseHealthMonitor.NUM_HEALTHY_COPIES_MIN, this.m_statusLookup, adConfig, this.m_propertyUpdateTracker, false); IHealthValidationResult result = databaseAvailabilityValidator.Run(); this.m_dbAlerts.OneAvailableCopy.RaiseAppropriateAlertIfNecessary(result); if (adConfig.Dag.DatacenterActivationMode == DatacenterActivationModeOption.DagOnly) { this.m_dbAlerts.OneAvailableCopySite.RaiseAppropriateAlertIfNecessary(result); return; } DatabaseHealthMonitor.Tracer.TraceDebug <string, DatacenterActivationModeOption>((long)this.GetHashCode(), "DatabaseHealthMonitor.RaiseDatabaseAvailabilityAlertIfNecessary: DB '{0}': Skipping raising site alerts because DatacenterActivationMode is '{1}'.", db.Name, adConfig.Dag.DatacenterActivationMode); }