Пример #1
0
 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)
     {
     }
 }
Пример #2
0
 // Token: 0x06001C63 RID: 7267 RVA: 0x0007CAFC File Offset: 0x0007ACFC
 public void InternalCheckLogfileSignature()
 {
     lock (this)
     {
         if (0L != this.LowestGenerationPresent)
         {
             FileState.InternalCheck(this.LogfileSignature != null, "Logfiles are present, but LogfileSignature is not set", new object[0]);
         }
         if (0L != this.LowestGenerationRequired)
         {
             FileState.InternalCheck(this.LogfileSignature != null, "Logfiles are required, but LogfileSignature is not set", new object[0]);
         }
     }
 }
Пример #3
0
 // Token: 0x06001C62 RID: 7266 RVA: 0x0007C8F8 File Offset: 0x0007AAF8
 public void InternalCheck()
 {
     lock (this)
     {
         FileState.InternalCheck(this.m_lowestGenerationPresent <= this.m_highestGenerationPresent, "LowestGenerationPresent > HighestGenerationPresent", new object[0]);
         FileState.InternalCheck(this.m_lowestGenerationRequired <= this.m_highestGenerationRequired, "LowestGenerationRequired > HighestGenerationRequired", new object[0]);
         if (0L == this.m_lowestGenerationPresent)
         {
             FileState.InternalCheck(0L == this.m_highestGenerationPresent, "LowestGenerationPresent is 0, but HighestGenerationPresent is set", new object[0]);
         }
         else
         {
             FileState.InternalCheck(0L != this.m_highestGenerationPresent, "LowestGenerationPresent is set, but HighestGenerationPresent is 0", new object[0]);
         }
         if (0L == this.m_lowestGenerationRequired)
         {
             FileState.InternalCheck(0L == this.m_highestGenerationRequired, "LowestGenerationRequired is 0, but HighestGenerationRequired is set", new object[0]);
         }
         else
         {
             FileState.InternalCheck(0L != this.m_highestGenerationRequired, "LowestGenerationRequired is set, but HighestGenerationRequired is 0", new object[0]);
         }
         if (this.m_consistentDatabase)
         {
             FileState.InternalCheck(this.m_highestGenerationRequired == this.m_lowestGenerationRequired, "ConsistentDatabase is true, but HighestGenerationRequired != LowestGenerationRequired", new object[0]);
         }
         if (this.m_highestGenerationRequired != this.m_lowestGenerationRequired)
         {
             FileState.InternalCheck(!this.m_consistentDatabase, "HighestGenerationRequired != LowestGenerationRequired but ConsistentDatabase is true", new object[0]);
         }
         if (this.m_latestFullBackupTime != null)
         {
             FileState.InternalCheck(this.m_lastGenerationBackedUp > 0L, "m_latestFullBackupTime is set, but m_lastGenerationBackedUp is not set", new object[0]);
         }
         if (this.m_latestIncrementalBackupTime != null)
         {
             FileState.InternalCheck(this.m_lastGenerationBackedUp > 0L, "m_latestIncrementalBackupTime is set, but m_lastGenerationBackedUp is not set", new object[0]);
             FileState.InternalCheck(this.m_latestFullBackupTime != null, "m_latestIncrementalBackupTime is set, but m_latestFullBackupTime is not set", new object[0]);
         }
         if (this.m_latestDifferentialBackupTime != null)
         {
             FileState.InternalCheck(this.m_lastGenerationBackedUp > 0L, "m_latestDifferentialBackupTime is set, but m_lastGenerationBackedUp is not set", new object[0]);
             FileState.InternalCheck(this.m_latestFullBackupTime != null, "m_latestDifferentialBackupTime is set, but m_latestFullBackupTime is not set", new object[0]);
         }
     }
 }
