// Token: 0x06000965 RID: 2405 RVA: 0x0002C3CC File Offset: 0x0002A5CC
        public static bool IsIncrementalReseedInProgress(string database)
        {
            JET_DBINFOMISC dbInfo;

            Api.JetGetDatabaseFileInfo(database, out dbInfo, JET_DbInfo.Misc);
            return(EseHelper.IsIncrementalReseedInProgress(dbInfo));
        }
        // Token: 0x06001BC3 RID: 7107 RVA: 0x0007766C File Offset: 0x0007586C
        private bool IsIncrementalReseedNecessary(out bool e00Exists, out LocalizedString errorString)
        {
            e00Exists   = false;
            errorString = LocalizedString.Empty;
            bool     flag     = false;
            bool     flag2    = false;
            bool     flag3    = this.m_fPerformDivergenceCheck;
            string   path     = EseHelper.MakeLogfileName(this.m_configuration.LogFilePrefix, "." + this.m_configuration.LogExtension);
            string   text     = Path.Combine(this.m_configuration.DestinationLogPath, path);
            FileInfo fileInfo = new FileInfo(text);

            if (fileInfo.Exists)
            {
                e00Exists = true;
                flag3     = true;
                ExTraceGlobals.ReplicaInstanceTracer.TraceDebug <string, string>((long)this.GetHashCode(), "AttemptCopyLastLogs.IsIncrementalReseedNecessary(): {0}: Found existing current log at '{1}'.", this.m_configuration.DisplayName, text);
                string identity = this.m_configuration.Identity;
                ExTraceGlobals.FaultInjectionTracer.TraceTest <string>(3880135997U, identity);
            }
            if (flag3)
            {
                ExTraceGlobals.ReplicaInstanceTracer.TraceDebug <string>((long)this.GetHashCode(), "AttemptCopyLastLogs.IsIncrementalReseedNecessary(): {0}: Now performing a divergence check...", this.m_configuration.DisplayName);
                flag2 = this.AreLogFilesDivergentFromSource(out flag, out errorString);
            }
            fileInfo.Refresh();
            e00Exists = fileInfo.Exists;
            if (!flag2 && e00Exists && !flag)
            {
                errorString = ReplayStrings.AcllFailedCurrentLogPresent(this.m_configuration.DisplayName, text, this.m_configuration.SourceMachine);
                ExTraceGlobals.ReplicaInstanceTracer.TraceDebug <string, string>((long)this.GetHashCode(), "AttemptCopyLastLogs.IsIncrementalReseedNecessary(): {0}: returning 'true' since current log '{1}' already exists.", this.m_configuration.DisplayName, text);
                flag2 = true;
            }
            return(flag2);
        }
