// Token: 0x06001147 RID: 4423 RVA: 0x00046B1C File Offset: 0x00044D1C public void WritePageData(byte[] data) { this.AssertWriteOperationValid(); DiagCore.AssertOrWatson(this.m_pageNumbersWritten, "WritePageNumbers() should be called first!", new object[0]); if (data.LongLength != this.m_header.PageSizeBytes) { throw new PagePatchInvalidPageSizeException(data.LongLength, this.m_header.PageSizeBytes); } this.m_fileStream.Write(data, 0, data.Length); }
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); } }
// Token: 0x06000A1F RID: 2591 RVA: 0x0002F184 File Offset: 0x0002D384 public static int GetFreeSpacePercentage(ulong freeBytes, ulong totalBytes) { if (freeBytes == 0UL) { ExTraceGlobals.ReplicaInstanceTracer.TraceError(0L, "freeBytes is 0."); return(0); } if (totalBytes == 0UL) { ExTraceGlobals.ReplicaInstanceTracer.TraceError(0L, "totalBytes cannot be 0."); return(0); } if (freeBytes > totalBytes) { string text = string.Format("freeBytes ({0}) cannot be > than totalBytes ({1}).", freeBytes, totalBytes); ExTraceGlobals.ReplicaInstanceTracer.TraceError(0L, text); DiagCore.AssertOrWatson(false, text, new object[0]); return(0); } return((int)(freeBytes / totalBytes * 100.0)); }
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); } }
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); } }
// Token: 0x06001155 RID: 4437 RVA: 0x00046E39 File Offset: 0x00045039 private void AssertReadOperationValid() { DiagCore.AssertOrWatson(!this.m_fSkipIO, "m_fSkipIO was true but we're doing a read operation?", new object[0]); }
// Token: 0x06001154 RID: 4436 RVA: 0x00046E05 File Offset: 0x00045005 private void AssertWriteOperationValid() { DiagCore.AssertOrWatson(!this.m_fSkipIO, "m_fSkipIO was true but we're doing a write operation?", new object[0]); DiagCore.AssertOrWatson(!this.m_fReadOnly, "m_fReadOnly was true but we're doing a write operation?", new object[0]); }