Пример #4
0
 // Token: 0x06001C65 RID: 7269 RVA: 0x0007CBD4 File Offset: 0x0007ADD4
 public void SetLowestAndHighestGenerationsPresent(long lowestGenerationPresent, long highestGenerationPresent)
 {
     FileState.InternalCheck(lowestGenerationPresent <= highestGenerationPresent, "lowestGenerationPresent > highestGenerationPresent", new object[0]);
     if (lowestGenerationPresent == 0L)
     {
         FileState.InternalCheck(highestGenerationPresent == 0L, "Highest gen must be 0 when low gen is 0", new object[0]);
     }
     if (highestGenerationPresent == 0L)
     {
         FileState.InternalCheck(lowestGenerationPresent == 0L, "Lowest gen must be 0 when hi gen is 0", new object[0]);
     }
     lock (this)
     {
         this.InternalCheck();
         this.m_lowestGenerationPresent  = lowestGenerationPresent;
         this.m_highestGenerationPresent = highestGenerationPresent;
         this.InternalCheck();
     }
 }
Пример #5
0
 // Token: 0x06001C67 RID: 7271 RVA: 0x0007CCD4 File Offset: 0x0007AED4
 public void SetLowestAndHighestGenerationsRequired(long lowestGenerationRequired, long highestGenerationRequired, bool databaseIsConsistent)
 {
     FileState.InternalCheck(lowestGenerationRequired >= 0L, "lowestGenerationRequired should be greater than 0 but we got {0}", new object[]
     {
         lowestGenerationRequired
     });
     FileState.InternalCheck(highestGenerationRequired >= 0L, "highestGenerationRequired should be greater than 0 but we got {0}", new object[]
     {
         highestGenerationRequired
     });
     FileState.InternalCheck(lowestGenerationRequired <= highestGenerationRequired, "lowestGenerationRequired > highestGenerationRequired", new object[0]);
     FileState.InternalCheck(!databaseIsConsistent || lowestGenerationRequired == highestGenerationRequired, "lowestGenerationRequired != highestGenerationRequired, but the database is consistent", new object[0]);
     lock (this)
     {
         this.InternalCheck();
         this.m_lowestGenerationRequired  = lowestGenerationRequired;
         this.m_highestGenerationRequired = highestGenerationRequired;
         this.m_consistentDatabase        = databaseIsConsistent;
         this.InternalCheck();
     }
 }
Пример #6
0
 // 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);
     }
 }
Пример #7
0
 // 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)
 {
 }
Пример #8
0
        // Token: 0x06001D52 RID: 7506 RVA: 0x00084580 File Offset: 0x00082780
        private static bool CheckLogHeaderInternal(long logfileNumber, string logfileInspect, FileState fileState, LogContinuityChecker continuityChecker, out LocalizedString error)
        {
            error = LocalizedString.Empty;
            JET_LOGINFOMISC jet_LOGINFOMISC;
            long            logfileGeneration = EseHelper.GetLogfileGeneration(logfileInspect, out jet_LOGINFOMISC);

            if (0L == logfileNumber && 0L != fileState.HighestGenerationPresent && fileState.HighestGenerationPresent + 1L != logfileGeneration)
            {
                ExTraceGlobals.LogInspectorTracer.TraceError <string, long, long>(0L, "Inspection of logfile {0} detected corruption (generation number {1} mismatch with highest logfile present {2})", logfileInspect, logfileGeneration, fileState.HighestGenerationPresent);
                error = ReplayStrings.LogInspectorE00OutOfSequence(logfileInspect, logfileGeneration, fileState.HighestGenerationPresent);
                return(false);
            }
            if (logfileNumber != 0L && logfileNumber != logfileGeneration)
            {
                ExTraceGlobals.LogInspectorTracer.TraceError <string, long>(0L, "Inspection of logfile {0} detected corruption (generation number {1} mismatch)", logfileInspect, logfileGeneration);
                error = ReplayStrings.LogInspectorGenerationMismatch(logfileInspect, logfileGeneration, logfileNumber);
                return(false);
            }
            if (fileState.LogfileSignature != null)
            {
                if (!jet_LOGINFOMISC.signLog.Equals(fileState.LogfileSignature.Value))
                {
                    ExTraceGlobals.LogInspectorTracer.TraceError <string, JET_SIGNATURE, JET_SIGNATURE>(0L, "Inspection of logfile {0} detected a signature mismatch (signature is {1}, expected {2})", logfileInspect, jet_LOGINFOMISC.signLog, fileState.LogfileSignature.Value);
                    error = ReplayStrings.LogInspectorSignatureMismatch(logfileInspect, logfileGeneration);
                    return(false);
                }
            }
            else
            {
                ExTraceGlobals.LogInspectorTracer.TraceDebug <JET_SIGNATURE, string>(0L, "Setting logfile signature to {0} from logfile {1}", jet_LOGINFOMISC.signLog, logfileInspect);
                fileState.LogfileSignature = new JET_SIGNATURE?(jet_LOGINFOMISC.signLog);
            }
            if (!continuityChecker.Examine(jet_LOGINFOMISC, logfileInspect, out error))
            {
                ExTraceGlobals.LogInspectorTracer.TraceError <string, LocalizedString>(0L, "Inspection of logfile {0} detected discontinuity: {1}", logfileInspect, error);
                return(false);
            }
            return(true);
        }