Beispiel #3
0
        public LogChecksummer(string basename)
        {
            bool flag = false;

            EseHelper.GlobalInit();
            this.m_disposeTracker = this.GetDisposeTracker();
            this.m_instanceName   = string.Format("LogChecksummer {0} {1}", basename, this.GetHashCode());
            Api.JetCreateInstance(out this.m_instance, this.m_instanceName);
            this.m_basename = basename;
            bool jettermNeeded = true;

            try
            {
                InstanceParameters instanceParameters = new InstanceParameters(this.Instance);
                instanceParameters.Recovery           = false;
                instanceParameters.MaxTemporaryTables = 0;
                instanceParameters.NoInformationEvent = true;
                instanceParameters.BaseName           = basename;
                jettermNeeded = false;
                Api.JetInit(ref this.m_instance);
                jettermNeeded = true;
                Api.JetBeginSession(this.Instance, out this.m_sesid, null, null);
                this.AssertNotTerminated();
                flag = true;
                LogChecksummer.Tracer.TraceDebug <string, int>((long)this.GetHashCode(), "LogChecksummer created: {0}. DispTracker=0x{1:X}", this.m_instanceName, this.m_disposeTracker.GetHashCode());
            }
            finally
            {
                if (!flag)
                {
                    this.Term(jettermNeeded);
                }
            }
        }
        // Token: 0x06001BBB RID: 7099 RVA: 0x00076E40 File Offset: 0x00075040
        private void LogLossyAcll()
        {
            List <string> list        = new List <string>(4);
            string        simpleName  = AmServerName.GetSimpleName(this.m_configuration.SourceMachine);
            string        machineName = Environment.MachineName;

            foreach (IADDatabaseCopy iaddatabaseCopy in this.m_configuration.Database.DatabaseCopies)
            {
                if (!MachineName.Comparer.Equals(iaddatabaseCopy.HostServerName, simpleName) && !MachineName.Comparer.Equals(iaddatabaseCopy.HostServerName, machineName))
                {
                    list.Add(iaddatabaseCopy.HostServerName);
                }
            }
            string text       = string.Join(",", list.ToArray());
            long   generation = this.LastLogShipped;

            if (this.m_logCopier.GranuleUsedAsE00)
            {
                generation = 0L;
            }
            string               text2 = this.m_configuration.BuildFullLogfileName(generation);
            int                  num   = 0;
            Exception            ex;
            EseLogRecordPosition lastLogRecordPosition = EseHelper.GetLastLogRecordPosition(text2, this.m_configuration.E00LogBackupPath, out ex);

            if (lastLogRecordPosition != null)
            {
                num = lastLogRecordPosition.ByteOffsetToStartOfRec + lastLogRecordPosition.LogRecordLength;
            }
            else
            {
                AttemptCopyLastLogs.Tracer.TraceError <string, string>((long)this.GetHashCode(), "Failed to GetLastLogRecordPosition for '{0}': {1}", text2, (ex == null) ? "log appears empty" : ex.ToString());
            }
            ReplayCrimsonEvents.AcllReportedLoss2.Log <string, Guid, long, string, string, string, string, bool, string, string, string>(this.m_configuration.DatabaseName, this.m_configuration.IdentityGuid, this.NumberOfLogsLost, string.Format("0x{0:X}", this.LastLogNotified), string.Format("0x{0:X}", this.LastLogShipped), string.Format("0x{0:X}", num), string.Format("{0} UTC", this.LastLogInspectedTime.ToString("yyyy-MM-dd HH:mm:ss.fff")), this.m_logCopier.GranuleUsedAsE00, this.m_configuration.SourceMachine, text, this.m_uniqueOperationId);
        }
        // Token: 0x06001D19 RID: 7449 RVA: 0x00082A98 File Offset: 0x00080C98
        public static bool GenerationAvailableInDirectory(DirectoryInfo di, string prefix, string suffix, long generation)
        {
            string searchPattern = EseHelper.MakeLogfileName(prefix, suffix, generation);

            FileInfo[] files = di.GetFiles(searchPattern);
            return(files.Length != 0);
        }
