// Token: 0x06001BA1 RID: 7073 RVA: 0x00075F7C File Offset: 0x0007417C public AttemptCopyLastLogs(IPerfmonCounters perfmonCounters, ReplayConfiguration configuration, FileChecker fileChecker, bool performDivergenceCheck, ISetGeneration setGeneration, ISetViable setViable, bool fSkipHealthChecks, DatabaseMountDialOverride mountDialOverride, AcllPerformanceTracker acllPerf, string uniqueOperationId, int subactionAttemptNumber) { this.m_uniqueOperationId = uniqueOperationId; this.m_subactionAttemptNumber = subactionAttemptNumber; this.m_acllPerf = acllPerf; this.m_fPerformDivergenceCheck = performDivergenceCheck; this.m_fSkipHealthChecks = fSkipHealthChecks; this.m_mountDialOverride = mountDialOverride; this.m_perfmonCounters = perfmonCounters; this.m_configuration = configuration; string displayName = this.m_configuration.DisplayName; this.m_setBrokenForCopier = new SimpleSetBroken(displayName); this.m_setBrokenForInspector = new SimpleSetBroken(displayName); this.m_setBrokenForReplayer = new SimpleSetBroken(displayName); this.m_setBrokenForOther = new SimpleSetBroken(displayName); this.m_setGeneration = setGeneration; this.m_setViable = setViable; this.m_state = this.m_configuration.ReplayState; this.m_fileChecker = fileChecker; this.m_fileState = fileChecker.FileState; this.m_logCopier = null; this.m_logInspector = null; this.m_remoteConfig = (this.m_configuration as RemoteReplayConfiguration); this.NumberOfLogsLost = -1L; DiagCore.RetailAssert(this.m_remoteConfig != null, "ACLL is only supported for HA replicated databases", new object[0]); }
// Token: 0x06001444 RID: 5188 RVA: 0x00051A58 File Offset: 0x0004FC58 public DatabaseValidationCheck.Result Validate(DatabaseValidationCheck.Arguments args, ref LocalizedString error) { DiagCore.RetailAssert(args.Status != null, "args.Status cannot be null!", new object[0]); DatabaseValidationCheck.Tracer.TraceDebug((long)this.GetHashCode(), "Check '{0}' is starting against database copy '{1}'. [ActiveServer: {2}, TargetServer: {3}, IsActive: {4}]", new object[] { this.CheckName, args.DatabaseCopyName, args.ActiveServer.NetbiosName, args.TargetServer.NetbiosName, args.Status.IsActive }); if (!this.IsPrerequisiteMetForCheck(args)) { DatabaseValidationCheck.Tracer.TraceError <string, string>((long)this.GetHashCode(), "Check '{0}' is skipping for database copy '{1}' because prereqs were not met. Returning Passed result.", this.CheckName, args.DatabaseCopyName); return(DatabaseValidationCheck.Result.Passed); } DatabaseValidationCheck.Result result = this.ValidateInternal(args, ref error); if (result == DatabaseValidationCheck.Result.Passed) { DatabaseValidationCheck.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "Check '{0}' for database copy '{1}' Passed.", this.CheckName, args.DatabaseCopyName); } else { DatabaseValidationCheck.Tracer.TraceError((long)this.GetHashCode(), "Check '{0}' for database copy '{1}' returned result '{2}'. Error: {3}", new object[] { this.CheckName, args.DatabaseCopyName, result, error }); } return(result); }
// Token: 0x060017C2 RID: 6082 RVA: 0x00062190 File Offset: 0x00060390 internal void Close() { this.m_closeCalled = true; this.m_tcpChannel.Close(); if (this.m_coconetCompressor != null) { this.m_coconetCompressor.Dispose(); } if (this.m_coconetDecompressor != null) { this.m_coconetDecompressor.Dispose(); } int num = 0; while (!this.WaitForAsyncRead(1000)) { num++; ExTraceGlobals.NetworkChannelTracer.TraceError <int>((long)this.GetHashCode(), "Timeout while aborting...still waiting for async read to complete after {0} secs", num); if (num > 30) { DiagCore.RetailAssert(false, "TCP stack is not responding properly", new object[0]); } } this.DisposeCompletionEvent(); }
public static void LogEvent(this ExEventLog.EventTuple tuple, string periodicKey, out bool fEventSuppressed, params object[] messageArgs) { DiagCore.EventLog.LogEvent(tuple, periodicKey, out fEventSuppressed, messageArgs); if (!fEventSuppressed) { string text = tuple.EventLogToString(messageArgs); if (!string.IsNullOrEmpty(text)) { string text2 = string.Empty; if (messageArgs.Length > 0) { text2 = string.Join(",\n", messageArgs); } EventLogEntryType entryType = tuple.EntryType; ReplayCrimsonEvent replayCrimsonEvent; switch (entryType) { case EventLogEntryType.Error: goto IL_7C; case EventLogEntryType.Warning: replayCrimsonEvent = ReplayCrimsonEvents.AppLogMirrorWarning; goto IL_8A; case (EventLogEntryType)3: goto IL_84; case EventLogEntryType.Information: break; default: if (entryType != EventLogEntryType.SuccessAudit) { if (entryType != EventLogEntryType.FailureAudit) { goto IL_84; } goto IL_7C; } break; } replayCrimsonEvent = ReplayCrimsonEvents.AppLogMirrorInformational; goto IL_8A; IL_7C: replayCrimsonEvent = ReplayCrimsonEvents.AppLogMirrorError; goto IL_8A; IL_84: replayCrimsonEvent = ReplayCrimsonEvents.AppLogMirrorInformational; IL_8A: replayCrimsonEvent.LogGeneric(new object[] { DiagCore.GetEventViewerEventId(tuple), text, text2 }); } } }
// Token: 0x0600097B RID: 2427 RVA: 0x0002CFA4 File Offset: 0x0002B1A4 private static void InternalTestParseLogfileDumpBadData() { ExTraceGlobals.EseutilWrapperTracer.TraceDebug(0L, "EseHelper.InternalTestParseLogfileDumpBadData"); string value = "LHGX, Create time:12/14/2005 15:30:42 Rand:9483281 Computer:, 00004B9E, 01/23/2006 09:09:02, 01/23/2006 09:06:33, 7.3704.8, 0x0" + Environment.NewLine + string.Empty; string value2 = "LRPI, 00000000EF1FB879, Insert , 005FE92F, THIS IS BAD DATA, 0000036E, 00000001, 0000000008DCDFA0, 0000000008DCDFD0" + Environment.NewLine + string.Empty; string text = EseHelper.CreateTemporaryFile(Path.GetTempPath()); DiagCore.RetailAssert(File.Exists(text), "Temporary file {0} doesn't exist.", new object[] { text }); using (StreamWriter streamWriter = new StreamWriter(text, false, Encoding.Unicode)) { streamWriter.Write(value); } try { EseHelper.ParseLogfileDump(text); DiagCore.RetailAssert(false, "Should have thrown an EseutilParseErrorException", new object[0]); } catch (EseutilParseErrorException) { } DiagCore.RetailAssert(!File.Exists(text), "File {0} should have been deleted.", new object[] { text }); text = EseHelper.CreateTemporaryFile(Path.GetTempPath()); DiagCore.RetailAssert(File.Exists(text), "Temporary file {0} doesn't exist.", new object[] { text }); using (StreamWriter streamWriter2 = new StreamWriter(text, false, Encoding.Unicode)) { streamWriter2.Write(value2); } try { EseHelper.ParseLogfileDump(text); DiagCore.RetailAssert(false, "Should have thrown an EseutilParseErrorException", new object[0]); } catch (EseutilParseErrorException) { } DiagCore.RetailAssert(!File.Exists(text), "File {0} should have been deleted.", new object[] { text }); try { EseHelper.GetLogRecords(Path.GetRandomFileName(), Path.GetTempPath()); DiagCore.RetailAssert(false, "Should have thrown EsentErrorException.", new object[0]); } catch (EsentErrorException) { } }
private static bool EseMessageIdToString(uint ec, int extcode, out string msg) { bool result = DiagCore.FormatMessageFromModule("eseback2.dll", ec, out msg, null); if (3355381765U == ec || 3355381764U == ec) { msg = SeedHelper.StrEmbedEsebackExtendedErrorCode(msg, extcode); } return(result); }
// Token: 0x06000977 RID: 2423 RVA: 0x0002C84C File Offset: 0x0002AA4C private static void InternalTestBaseNameFromLogfileName(string logfileName, string expectedBaseName) { string text = EseHelper.BaseNameFromLogfileName(logfileName); DiagCore.RetailAssert(expectedBaseName == text, "BaseNameFromLogfileName({0}) returned {1}, expected {2}", new object[] { logfileName, text, expectedBaseName }); }
// Token: 0x06001C8B RID: 7307 RVA: 0x0007DA38 File Offset: 0x0007BC38 private static void TestInternalCheck() { FileState.InternalCheck(true, "This InternalCheck should not fire", new object[0]); try { FileState.InternalCheck(false, "This InternalCheck should fire", new object[0]); DiagCore.RetailAssert(false, "Should have thrown FileStateInternalErrorException", new object[0]); } catch (FileStateInternalErrorException) { } }
public static void ReplaceLastLog(IReplayConfiguration config, long logGen, string oldFilePath, string newFilePath) { string targetLogFilePath = EseHelper.MakeLogFilePath(config, logGen, config.DestinationLogPath); string fileName = Path.GetFileName(targetLogFilePath); string tempNewFilePath = Path.Combine(config.DestinationLogPath, fileName + ".ReplacementNew"); string tempOldFilePath = oldFilePath + ".ReplacementOld"; string e00LogPath = EseHelper.MakeLogFilePath(config, 0L, config.DestinationLogPath); Exception ex = LastLogReplacer.HandleExceptions(delegate { if (!File.Exists(oldFilePath)) { DiagCore.AssertOrWatson(false, "ReplaceLastLog(): File '{0}' not found!", new object[] { oldFilePath }); throw new LastLogReplacementFailedFileNotFoundException(config.DisplayName, oldFilePath, e00LogPath); } if (!File.Exists(newFilePath)) { DiagCore.AssertOrWatson(false, "ReplaceLastLog(): File '{0}' not found!", new object[] { newFilePath }); throw new LastLogReplacementFailedFileNotFoundException(config.DisplayName, newFilePath, e00LogPath); } if (File.Exists(tempNewFilePath)) { DiagCore.AssertOrWatson(false, "ReplaceLastLog(): File '{0}' was not expected to be found. Was RollbackLastLogIfNecessary() successfully called?", new object[] { tempNewFilePath }); throw new LastLogReplacementFailedUnexpectedFileFoundException(config.DisplayName, tempNewFilePath, e00LogPath); } if (File.Exists(tempOldFilePath)) { DiagCore.AssertOrWatson(false, "ReplaceLastLog(): File '{0}' was not expected to be found. Was RollbackLastLogIfNecessary() successfully called?", new object[] { tempOldFilePath }); throw new LastLogReplacementFailedUnexpectedFileFoundException(config.DisplayName, tempOldFilePath, e00LogPath); } File.Move(newFilePath, tempNewFilePath); File.Move(oldFilePath, tempOldFilePath); File.Move(tempNewFilePath, targetLogFilePath); LastLogReplacer.MoveTempOldFileToBackupDir(config, tempOldFilePath); }); if (ex != null) { throw new LastLogReplacementFailedErrorException(config.DisplayName, e00LogPath, ex.Message, ex); } }
internal static string EventLogToString(this ExEventLog.EventTuple eventTuple, out int gle, params object[] arguments) { string result = null; if (DiagCore.s_clusmsgFullPath == null) { DiagCore.s_clusmsgFullPath = Path.Combine(DiagCore.GetFolderPathOfExchangeBinaries(), "clusmsg.dll"); } if (!DiagCore.FormatMessageFromModule(DiagCore.s_clusmsgFullPath, eventTuple.EventId, out result, out gle, arguments)) { return(null); } return(result); }
// Token: 0x060009B2 RID: 2482 RVA: 0x0002DC70 File Offset: 0x0002BE70 internal EseLogHeaderRecord(string input) { Match match = base.Match(input); this.m_signature = match.Groups["Signature"].ToString(); this.m_generation = long.Parse(match.Groups["Generation"].ToString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture); this.m_logFormatVersion = match.Groups["LogFormatVersion"].ToString(); this.m_creationTime = DateTime.ParseExact(match.Groups["CreationTime"].ToString(), "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture); if ("00/00/1900 00:00:00" == match.Groups["PreviousGenerationCreationTime"].ToString()) { DiagCore.RetailAssert(1L == this.m_generation, "Generation {0} has a blank PrevGenCreationTime ({1}). input is {2}, regex is {3}", new object[] { this.m_generation, match.Groups["PreviousGenerationCreationTime"].ToString(), input, EseLogHeaderRecord.regex.ToString() }); this.m_previousGenerationCreationTime = DateTime.MinValue; } else { this.m_previousGenerationCreationTime = DateTime.ParseExact(match.Groups["PreviousGenerationCreationTime"].ToString(), "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture); } string text = match.Groups["CircularLogging"].ToString(); if ("0x1" == text) { this.m_isCircularLoggingOn = true; } else if ("0x0" == text) { this.m_isCircularLoggingOn = false; } else { ExDiagnostics.FailFast(string.Format(CultureInfo.CurrentCulture, "circular logging field {0} failed to match {1} or {2}. input is {3}, regex is {4}", new object[] { text, "0x1", "0x0", input, EseLogHeaderRecord.regex.ToString() }), true); } this.SectorSize = int.Parse(match.Groups["SectorSizeGroup"].ToString()); }
// Token: 0x06000976 RID: 2422 RVA: 0x0002C708 File Offset: 0x0002A908 private static void InternalTestCreateTempLog() { string randomFileName = Path.GetRandomFileName(); string text = "e13"; string destFileName = Path.Combine(randomFileName, "e13.log"); string text2 = Path.Combine(randomFileName, "e13tmp.log"); DiagCore.RetailAssert(!File.Exists(text2), "file {0} shouldn't exist", new object[] { text2 }); Exception ex; bool condition = EseHelper.CreateTempLog(text, randomFileName, out ex); DiagCore.RetailAssert(condition, "CreateTempLog({0},{1}) returned false", new object[] { text, randomFileName }); DiagCore.RetailAssert(File.Exists(text2), "file {0} should exist", new object[] { text2 }); condition = EseHelper.CreateTempLog(text, randomFileName, out ex); DiagCore.RetailAssert(condition, "CreateTempLog({0},{1}) returned false", new object[] { text, randomFileName }); DiagCore.RetailAssert(File.Exists(text2), "file {0} should exist", new object[] { text2 }); File.Move(text2, destFileName); condition = EseHelper.CreateTempLog(text, randomFileName, out ex); DiagCore.RetailAssert(condition, "CreateTempLog({0},{1}) returned false", new object[] { text, randomFileName }); DiagCore.RetailAssert(!File.Exists(text2), "file {0} shouldn't exist", new object[] { text2 }); Directory.Delete(randomFileName, true); }
private void DismountForSourceLogCorruption(Exception corruptionEx) { ReplayEventLogConstants.Tuple_CorruptLogRecoveryIsImmediatelyAttempted.LogEvent(null, new object[] { this.DatabaseCopyName, corruptionEx.Message }); try { ReplicaInstanceManager replicaInstanceManager = Dependencies.ReplayCoreManager.ReplicaInstanceManager; int num; string text = ReplayEventLogConstants.Tuple_CorruptLogRecoveryIsImmediatelyAttempted.EventLogToString(out num, new object[] { this.DatabaseCopyName, corruptionEx.Message }); uint eventViewerEventId = DiagCore.GetEventViewerEventId(ReplayEventLogConstants.Tuple_CorruptLogRecoveryIsImmediatelyAttempted); replicaInstanceManager.RequestSuspendAndFail(this.DatabaseGuid, eventViewerEventId, text, text, false, false, false, false); MonitoredDatabase.Tracer.TraceDebug((long)this.GetHashCode(), "DismountForSourceLogCorruption successfully suspended"); } catch (TaskServerException ex) { MonitoredDatabase.Tracer.TraceError <TaskServerException>((long)this.GetHashCode(), "DismountForSourceLogCorruption failed to suspend: {0}", ex); ReplayEventLogConstants.Tuple_CorruptLogRecoveryFailedToSuspend.LogEvent(null, new object[] { this.DatabaseName, ex.Message }); } finally { Exception ex2 = this.TryToDismountClean(); if (ex2 != null) { ReplayEventLogConstants.Tuple_CorruptLogRecoveryFailedToDismount.LogEvent(null, new object[] { this.DatabaseName, ex2.Message }); } } }
// Token: 0x06001C8C RID: 7308 RVA: 0x0007DA90 File Offset: 0x0007BC90 private void AssertMembersAreZero() { DiagCore.RetailAssert(0L == this.m_lowestGenerationPresent, "m_lowestGenerationPresent is not 0", new object[0]); DiagCore.RetailAssert(0L == this.m_highestGenerationPresent, "m_highestGenerationPresent is not 0", new object[0]); DiagCore.RetailAssert(0L == this.m_lowestGenerationRequired, "m_lowestGenerationRequired is not 0", new object[0]); DiagCore.RetailAssert(0L == this.m_highestGenerationRequired, "m_highestGenerationRequired is not 0", new object[0]); DiagCore.RetailAssert(0L == this.m_lastGenerationBackedUp, "m_lastGenerationBackedUp is not 0", new object[0]); DiagCore.RetailAssert(0L == this.m_checkpointGeneration, "m_checkpointGeneration is not 0", new object[0]); DiagCore.RetailAssert(this.m_logfileSignature == null, "m_logfileSignature is not null", new object[0]); DiagCore.RetailAssert(this.m_latestFullBackupTime == null, "m_latestFullBackupTime is not null", new object[0]); DiagCore.RetailAssert(this.m_latestIncrementalBackupTime == null, "m_latestIncrementalBackupTime is not null", new object[0]); DiagCore.RetailAssert(this.m_latestDifferentialBackupTime == null, "m_latestDifferentialBackupTime is not null", new object[0]); DiagCore.RetailAssert(this.m_latestCopyBackupTime == null, "m_latestCopyBackupTime is not null", new object[0]); DiagCore.RetailAssert(this.m_snapshotBackup == null, "m_snapshotBackup is not null", new object[0]); DiagCore.RetailAssert(this.m_snapshotLatestFullBackup == null, "m_snapshotLatestFullBackup is not null", new object[0]); DiagCore.RetailAssert(this.m_snapshotLatestIncrementalBackup == null, "m_snapshotLatestIncrementalBackup is not null", new object[0]); DiagCore.RetailAssert(this.m_snapshotLatestDifferentialBackup == null, "m_snapshotLatestDifferentialBackup is not null", new object[0]); DiagCore.RetailAssert(this.m_snapshotLatestCopyBackup == null, "m_snapshotLatestCopyBackup is not null", new object[0]); DiagCore.RetailAssert(!this.m_consistentDatabase, "m_consistentDatabase is not false", new object[0]); }
// Token: 0x06000979 RID: 2425 RVA: 0x0002C8C4 File Offset: 0x0002AAC4 private static void InternalTestNameGeneration() { ExTraceGlobals.EseutilWrapperTracer.TraceDebug(0L, "EseHelper.InternalTestNameGeneration"); string text = EseHelper.MakeCheckpointFileName("E09"); DiagCore.RetailAssert("E09.chk" == text, "MakeCheckpointFileName returned {0}", new object[] { text }); text = EseHelper.MakeLogfileName("E00", ".jtx", 5670691L); DiagCore.RetailAssert("E0000568723.jtx" == text, "MakeLogfileName returned {0}", new object[] { text }); text = EseHelper.MakeLogfileName("E01", ".log"); DiagCore.RetailAssert("E01.log" == text, "MakeLogfileName returned {0}", new object[] { text }); }
private static void DeleteTempOldFile(IReplayConfiguration config, string tempOldFile) { Exception ex = LastLogReplacer.HandleExceptions(delegate { long logfileGeneration = EseHelper.GetLogfileGeneration(tempOldFile); string text = EseHelper.MakeLogFilePath(config, logfileGeneration, config.DestinationLogPath); if (!File.Exists(text)) { string text2 = EseHelper.MakeLogFilePath(config, 0L, config.DestinationLogPath); if (!File.Exists(text2)) { DiagCore.AssertOrWatson(false, "DeleteTempOldFile(): tempOldFile '{0}' has generation {1}, but corresponding numbered log '{2}' was not found!", new object[] { tempOldFile, logfileGeneration, text }); throw new LastLogReplacementUnexpectedTempFilesException(config.DisplayName, config.DestinationLogPath); } text = text2; } LastLogReplacer.Tracer.TraceDebug <string, string>(0L, "DeleteTempOldFile(): '{0}': Found previously replaced file to be: {1}", config.DisplayName, text); bool flag = EseHelper.IsLogfileSubset(text, tempOldFile, config.E00LogBackupPath, null, null); DiagCore.AssertOrWatson(flag, "LastLogReplacer.RollbackLastLogIfNecessary(): File '{0}' is not a subset of replaced numbered log file '{1}', as expected!", new object[] { tempOldFile, text }); if (!flag) { throw new LastLogReplacementFileNotSubsetException(config.DisplayName, tempOldFile, text); } LastLogReplacer.MoveTempOldFileToBackupDir(config, tempOldFile); }); if (ex != null) { throw new LastLogReplacementTempOldFileNotDeletedException(config.DisplayName, tempOldFile, ex.Message, ex); } }