Пример #9
0
        // Token: 0x06001D4B RID: 7499 RVA: 0x000843F4 File Offset: 0x000825F4
        internal static bool VerifyLogStatic(long logfileNumber, LogSource logSource, string logfileInspect, bool fRecopyOnFailure, FileState filestate, LogVerifier logVerifier, LogContinuityChecker continuityChecker, LogInspector.CheckStopDelegate checkStopPending, out LocalizedString error)
        {
            ulong num   = fRecopyOnFailure ? 3UL : 1UL;
            bool  flag  = false;
            bool  flag2 = false;

            error = LocalizedString.Empty;
            for (ulong num2 = 0UL; num2 < num; num2 += 1UL)
            {
                bool flag3 = false;
                if (flag2 && fRecopyOnFailure)
                {
                    LogInspector.RecopyCorruptLog(logfileNumber, logSource, logfileInspect);
                    flag3 = true;
                }
                checkStopPending();
                EsentErrorException ex = logVerifier.Verify(logfileInspect);
                if (ex != null)
                {
                    ExTraceGlobals.LogInspectorTracer.TraceError <string, EsentErrorException>(0L, "Inspection of logfile {0} failed: {1}", logfileInspect, ex);
                    error = new LocalizedString(ex.Message);
                    if (!(ex is EsentFileAccessDeniedException))
                    {
                        flag2 = true;
                        LogInspector.ReportCorruptLog(logfileInspect, error);
                    }
                }
                else
                {
                    flag2 = false;
                    checkStopPending();
                    flag = LogInspector.CheckLogHeader(logfileNumber, logfileInspect, filestate, continuityChecker, out error);
                    if (!flag)
                    {
                        LogInspector.ReportCorruptLog(logfileInspect, error);
                    }
                    else
                    {
                        if (flag3)
                        {
                            ReplayEventLogConstants.Tuple_InspectorFixedCorruptLog.LogEvent(logfileInspect, new object[]
                            {
                                logfileInspect
                            });
                            break;
                        }
                        break;
                    }
                }
            }
            return(flag);
        }
Пример #10
0
        // Token: 0x06001D49 RID: 7497 RVA: 0x00084374 File Offset: 0x00082574
        internal static bool VerifyLogTask(long logfileNumber, string logfileInspect, FileState fileState, LogVerifier logVerifier, LogContinuityChecker continuityChecker, out LocalizedString error)
        {
            error = LocalizedString.Empty;
            if (logVerifier == null)
            {
                throw new ArgumentNullException("logVerifier");
            }
            EsentErrorException ex = logVerifier.Verify(logfileInspect);

            if (ex != null)
            {
                error = new LocalizedString(ex.Message);
                return(false);
            }
            return(LogInspector.CheckLogHeaderInternal(logfileNumber, logfileInspect, fileState, continuityChecker, out error));
        }