Beispiel #6
0
        private DateTime GetFileTime(long generationNumber)
        {
            string   fileName = Path.Combine(this.Configuration.DestinationLogPath, EseHelper.MakeLogfileName(this.Configuration.LogFilePrefix, "." + this.Configuration.LogExtension, generationNumber));
            FileInfo fileInfo = new FileInfo(fileName);

            return(fileInfo.LastWriteTimeUtc);
        }
        // Token: 0x0600095F RID: 2399 RVA: 0x0002C270 File Offset: 0x0002A470
        public static EseLogRecordPosition GetLastLogRecordPosition(string logfileName, string temporaryDirectory, out Exception ex)
        {
            EseLogRecordPosition result = null;

            ex = null;
            try
            {
                EseLogRecord[] logRecords = EseHelper.GetLogRecords(logfileName, temporaryDirectory);
                if (logRecords.Length > 0)
                {
                    result = EseHelper.GetLastLogRecordPosition(logRecords);
                }
            }
            catch (EsentErrorException ex2)
            {
                ex = ex2;
            }
            catch (IOException ex3)
            {
                ex = ex3;
            }
            catch (UnauthorizedAccessException ex4)
            {
                ex = ex4;
            }
            return(result);
        }
 // Token: 0x06000978 RID: 2424 RVA: 0x0002C885 File Offset: 0x0002AA85
 private static void InternalTestBaseNameFromLogfileName()
 {
     EseHelper.InternalTestBaseNameFromLogfileName("e00.log", "e00");
     EseHelper.InternalTestBaseNameFromLogfileName("e0912345678.log", "e09");
     EseHelper.InternalTestBaseNameFromLogfileName("c:\\Data\\Files\\E07.log", "e07");
     EseHelper.InternalTestBaseNameFromLogfileName("z:\\Log Directory\\w060000AFC.log", "w06");
 }
        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);
        }
        private long GetGenerationFromFileName(string fileName)
        {
            long result;

            EseHelper.GetGenerationNumberFromFilename(fileName, this.m_prefix, out result);
            return(result);
        }
        public long FindLowestGenerationSlow()
        {
            string filter = string.Empty;
            long?  num    = null;

            for (int i = 7; i >= 0; i--)
            {
                for (int j = 1; j <= 15; j++)
                {
                    filter = this.BuildFilter(i, j);
                    num    = base.EnumerateFiles(filter, null).Min(delegate(string file)
                    {
                        long value;
                        if (string.IsNullOrEmpty(file) || !EseHelper.GetGenerationNumberFromFilename(file, this.m_prefix, out value))
                        {
                            return(null);
                        }
                        return(new long?(value));
                    });
                    if (num != null)
                    {
                        return(num.Value);
                    }
                }
            }
            return(0L);
        }
        public string FindHighestGenerationLogFile()
        {
            string filter = string.Empty;
            string result = null;
            long?  num    = null;

            for (int i = 0; i < 8; i++)
            {
                for (int j = 15; j > 0; j--)
                {
                    filter = this.BuildFilter(i, j);
                    num    = base.EnumerateFiles(filter, null).Max(delegate(string file)
                    {
                        long value;
                        if (string.IsNullOrEmpty(file) || !EseHelper.GetGenerationNumberFromFilename(file, this.m_prefix, out value))
                        {
                            return(null);
                        }
                        return(new long?(value));
                    });
                    if (num != null)
                    {
                        return(EseHelper.MakeLogfileName(this.m_prefix, this.m_suffix, num.Value));
                    }
                }
            }
            return(result);
        }
        // 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));
        }
 // Token: 0x06000975 RID: 2421 RVA: 0x0002C6EB File Offset: 0x0002A8EB
 internal static void InternalTest()
 {
     EseHelper.InternalTestBaseNameFromLogfileName();
     EseHelper.InternalTestNameGeneration();
     EseHelper.InternalTestParseLogfileDump();
     EseHelper.InternalTestParseLogfileDumpBadData();
     EseHelper.InternalTestCreateTempLog();
 }
        // 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)
            {
            }
        }
