Пример #1
0
        public FileIOonSourceException GetE00Generation(out long e00Gen, string e00Filename)
        {
            Exception ex = null;
            FileIOonSourceException result = null;

            e00Gen = 0L;
            try
            {
                e00Gen = EseHelper.GetLogfileGeneration(e00Filename);
                ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug <long, string>((long)this.GetHashCode(), "E00 Gen is 0x{0:x} for {1}", e00Gen, e00Filename);
            }
            catch (EsentErrorException ex2)
            {
                ex = ex2;
            }
            catch (IOException ex3)
            {
                ex = ex3;
            }
            catch (UnauthorizedAccessException ex4)
            {
                ex = ex4;
            }
            if (ex != null)
            {
                ExTraceGlobals.MonitoredDatabaseTracer.TraceError <string, Exception>((long)this.GetHashCode(), "Could not get generation of {0}: {1}", e00Filename, ex);
                result = new FileIOonSourceException(Environment.MachineName, e00Filename, ex.Message, ex);
            }
            return(result);
        }
Пример #2
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);
            }
        }
Пример #3
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);
        }
        // Token: 0x06001BB8 RID: 7096 RVA: 0x000769D4 File Offset: 0x00074BD4
        private void SetE00LogGeneration()
        {
            Exception ex   = null;
            string    text = EseHelper.MakeLogFilePath(this.m_configuration, 0L, this.m_configuration.DestinationLogPath);

            try
            {
                long logfileGeneration = EseHelper.GetLogfileGeneration(text);
                ExTraceGlobals.ReplicaInstanceTracer.TraceDebug <string, long>((long)this.GetHashCode(), "ACLL.CopyLogs(): {0}: Setting E00.log FileState generation to: {1}", this.m_configuration.Name, logfileGeneration);
                this.m_fileState.SetE00LogGeneration(logfileGeneration);
            }
            catch (FileCheckException ex2)
            {
                ex = ex2;
            }
            catch (EsentErrorException ex3)
            {
                ex = ex3;
            }
            catch (IOException ex4)
            {
                ex = ex4;
            }
            catch (SecurityException ex5)
            {
                ex = ex5;
            }
            catch (UnauthorizedAccessException ex6)
            {
                ex = ex6;
            }
            if (ex != null)
            {
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string, Exception>((long)this.GetHashCode(), "ACLL.CopyLogs(): {0}: SetE00LogGeneration() got exception: {1}", this.m_configuration.Name, ex);
                throw new AcllSetCurrentLogGenerationException(this.m_configuration.DisplayName, text, ex.Message, ex);
            }
        }
Пример #5
0
        // Token: 0x06000968 RID: 2408 RVA: 0x0002C420 File Offset: 0x0002A620
        public static long GetLogfileGeneration(string logfilePath)
        {
            JET_LOGINFOMISC jet_LOGINFOMISC;

            return(EseHelper.GetLogfileGeneration(logfilePath, out jet_LOGINFOMISC));
        }