Пример #11
0
        // Token: 0x06001D48 RID: 7496 RVA: 0x0008430C File Offset: 0x0008250C
        internal static bool CheckLogHeader(long logfileNumber, string logfileInspect, FileState fileState, LogContinuityChecker continuityChecker, out LocalizedString error)
        {
            error = LocalizedString.Empty;
            bool result;

            try
            {
                result = LogInspector.CheckLogHeaderInternal(logfileNumber, logfileInspect, fileState, continuityChecker, out error);
            }
            catch (EsentErrorException ex)
            {
                ReplayEventLogConstants.Tuple_IsamException.LogEvent(logfileInspect, new object[]
                {
                    "unknown",
                    ex.Message,
                    logfileInspect
                });
                result = false;
            }
            return(result);
        }
        // Token: 0x06000A21 RID: 2593 RVA: 0x0002F2C0 File Offset: 0x0002D4C0
        public static void MoveLogFiles(ReplayConfiguration config, FileState fileState, ISetBroken setBroken, long corruptLogGen)
        {
            string    text = Path.Combine(config.E00LogBackupPath, "SkippedLogs");
            Exception ex   = DirectoryOperations.TryCreateDirectory(text);

            if (ex != null)
            {
                setBroken.SetBroken(FailureTag.Configuration, ReplayEventLogConstants.Tuple_FailedToCreateDirectory, ex, new string[]
                {
                    text,
                    ex.ToString()
                });
                return;
            }
            string currentDateString = FileOperations.GetCurrentDateString();
            string text2             = Path.Combine(text, currentDateString);

            ex = DirectoryOperations.TryCreateDirectory(text2);
            if (ex != null)
            {
                setBroken.SetBroken(FailureTag.Configuration, ReplayEventLogConstants.Tuple_FailedToCreateDirectory, ex, new string[]
                {
                    text2,
                    ex.ToString()
                });
                return;
            }
            string destinationLogPath = config.DestinationLogPath;
            string text3 = string.Empty;
            string path  = string.Empty;

            try
            {
                ReplayEventLogConstants.Tuple_MovingFilesToRestartLogStream.LogEvent(null, new object[]
                {
                    config.DatabaseName,
                    EseHelper.MakeLogfileName(config.LogFilePrefix, config.LogFileSuffix, corruptLogGen),
                    text2
                });
                foreach (string text4 in Directory.GetFiles(destinationLogPath, "*." + config.LogExtension))
                {
                    text3 = text4;
                    path  = Path.GetFileName(text4);
                    long logfileGenerationFromFilePath = EseHelper.GetLogfileGenerationFromFilePath(text4, config.LogFilePrefix);
                    if (logfileGenerationFromFilePath >= fileState.LowestGenerationRequired)
                    {
                        ExTraceGlobals.ReplicaInstanceTracer.TraceError <string>(0L, "MoveLogFiles(): Cannot move logfile '{0}' because it is required by the database.", text4);
                    }
                    else
                    {
                        File.Move(text4, Path.Combine(text2, path));
                    }
                }
                foreach (string text5 in Directory.GetFiles(destinationLogPath, "*.jsl"))
                {
                    text3 = text5;
                    path  = Path.GetFileName(text5);
                    File.Move(text5, Path.Combine(text2, path));
                }
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string>(0L, "Moved log files successfully from '{0}'", config.DestinationLogPath);
            }
            catch (IOException ex2)
            {
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string, string, IOException>(0L, "Moving file '{0}' to '{1}' failed with exception: {2}", text3, text2, ex2);
                setBroken.SetBroken(ReplicaInstance.IOExceptionToFailureTag(ex2), ReplayEventLogConstants.Tuple_CouldNotDeleteLogFile, ex2, new string[]
                {
                    text3,
                    ex2.ToString()
                });
            }
            catch (UnauthorizedAccessException ex3)
            {
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string, string, UnauthorizedAccessException>(0L, "Moving file '{0}' to '{1}' failed with exception: {2}", text3, text2, ex3);
                setBroken.SetBroken(FailureTag.AlertOnly, ReplayEventLogConstants.Tuple_CouldNotDeleteLogFile, ex3, new string[]
                {
                    text3,
                    ex3.ToString()
                });
            }
        }
