// Token: 0x06000EB6 RID: 3766 RVA: 0x0003EF58 File Offset: 0x0003D158 public void LogDiffDetailsToEventLog() { this.Container.Analyze(); DataStoreDiffReport report = this.Container.Report; DxStoreHACrimsonEvents.DataStoreDiffStats.Log <bool, int, int, int, int, int, int, int, int, int, int, int, int, int, int>(report.IsEverythingMatches, report.TotalKeysCount, report.TotalPropertiesCount, report.TotalClusdbKeysCount, report.TotalClusdbPropertiesCount, report.TotalDxStoreKeysCount, report.TotalDxStorePropertiesCount, report.CountKeysOnlyInClusdb, report.CountKeysOnlyInDxStore, report.CountKeysInClusdbAndDxStoreAndPropertiesMatch, report.CountKeysInClusdbAndDxStoreButPropertiesDifferent, report.CountPropertiesOnlyInClusdb, report.CountPropertiesOnlyInDxStore, report.CountPropertiesSameInClusdbAndDxStore, report.CountPropertiesDifferentInClusdbAndDxStore); string verboseReport = report.VerboseReport; int length = verboseReport.Length; int num = RegistryParameters.DistributedStoreDiffVerboseReportMaxCharsPerLine; if (num == 0) { num = 500; } int num2 = (int)Math.Ceiling((double)length / (double)num); int num3 = 1; int i = 0; while (i < length) { string text = verboseReport.Substring(i, Math.Min(num, length - i)); DxStoreHACrimsonEvents.DataStoreDiffVerboseReport.Log <int, int, string>(num3, num2, text); i += num; num3++; } }
public static DataStoreDiffReport Create(IEnumerable <DataStoreMergedContainer.KeyEntry> keyEntries, DiffReportVerboseMode diffReportVerboseMode) { DataStoreDiffReport dataStoreDiffReport = new DataStoreDiffReport(); foreach (DataStoreMergedContainer.KeyEntry keyEntry in keyEntries) { if (keyEntry.IsPresentOnlyInClusdb) { dataStoreDiffReport.KeysOnlyInClusdb.Add(keyEntry); } else if (keyEntry.IsPresentOnlyInDxStore) { dataStoreDiffReport.KeysOnlyInDxStore.Add(keyEntry); } else if (keyEntry.IsPropertiesMatch) { dataStoreDiffReport.KeysInBothAndPropertiesMatch.Add(keyEntry); } else { dataStoreDiffReport.KeysInBothButPropertiesMismatch.Add(keyEntry); } dataStoreDiffReport.CountPropertiesOnlyInClusdb += keyEntry.PropertiesOnlyInClusdbCount; dataStoreDiffReport.CountPropertiesOnlyInDxStore += keyEntry.PropertiesOnlyInDxStoreCount; dataStoreDiffReport.CountPropertiesSameInClusdbAndDxStore += keyEntry.PropertyMatchCount; dataStoreDiffReport.CountPropertiesDifferentInClusdbAndDxStore += keyEntry.PropertyDifferentCount; } dataStoreDiffReport.VerboseReport = dataStoreDiffReport.GenerateVerboseReport(diffReportVerboseMode); return(dataStoreDiffReport); }
internal bool IsLastLogPropertiesAreTheOnlyDifference(DataStoreDiffReport report) { if (report.CountKeysOnlyInClusdb == 0 && report.CountKeysOnlyInDxStore == 0 && report.CountKeysInClusdbAndDxStoreButPropertiesDifferent == 1) { DataStoreMergedContainer.KeyEntry keyEntry = report.KeysInBothButPropertiesMismatch.FirstOrDefault <DataStoreMergedContainer.KeyEntry>(); if (keyEntry != null && Utils.IsEqual(keyEntry.Name, "\\ExchangeActiveManager\\LastLog", StringComparison.OrdinalIgnoreCase)) { return(true); } } return(false); }
public void Analyze() { if (!this.IsAnalysisComplete) { this.IsAnalysisComplete = true; foreach (DataStoreMergedContainer.KeyEntry keyEntry in this.Entries.Values) { keyEntry.Analyze(); } this.Report = DataStoreDiffReport.Create(this.Entries.Values, this.DiffReportVerboseMode); } }
internal void CheckDataStores() { IActiveManagerSettings settings = DxStoreSetting.Instance.GetSettings(); if (!settings.DxStoreIsPeriodicFixupEnabled || settings.DxStoreRunMode != DxStoreMode.Shadow) { return; } DateTimeOffset lastUpdateTime = DateTimeOffset.MinValue; DataStoreSnapshotAnalyzer analyzer = new DataStoreSnapshotAnalyzer((DiffReportVerboseMode)RegistryParameters.DistributedStoreDiffReportVerboseFlags); string text = null; if (!analyzer.IsPaxosConfiguredAndLeaderExist(out text)) { if (!this.isPaxosNotReadyLogged) { DxStoreHACrimsonEvents.DataStoreValidationSkipped.Log <string, string>("Paxos either not configured or paxos leader does not exist", text); this.isPaxosNotReadyLogged = true; } return; } this.isPaxosNotReadyLogged = false; Exception ex = Utils.RunBestEffort(delegate { lastUpdateTime = this.GetLastAnalyzeTime(); }); if (ex != null) { if (!this.isLastAnalyzeTimeFailureLogged) { DxStoreHACrimsonEvents.DataStoreValidationFailed.Log <string, Exception>("GetLastAnalyzeTime", ex); this.isLastAnalyzeTimeFailureLogged = true; } return; } this.isLastAnalyzeTimeFailureLogged = false; DateTimeOffset now = DateTimeOffset.Now; DateTimeOffset dateTimeOffset = now; if (lastUpdateTime != DateTimeOffset.MinValue) { dateTimeOffset = lastUpdateTime.Add(TimeSpan.FromSeconds((double)RegistryParameters.DistributedStoreConsistencyVerifyIntervalInSecs)); } if (dateTimeOffset > now) { if (this.lastRecordedDueTime < dateTimeOffset) { DxStoreHACrimsonEvents.DataStoreValidationSkipped.Log <string, DateTimeOffset>("Time not elapsed", dateTimeOffset); this.lastRecordedDueTime = dateTimeOffset; } return; } ex = Utils.RunBestEffort(delegate { analyzer.AnalyzeDataStores(); }); string timingInfoAsString = analyzer.GetTimingInfoAsString(); if (ex != null) { DxStoreHACrimsonEvents.DataStoreValidationFailed.Log <string, Exception>(string.Format("AnalyzeDataStores() failed. Phase: {0}, Timing: {1}", analyzer.AnalysisPhase, timingInfoAsString), ex); return; } DataStoreDiffReport report = analyzer.Container.Report; DxStoreHACrimsonEvents.DataStoreValidationCompleted.Log <bool, string>(report.IsEverythingMatches, timingInfoAsString); analyzer.LogDiffDetailsToEventLog(); this.SetLastAnalyzeTimeToNow(); bool flag = false; if (!report.IsEverythingMatches) { if (RegistryParameters.DistributedStoreDisableDxStoreFixUp) { DxStoreHACrimsonEvents.DataStoreValidationSkipped.Log <string, string>("Database fixup skipped since it is disabled in registry", string.Empty); } else if (report.TotalClusdbPropertiesCount > 0) { if (!this.IsLastLogPropertiesAreTheOnlyDifference(report)) { flag = true; } else { DxStoreHACrimsonEvents.DataStoreValidationSkipped.Log <string, string>("Database fixup skipped since last log properties are the only entries that have changed", string.Empty); } } else { DxStoreHACrimsonEvents.DataStoreValidationSkipped.Log <string, string>("Database fixup skipped since clusdb does not have single property", string.Empty); } } if (flag) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); ex = Utils.RunBestEffort(delegate { analyzer.CopyClusdbSnapshotToDxStore(); }); long elapsedMilliseconds = stopwatch.ElapsedMilliseconds; if (ex != null) { DxStoreHACrimsonEvents.DataStoreFailedToUpdate.Log <long, Exception>(stopwatch.ElapsedMilliseconds, ex); return; } DxStoreHACrimsonEvents.DataStoreSuccessfulyUpdated.Log <long, string>(stopwatch.ElapsedMilliseconds, string.Empty); } }