// Token: 0x06001D3E RID: 7486 RVA: 0x00083E24 File Offset: 0x00082024 public LogInspector(IPerfmonCounters perfmonCounters, IReplayConfiguration replayConfig, string logfileBaseName, string logfileSuffix, string replayDir, FileState fileState, ILogTruncater logTruncater, ISetBroken setBroken, ISetGeneration setGeneration, IReplicaProgress replicaProgress, NetworkPath netPath, bool runningAcll) : base(replayConfig.LogInspectorPath, logfileBaseName, 0L, logfileSuffix, setBroken, replicaProgress) { this.Config = replayConfig; this.m_logTruncater = logTruncater; this.m_replayDir = replayDir; this.m_fileState = fileState; this.m_setGeneration = setGeneration; this.m_logVerifier = new LogVerifier(logfileBaseName); ExTraceGlobals.LogInspectorTracer.TraceDebug((long)this.GetHashCode(), "LogInspector initialized - inspectDir = {0}, logfileBaseName = {1}, replayDir = {2}, fileState = {3}", new object[] { replayConfig.LogInspectorPath, logfileBaseName, replayDir, fileState }); ExTraceGlobals.PFDTracer.TracePfd((long)this.GetHashCode(), "LogInspector initialized - inspectDir = {0}, logfileBaseName = {1}, replayDir = {2}, fileState = {3}", new object[] { replayConfig.LogInspectorPath, logfileBaseName, replayDir, fileState }); this.Config.ReplayState.InspectorGenerationNumber = this.m_fileState.HighestGenerationPresent; this.m_logSource = LogSource.Construct(replayConfig, perfmonCounters, netPath, LogSource.GetLogShipTimeoutInMsec(runningAcll)); if (0L != this.m_fileState.HighestGenerationPresent) { this.m_logContinuityChecker.Initialize(this.m_fileState.HighestGenerationPresent, this.Config.DestinationLogPath, this.Config.LogFilePrefix, logfileSuffix); } }
// Token: 0x0600096E RID: 2414 RVA: 0x0002C4E4 File Offset: 0x0002A6E4 public static string MakeLogFilePath(IReplayConfiguration config, long generation, string directory) { string logfileSuffix = "." + config.LogExtension; string path = EseHelper.MakeLogfileName(config.LogFilePrefix, logfileSuffix, generation); return(Path.Combine(directory, path)); }
public GranularWriter(LogCopier logCopier, IPerfmonCounters perfmonCounters, IReplayConfiguration replayConfiguration, ISetBroken setBroken) { this.m_logCopier = logCopier; this.m_setBroken = setBroken; this.m_perfmonCounters = perfmonCounters; this.m_config = replayConfiguration; this.m_perfmonCounters.GranularReplication = 0L; }
// Token: 0x0600223A RID: 8762 RVA: 0x0009F97A File Offset: 0x0009DB7A public LogCopyClient(IReplayConfiguration config, IPerfmonCounters perfmonCounters, NetworkPath initialNetworkPath, int timeoutMs) { this.m_config = config; this.m_perfmonCounters = perfmonCounters; this.m_defaultTimeoutInMs = timeoutMs; this.m_sourceAddr = config.SourceMachine; this.m_initialNetworkPath = initialNetworkPath; }
public static long CalculateLowestGenerationRequired(IReplayConfiguration config, FileState fileState) { long num = fileState.LowestGenerationRequired; if (!config.CircularLoggingEnabled && fileState.LastGenerationBackedUp != 0L) { num = Math.Min(num, fileState.LastGenerationBackedUp); } return(num); }
private static void MoveTempOldFileToBackupDir(IReplayConfiguration config, string tempOldFile) { string currentDateString = FileOperations.GetCurrentDateString(); string text = Path.Combine(config.E00LogBackupPath, currentDateString + "E00OutOfDate"); string text2 = EseHelper.MakeLogFilePath(config, 0L, text); FileOperations.CreateDirectoryIfNeeded(text); LastLogReplacer.Tracer.TraceDebug <string, string, string>(0L, "MoveTempOldFileToBackupDir(): '{0}': Moving temporary old file '{1}' to backup file '{2}'", config.DisplayName, tempOldFile, text2); File.Move(tempOldFile, text2); }
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); } }
public MonitoredDatabase(IReplayConfiguration config) { if (config == null) { throw new ArgumentNullException("config"); } this.m_fPassive = (config.Type == ReplayConfigType.RemoteCopyTarget); this.m_sourceDir = (this.m_fPassive ? config.DestinationLogPath : config.SourceLogPath); this.m_logPrefix = config.LogFilePrefix; this.m_logSuffix = "." + config.LogExtension; this.m_config = config; this.m_activeLogCopyClients = new List <LogCopyServerContext>(); }
// Token: 0x060019F7 RID: 6647 RVA: 0x0006C738 File Offset: 0x0006A938 internal ConfigurationArgs(IReplayConfiguration config, IReplicaInstanceManager replicaInstanceManager, bool isTestCode) { this.IsTestEnvironment = isTestCode; this.m_replicaInstanceManager = replicaInstanceManager; this.m_identityGuid = config.IdentityGuid; this.m_name = config.Name; this.m_logFilePrefix = config.LogFilePrefix; this.m_destinationSystemPath = config.DestinationSystemPath; this.m_destinationEdbPath = config.DestinationEdbPath; this.m_destinationLogPath = config.DestinationLogPath; this.m_inspectorLogPath = config.LogInspectorPath; this.m_ignoredLogsPath = config.E00LogBackupPath; this.m_sourceMachine = config.SourceMachine; this.m_LogFileSuffix = config.LogFileSuffix; this.m_autoDagVolumesRootFolderPath = config.AutoDagVolumesRootFolderPath; this.m_autoDagDatabasesRootFolderPath = config.AutoDagDatabasesRootFolderPath; this.m_autoDagDatabaseCopiesPerVolume = config.AutoDagDatabaseCopiesPerVolume; this.CircularLoggingEnabled = config.CircularLoggingEnabled; this.BuildDebugString(); }
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); } }
// Token: 0x06001E04 RID: 7684 RVA: 0x000898BC File Offset: 0x00087ABC public long MinRequiredGen(IFileChecker fileChecker, IReplayConfiguration config) { long num = fileChecker.FileState.LowestGenerationRequired; if (!config.CircularLoggingEnabled && fileChecker.FileState.LastGenerationBackedUp != 0L) { num = Math.Min(num, fileChecker.FileState.LastGenerationBackedUp); } long copyNotificationGenerationNumber = config.ReplayState.CopyNotificationGenerationNumber; if (copyNotificationGenerationNumber <= (long)this.MinLogsToPreserve) { return(0L); } long num2 = (long)(this.MinLogsToPreserve / 10); if (num <= num2) { return(0L); } return(Math.Min(copyNotificationGenerationNumber - (long)this.MinLogsToPreserve, num - num2)); }
// Token: 0x06001E03 RID: 7683 RVA: 0x00089820 File Offset: 0x00087A20 public bool SpaceIsLow(IReplayConfiguration config) { string destinationLogPath = config.DestinationLogPath; ulong num; ulong num2; Exception freeSpace = DiskHelper.GetFreeSpace(destinationLogPath, out num, out num2); if (freeSpace != null) { LooseTruncation.Tracer.TraceError <string, Exception>((long)this.GetHashCode(), "SpaceIsLow: GetFreeSpace() failed against directory '{0}'. Exception: {1}", destinationLogPath, freeSpace); ReplayCrimsonEvents.TruncationFailedToGetDiskSpace.LogPeriodic <string, string, string>(config.Identity, DiagCore.DefaultEventSuppressionInterval, config.Identity, freeSpace.Message, destinationLogPath); return(false); } bool flag = false; long num3 = (long)(num2 / 1048576UL); if (num3 < this.LowSpaceThresholdInMB) { flag = true; } LooseTruncation.Tracer.TraceDebug <bool, long, long>((long)this.GetHashCode(), "SpaceIsLow={0}. FreeMB={1} LowSpaceThresholdInMB={2}", flag, num3, this.LowSpaceThresholdInMB); return(flag); }
private static void DeleteTempNewFile(IReplayConfiguration config, string tempNewFile, string subsetFile) { Exception ex = LastLogReplacer.HandleExceptions(delegate { bool flag = EseHelper.IsLogfileSubset(tempNewFile, subsetFile, config.E00LogBackupPath, null, null); DiagCore.AssertOrWatson(flag, "LastLogReplacer.RollbackLastLogIfNecessary(): File '{0}' is not a subset of temporary new file '{1}', as expected!", new object[] { subsetFile, tempNewFile }); if (!flag) { throw new LastLogReplacementFileNotSubsetException(config.DisplayName, subsetFile, tempNewFile); } File.Delete(tempNewFile); ReplayCrimsonEvents.FileDeleted.Log <string, string, string>(config.DatabaseName, config.ServerName, tempNewFile); }); if (ex != null) { throw new LastLogReplacementTempNewFileNotDeletedException(config.DisplayName, tempNewFile, ex.Message, ex); } }
public LogStreamResetOnMount(IReplayConfiguration config) { this.m_config = config; }
// Token: 0x0600158A RID: 5514 RVA: 0x00055A04 File Offset: 0x00053C04 public static DatabaseVolumeInfo GetInstance(IReplayConfiguration config) { return(DatabaseVolumeInfo.GetInstance(config.DestinationEdbPath, config.DestinationLogPath, config.DisplayName, config.AutoDagVolumesRootFolderPath, config.AutoDagDatabasesRootFolderPath, config.AutoDagDatabaseCopiesPerVolume)); }
// Token: 0x06001B76 RID: 7030 RVA: 0x00075CEF File Offset: 0x00073EEF public IncReseedPerformanceTracker(IReplayConfiguration config) : base("IncReseedPerf") { this.m_config = config; }
// Token: 0x06002225 RID: 8741 RVA: 0x0009F85E File Offset: 0x0009DA5E internal static LogSource Construct(IReplayConfiguration config, IPerfmonCounters perfmonCounters, NetworkPath initialNetworkPath, int timeoutMs) { return(new LogCopyClient(config, perfmonCounters, initialNetworkPath, timeoutMs)); }
// Token: 0x06001D3D RID: 7485 RVA: 0x00083DFC File Offset: 0x00081FFC public LogInspector(IPerfmonCounters perfmonCounters, IReplayConfiguration replayConfig, string logfileBaseName, string logfileSuffix, string replayDir, FileState fileState, ILogTruncater logTruncater, ISetBroken setBroken, ISetGeneration setGeneration, IReplicaProgress replicaProgress, NetworkPath netPath) : this(perfmonCounters, replayConfig, logfileBaseName, logfileSuffix, replayDir, fileState, logTruncater, setBroken, setGeneration, replicaProgress, netPath, false) { }
public static void RollbackLastLogIfNecessary(IReplayConfiguration config) { Exception ex = LastLogReplacer.HandleExceptions(delegate { int num = 0; int num2 = 0; string text = null; string text2 = null; string text3 = EseHelper.MakeLogFilePath(config, 0L, config.DestinationLogPath); string filter = LastLogReplacer.BuildLogFileSearchPattern(config.LogFilePrefix, ".ReplacementNew"); string filter2 = LastLogReplacer.BuildLogFileSearchPattern(config.LogFilePrefix, ".ReplacementOld"); using (DirectoryEnumerator directoryEnumerator = new DirectoryEnumerator(new DirectoryInfo(config.DestinationLogPath), false, false)) { foreach (string text4 in directoryEnumerator.EnumerateFiles(filter, null)) { num++; text = text4; } if (num > 1) { throw new LastLogReplacementTooManyTempFilesException(config.DisplayName, filter, num, config.DestinationLogPath); } foreach (string text5 in directoryEnumerator.EnumerateFiles(filter2, null)) { num2++; text2 = text5; } if (num2 > 1) { throw new LastLogReplacementTooManyTempFilesException(config.DisplayName, filter2, num2, config.DestinationLogPath); } } if (num == 0 && num2 == 0) { LastLogReplacer.Tracer.TraceDebug <string>(0L, "RollbackLastLogIfNecessary(): '{0}': Case 1: Nothing to do.", config.DisplayName); return; } if (num == 1 && num2 == 0) { LastLogReplacer.Tracer.TraceDebug <string, string>(0L, "RollbackLastLogIfNecessary(): '{0}': Case 2: Considering to delete temp new file: {1}", config.DisplayName, text); LastLogReplacer.DeleteTempNewFile(config, text, text3); return; } if (num == 1 && num2 == 1) { LastLogReplacer.Tracer.TraceDebug(0L, "RollbackLastLogIfNecessary(): '{0}': Case 3: Rolling back temp file '{1}' to '{2}' and considering to delete temp new file: {3}", new object[] { config.DisplayName, text2, text3, text }); File.Move(text2, text3); LastLogReplacer.DeleteTempNewFile(config, text, text3); return; } if (num == 0 && num2 == 1) { LastLogReplacer.Tracer.TraceDebug <string, string>(0L, "RollbackLastLogIfNecessary(): '{0}': Case 4: Considering moving out temp old file '{1}' to IgnoredLogs directory.", config.DisplayName, text2); LastLogReplacer.DeleteTempOldFile(config, text2); return; } LastLogReplacer.Tracer.TraceError <string, int, int>(0L, "RollbackLastLogIfNecessary(): '{0}': Unexpected temporary files found. tempOldFileCount={1}, tempNewFileCount={2}, e00Exists=false", config.DisplayName, num2, num); throw new LastLogReplacementUnexpectedTempFilesException(config.DisplayName, config.DestinationLogPath); }); if (ex != null) { throw new LastLogReplacementRollbackFailedException(config.DisplayName, ex.Message, ex); } }
// Token: 0x060019F6 RID: 6646 RVA: 0x0006C72C File Offset: 0x0006A92C public ConfigurationArgs(IReplayConfiguration config, IReplicaInstanceManager replicaInstanceManager) : this(config, replicaInstanceManager, false) { }
public LogTruncater(IPerfmonCounters perfmonCounters, IFileChecker fileChecker, ISetBroken setBroken, IReplayConfiguration configuration, ITruncationConfiguration truncationConfig, IReplicaInstanceContext replicaInstanceContext, ManualOneShotEvent shuttingDownEvent) : base(TimeSpan.Zero, TimeSpan.FromMilliseconds((double)RegistryParameters.LogTruncationTimerDuration), "LogTruncater") { this.m_perfmonCounters = perfmonCounters; this.m_fileChecker = fileChecker; this.m_configuration = configuration; this.m_truncationConfig = truncationConfig; this.m_replicaInstanceContext = replicaInstanceContext; this.m_shuttingDownEvent = shuttingDownEvent; this.m_localInspectorGen = this.m_configuration.ReplayState.InspectorGenerationNumber; this.m_localReplayerGen = this.m_configuration.ReplayState.ReplayGenerationNumber; this.m_perfmonCounters.TruncatedGenerationNumber = this.m_genTruncatedLocally; LogTruncater.Tracer.TraceDebug <IReplayConfiguration>((long)this.GetHashCode(), "LogTruncater initialized - configuration = {0}", configuration); }
public virtual bool ConfigEquals(IReplayConfiguration other, out ReplayConfigChangedFlags changedFlags) { changedFlags = ReplayConfigChangedFlags.None; string b = null; string b2 = null; string b3 = null; string b4 = null; string b5 = null; string b6 = null; AutoDatabaseMountDial autoDatabaseMountDial = AutoDatabaseMountDial.Lossless; AutoDatabaseMountDial autoDatabaseMountDial2 = AutoDatabaseMountDial.Lossless; bool flag = false; bool flag2 = false; bool flag3 = true; StringBuilder stringBuilder = new StringBuilder(); ReplayConfigType type; string name; Guid identityGuid; string sourceMachine; string logFilePrefix; string destinationLogPath; string destinationSystemPath; string destinationEdbPath; bool circularLoggingEnabled; EnhancedTimeSpan replayLagTime; EnhancedTimeSpan truncationLagTime; bool databaseCreated; int num; try { type = this.Type; name = this.Name; identityGuid = this.IdentityGuid; sourceMachine = this.SourceMachine; logFilePrefix = this.LogFilePrefix; destinationLogPath = this.DestinationLogPath; destinationSystemPath = this.DestinationSystemPath; destinationEdbPath = this.DestinationEdbPath; circularLoggingEnabled = this.CircularLoggingEnabled; replayLagTime = this.ReplayLagTime; truncationLagTime = this.TruncationLagTime; databaseCreated = this.DatabaseCreated; if (type == ReplayConfigType.RemoteCopySource || type == ReplayConfigType.RemoteCopyTarget) { flag = true; autoDatabaseMountDial = ((RemoteReplayConfiguration)this).AutoDatabaseMountDial; num = ((RemoteReplayConfiguration)this).Database.DatabaseCopies.Length; } else { num = 1; } } catch (TransientException) { ExTraceGlobals.ReplayManagerTracer.TraceDebug((long)this.GetHashCode(), "ReplayConfiguration.ConfigEquals() returning false because a TransientException was encountered."); return(false); } ReplayConfigType type2; Guid identityGuid2; bool circularLoggingEnabled2; EnhancedTimeSpan replayLagTime2; EnhancedTimeSpan truncationLagTime2; bool databaseCreated2; int num2; try { type2 = other.Type; b = other.Name; identityGuid2 = other.IdentityGuid; b6 = other.SourceMachine; b2 = other.LogFilePrefix; b3 = other.DestinationLogPath; b4 = other.DestinationSystemPath; b5 = other.DestinationEdbPath; circularLoggingEnabled2 = other.CircularLoggingEnabled; replayLagTime2 = other.ReplayLagTime; truncationLagTime2 = other.TruncationLagTime; databaseCreated2 = other.DatabaseCreated; if (type2 == ReplayConfigType.RemoteCopySource || type2 == ReplayConfigType.RemoteCopyTarget) { flag2 = true; autoDatabaseMountDial2 = ((RemoteReplayConfiguration)other).AutoDatabaseMountDial; num2 = ((RemoteReplayConfiguration)other).Database.DatabaseCopies.Length; } else { num2 = 1; } } catch (TransientException) { return(true); } if (num != num2) { flag3 = false; stringBuilder.AppendLine("origCopyCount != newCopyCount"); } if (type != type2) { flag3 = false; changedFlags |= ReplayConfigChangedFlags.ActiveServer; stringBuilder.AppendLine("origType != newType"); } if (name != b) { flag3 = false; stringBuilder.AppendLine("origName != newName"); } if (identityGuid != identityGuid2) { flag3 = false; stringBuilder.AppendLine("origIdentityGuid != newIdentityGuid"); } if (sourceMachine != b6) { flag3 = false; changedFlags |= ReplayConfigChangedFlags.ActiveServer; stringBuilder.AppendLine("origSourceMachine != newSourceMachine"); } if (logFilePrefix != b2) { flag3 = false; stringBuilder.AppendLine("origLogFilePrefix != newLogFilePrefix"); } if (destinationLogPath != b3) { flag3 = false; stringBuilder.AppendLine("origDestinationLogPath != newDestinationLogPath"); } if (destinationSystemPath != b4) { flag3 = false; stringBuilder.AppendLine("origDestinationSystemPath != newDestinationSystemPath"); } if (destinationEdbPath != b5) { flag3 = false; stringBuilder.AppendLine("origDestinationEdbPath != newDestinationEdbPath"); } if (circularLoggingEnabled != circularLoggingEnabled2) { flag3 = false; stringBuilder.AppendLine("origCircularLoggingEnabled != newCircularLoggingEnabled"); } if (replayLagTime != replayLagTime2) { flag3 = false; stringBuilder.AppendLine("origReplayLagTime != newReplayLagTime"); } if (truncationLagTime != truncationLagTime2) { flag3 = false; stringBuilder.AppendLine("origTruncationLagTime != newTruncationLagTime"); } if (flag && flag2 && autoDatabaseMountDial != autoDatabaseMountDial2) { flag3 = false; stringBuilder.AppendLine("origMountDial != newMountDial"); } if (databaseCreated != databaseCreated2) { flag3 = false; stringBuilder.AppendLine("origDatabaseCreated != newDatabaseCreated"); } if (!flag3) { changedFlags |= ReplayConfigChangedFlags.Other; ExTraceGlobals.ReplayManagerTracer.TraceDebug((long)this.GetHashCode(), "{0}: ReplayConfiguration.ConfigEquals() returning false because of the following: {1}ChangedFlags:{2}; Reason:{3}", new object[] { this.m_displayName, Environment.NewLine, changedFlags, stringBuilder.ToString() }); } return(flag3); }