Пример #13
0
        // Token: 0x06001C8A RID: 7306 RVA: 0x0007D784 File Offset: 0x0007B984
        internal static void InternalTest()
        {
            FileState.TestInternalCheck();
            FileState fileState = new FileState();

            fileState.AssertMembersAreZero();
            fileState.SetLowestAndHighestGenerationsPresent(2L, 3L);
            fileState.SetLowestAndHighestGenerationsRequired(8L, 9L, false);
            fileState.LastGenerationBackedUp = 1L;
            fileState.CheckpointGeneration   = 7L;
            DiagCore.RetailAssert(!fileState.ConsistentDatabase, "ConsistentDatabase is {0}, expected {1}", new object[]
            {
                fileState.ConsistentDatabase,
                false
            });
            DiagCore.RetailAssert(2L == fileState.LowestGenerationPresent, "LowestGenerationPresent is {0}, expected {1}", new object[]
            {
                fileState.LowestGenerationPresent,
                2
            });
            DiagCore.RetailAssert(3L == fileState.HighestGenerationPresent, "HighestGenerationPresent is {0}, expected {1}", new object[]
            {
                fileState.HighestGenerationPresent,
                3
            });
            DiagCore.RetailAssert(8L == fileState.LowestGenerationRequired, "LowestGenerationRequired is {0}, expected {1}", new object[]
            {
                fileState.LowestGenerationRequired,
                8
            });
            DiagCore.RetailAssert(9L == fileState.HighestGenerationRequired, "HighestGenerationRequired is {0}, expected {1}", new object[]
            {
                fileState.HighestGenerationRequired,
                9
            });
            DiagCore.RetailAssert(1L == fileState.LastGenerationBackedUp, "LastGenerationBackedUp is {0}, expected {1}", new object[]
            {
                fileState.LastGenerationBackedUp,
                1
            });
            DiagCore.RetailAssert(7L == fileState.CheckpointGeneration, "CheckpointGeneration is {0}, expected {1}", new object[]
            {
                fileState.CheckpointGeneration,
                7
            });
            fileState.Reset();
            fileState.AssertMembersAreZero();
            DiagCore.RetailAssert(fileState.RequiredLogfilesArePresent(), "RequiredLogfilesArePresent", new object[0]);
            fileState.SetLowestAndHighestGenerationsPresent(18L, 21L);
            fileState.SetLowestAndHighestGenerationsRequired(18L, 21L, false);
            DiagCore.RetailAssert(fileState.RequiredLogfilesArePresent(), "RequiredLogfilesArePresent", new object[0]);
            fileState.Reset();
            fileState.SetLowestAndHighestGenerationsPresent(18L, 21L);
            fileState.SetLowestAndHighestGenerationsRequired(19L, 20L, false);
            DiagCore.RetailAssert(fileState.RequiredLogfilesArePresent(), "RequiredLogfilesArePresent", new object[0]);
            fileState.Reset();
            fileState.SetLowestAndHighestGenerationsPresent(18L, 21L);
            fileState.SetLowestAndHighestGenerationsRequired(19L, 22L, false);
            DiagCore.RetailAssert(!fileState.RequiredLogfilesArePresent(), "RequiredLogfilesArePresent", new object[0]);
            fileState.Reset();
            fileState.SetLowestAndHighestGenerationsPresent(18L, 21L);
            fileState.SetLowestAndHighestGenerationsRequired(17L, 20L, false);
            DiagCore.RetailAssert(fileState.RequiredLogfilesArePresent(), "RequiredLogfilesArePresent", new object[0]);
            fileState.Reset();
        }