Beispiel #16
0
        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);
        }
 // Token: 0x06000970 RID: 2416 RVA: 0x0002C548 File Offset: 0x0002A748
 public static EseLogRecord[] GetLogRecords(string logfile, string temporaryDirectory)
 {
     EseLogRecord[] result;
     using (TemporaryFile temporaryFile = EseHelper.CreateTemporaryFile(temporaryDirectory))
     {
         EseHelper.DumpLogRecordsToFile(logfile, temporaryFile);
         result = EseHelper.ParseLogfileDump(temporaryFile);
     }
     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: 0x0600096C RID: 2412 RVA: 0x0002C498 File Offset: 0x0002A698
 public static string MakeLogfileName(string logfilePrefix, string logfileSuffix, long generation)
 {
     if (0L == generation)
     {
         return(EseHelper.MakeLogfileName(logfilePrefix, logfileSuffix));
     }
     return(logfilePrefix + string.Format(CultureInfo.InvariantCulture, "{0:X8}", new object[]
     {
         generation
     }) + logfileSuffix);
 }
 // Token: 0x0600095E RID: 2398 RVA: 0x0002C120 File Offset: 0x0002A320
 public static bool IsLogfileEqual(string logfile1, string logfile2, string temporaryDirectory, EseLogRecordPosition lastRec1, EseLogRecordPosition lastRec2)
 {
     EseLogRecord[] logRecords  = EseHelper.GetLogRecords(logfile1, temporaryDirectory);
     EseLogRecord[] logRecords2 = EseHelper.GetLogRecords(logfile2, temporaryDirectory);
     if (lastRec1 != null)
     {
         EseLogRecordPosition lastLogRecordPosition = EseHelper.GetLastLogRecordPosition(logRecords);
         if (lastLogRecordPosition != null)
         {
             lastRec1.LogPos          = lastLogRecordPosition.LogPos;
             lastRec1.LogRecordLength = lastLogRecordPosition.LogRecordLength;
             lastRec1.LogSectorSize   = lastLogRecordPosition.LogSectorSize;
         }
     }
     if (lastRec2 != null)
     {
         EseLogRecordPosition lastLogRecordPosition2 = EseHelper.GetLastLogRecordPosition(logRecords2);
         if (lastLogRecordPosition2 != null)
         {
             lastRec2.LogPos          = lastLogRecordPosition2.LogPos;
             lastRec2.LogRecordLength = lastLogRecordPosition2.LogRecordLength;
             lastRec2.LogSectorSize   = lastLogRecordPosition2.LogSectorSize;
         }
     }
     if (logRecords2.Length != logRecords.Length)
     {
         ExTraceGlobals.EseutilWrapperTracer.TraceDebug(0L, "IsLogfileEqual({0},{1}) returns false. {0} has {2} records. {1} has {3} records.", new object[]
         {
             logfile1,
             logfile2,
             logRecords.Length,
             logRecords2.Length
         });
         return(false);
     }
     for (int i = 0; i < logRecords.Length; i++)
     {
         if (logRecords[i].ToString() != logRecords2[i].ToString())
         {
             ExTraceGlobals.EseutilWrapperTracer.TraceDebug(0L, "IsLogfileEqual({0},{1}) returns false. {0} has {2} records. {1} has {3} records. The differing log records are {4} and {5}. Differing position is {6}.", new object[]
             {
                 logfile1,
                 logfile2,
                 logRecords.Length,
                 logRecords2.Length,
                 logRecords[i],
                 logRecords2[i],
                 i
             });
             return(false);
         }
     }
     return(true);
 }
        // Token: 0x06001BBC RID: 7100 RVA: 0x00076FFC File Offset: 0x000751FC
        private DateTime GetWriteTimeFromLastCopiedGeneration()
        {
            long      arg    = -1L;
            string    text   = null;
            DateTime  result = ReplayState.ZeroFileTime;
            Exception ex     = null;
            bool      flag   = false;

            try
            {
                long[] array = new long[]
                {
                    0L,
                    this.LastLogShipped
                };
                foreach (long num in array)
                {
                    string text2 = EseHelper.MakeLogFilePath(this.m_configuration, num, this.m_configuration.DestinationLogPath);
                    arg  = num;
                    text = text2;
                    FileInfo fileInfo = new FileInfo(text2);
                    if (fileInfo.Exists)
                    {
                        result = fileInfo.LastWriteTimeUtc;
                        flag   = true;
                        break;
                    }
                }
            }
            catch (IOException ex2)
            {
                ex = ex2;
            }
            catch (SecurityException ex3)
            {
                ex = ex3;
            }
            catch (UnauthorizedAccessException ex4)
            {
                ex = ex4;
            }
            if (ex != null)
            {
                AttemptCopyLastLogs.Tracer.TraceError <long, string, Exception>((long)this.GetHashCode(), "GetWriteTimeFromGeneration() for gen {0}, log file '{1}' threw exception: {2}", arg, text, ex);
                throw new AcllLastLogTimeErrorException(this.m_configuration.DisplayName, text, ex.Message, ex);
            }
            if (!flag)
            {
                throw new AcllLastLogNotFoundException(this.m_configuration.DisplayName, this.LastLogShipped);
            }
            return(result);
        }
Beispiel #22
0
        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);
            }
        }