Пример #14
0
        // Token: 0x06001D69 RID: 7529 RVA: 0x000850F4 File Offset: 0x000832F4
        public void CheckForDivergence(FileState fileState)
        {
            this.m_logSource = LogSource.Construct(this.Config, null, null, LogSource.GetLogShipTimeoutInMsec(false));
            if (0L == fileState.HighestGenerationPresent || fileState.HighestGenerationPresent < fileState.HighestGenerationRequired)
            {
                LogRepair.Tracer.TraceError <string, long>((long)this.GetHashCode(), "CheckForDivergence({0}): failed with HighestGenerationPresent 0x{1:X}", this.Config.DisplayName, fileState.HighestGenerationPresent);
                throw new LogRepairNotPossibleException(ReplayStrings.LogRepairNotPossibleInsuffientToCheckDivergence);
            }
            long   num  = fileState.HighestGenerationPresent;
            string text = Path.Combine(this.Config.DestinationLogPath, this.Config.LogFilePrefix) + "." + this.Config.LogExtension;
            bool   flag = false;
            string text2;

            if (File.Exists(text))
            {
                flag  = true;
                num  += 1L;
                text2 = text;
            }
            else
            {
                text2 = this.Config.BuildFullLogfileName(num);
            }
            long      num2 = -1L;
            Exception ex   = null;

            try
            {
                num2 = this.m_logSource.QueryEndOfLog();
            }
            catch (NetworkRemoteException ex2)
            {
                ex = ex2;
            }
            catch (NetworkTransportException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                throw new LogRepairTransientException(ex.Message, ex);
            }
            if (num2 < num)
            {
                LogRepair.Tracer.TraceError <string, long>((long)this.GetHashCode(), "CheckForDivergence({0}): failed with HighestGenerationPresent 0x{1:X}", this.Config.DisplayName, fileState.HighestGenerationPresent);
                throw new LogRepairNotPossibleException(ReplayStrings.LogRepairNotPossibleActiveIsDivergent(this.Config.SourceMachine));
            }
            ex = this.VerifyLog(text2, num);
            if (ex != null)
            {
                throw new LogRepairNotPossibleException(ReplayStrings.LogRepairDivergenceCheckFailedDueToCorruptEndOfLog(text2, ex.Message), ex);
            }
            string path  = this.Config.BuildShortLogfileName(num);
            string text3 = Path.Combine(this.m_workingPath, path);

            this.CopyAndVerifyFromActive(num, text3);
            try
            {
                if (flag)
                {
                    if (!EseHelper.IsLogfileSubset(text3, text, this.m_workingPath, null, null))
                    {
                        LogRepair.Tracer.TraceError <string, long>((long)this.GetHashCode(), "CheckForDivergence({0}): failed with e00 divergence at gen 0x{1}.", this.Config.DisplayName, num);
                        throw new LogRepairNotPossibleException(ReplayStrings.LogRepairNotPossibleActiveIsDivergent(this.Config.SourceMachine));
                    }
                    long num3 = num - 1L;
                    if (num3 <= 1L)
                    {
                        throw new LogRepairNotPossibleException(ReplayStrings.LogRepairNotPossibleInsuffientToCheckDivergence);
                    }
                    string text4 = this.Config.BuildFullLogfileName(num3);
                    this.VerifyLog(text4, num3);
                    if (ex != null)
                    {
                        throw new LogRepairNotPossibleException(ReplayStrings.LogRepairDivergenceCheckFailedDueToCorruptEndOfLog(text4, ex.Message), ex);
                    }
                    string text5 = this.Config.BuildShortLogfileName(num3);
                    string text6 = Path.Combine(this.m_workingPath, text5);
                    this.CopyAndVerifyFromActive(num3, text6);
                    Exception ex4;
                    if (!this.IsFileBinaryEqual(text6, text4, out ex4))
                    {
                        if (ex4 != null)
                        {
                            throw new LogRepairDivergenceCheckFailedException(text5, text6, ex4.Message, ex4);
                        }
                        throw new LogRepairNotPossibleException(ReplayStrings.LogRepairNotPossibleActiveIsDivergent(this.Config.SourceMachine));
                    }
                }
                else if (!EseHelper.IsLogfileEqual(text3, text2, this.m_workingPath, null, null))
                {
                    LogRepair.Tracer.TraceError <string, long>((long)this.GetHashCode(), "CheckForDivergence({0}): failed with divergence at gen 0x{1}.", this.Config.DisplayName, num);
                    throw new LogRepairNotPossibleException(ReplayStrings.LogRepairNotPossibleActiveIsDivergent(this.Config.SourceMachine));
                }
            }
            catch (EsentErrorException ex5)
            {
                throw new LogRepairDivergenceCheckFailedException(text2, text3, ex5.Message, ex5);
            }
        }
Пример #15
0
        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);
        }