Beispiel #23
0
 // Token: 0x06001E89 RID: 7817 RVA: 0x0008A8F8 File Offset: 0x00088AF8
 public bool Start()
 {
     this.SafetyNetVersionChecker.Start();
     this.ConfigurationUpdater.Start();
     this.DumpsterRedeliveryManager.Start();
     this.SkippedLogsDeleter.Start();
     this.SearchServiceMonitor.Start();
     EseHelper.GlobalInit();
     ExTraceGlobals.PFDTracer.TracePfd <int>((long)this.GetHashCode(), "PFD CRS {0} EseHelper Initialization", 31901);
     if (this.HealthThread != null)
     {
         this.HealthThread.Start();
     }
     return(true);
 }
        // Token: 0x06000971 RID: 2417 RVA: 0x0002C598 File Offset: 0x0002A798
        internal static void DumpLogRecordsToFile(string logfile, string outputFile)
        {
            ExTraceGlobals.EseutilWrapperTracer.TraceDebug <string, string>(0L, "Dumping logfile {0} to output file {1}", logfile, outputFile);
            string      basename    = EseHelper.BaseNameFromLogfileName(logfile);
            LogVerifier logVerifier = new LogVerifier(basename, outputFile);

            try
            {
                logVerifier.Dump(logfile);
            }
            finally
            {
                logVerifier.Term();
            }
        }
        // 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);
        }
Beispiel #26
0
        public void Initialize(long logGeneration, string logPath, string prefix, string suffix)
        {
            string text = Path.Combine(logPath, EseHelper.MakeLogfileName(prefix, suffix, logGeneration));

            this.Initialized = false;
            try
            {
                JET_LOGINFOMISC logInfo;
                UnpublishedApi.JetGetLogFileInfo(text, out logInfo, JET_LogInfo.Misc2);
                LocalizedString localizedString;
                this.Examine(logInfo, text, out localizedString);
            }
            catch (EsentErrorException ex)
            {
                LogContinuityChecker.Tracer.TraceError <string, EsentErrorException>((long)this.GetHashCode(), "LogContinuityChecker failed to init with '{0}': {1}", text, ex);
                throw new LogInspectorFailedGeneralException(text, ex.Message, ex);
            }
        }
Beispiel #27
0
        private LogVerifier(string basename, bool ignored)
        {
            bool flag = false;

            EseHelper.GlobalInit();
            this.m_instanceName = string.Concat(new object[]
            {
                "Log Verifier ",
                basename,
                " ",
                this.GetHashCode()
            });
            Api.JetCreateInstance(out this.m_instance, this.m_instanceName);
            this.m_basename = basename;
            bool jettermNeeded = true;

            try
            {
                InstanceParameters instanceParameters = new InstanceParameters(this.Instance);
                instanceParameters.Recovery           = false;
                instanceParameters.MaxTemporaryTables = 0;
                instanceParameters.NoInformationEvent = true;
                instanceParameters.EventLoggingLevel  = EventLoggingLevels.Min;
                instanceParameters.BaseName           = basename;
                jettermNeeded = false;
                Api.JetInit(ref this.m_instance);
                jettermNeeded = true;
                Api.JetBeginSession(this.Instance, out this.m_sesid, null, null);
                this.m_dbutil       = new JET_DBUTIL();
                this.m_dbutil.sesid = this.Sesid;
                this.m_dbutil.op    = DBUTIL_OP.DumpLogfile;
                this.AssertNotTerminated();
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    this.Term(jettermNeeded);
                }
            }
        }
        // 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
            });
        }
Beispiel #29
0
        // Token: 0x06001B12 RID: 6930 RVA: 0x0007430C File Offset: 0x0007250C
        public bool Start()
        {
            bool fStarted;

            lock (this)
            {
                if (!this.m_fStarted)
                {
                    EseHelper.GlobalInit();
                    this.m_cleaner.Start();
                    this.m_fStarted = true;
                }
                else
                {
                    ExTraceGlobals.SeederServerTracer.TraceDebug((long)this.GetHashCode(), "SeedManager is already started.");
                }
                fStarted = this.m_fStarted;
            }
            return(fStarted);
        }
Beispiel #30
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);
            }
        }