예제 #1
0
        // Token: 0x06001AC5 RID: 6853 RVA: 0x00072DCC File Offset: 0x00070FCC
        public void SendLogFiles()
        {
            MonitoredDatabase monitoredDatabase = this.GetMonitoredDatabase();
            string            suffix            = '.' + monitoredDatabase.Config.LogExtension;
            DirectoryInfo     di = new DirectoryInfo(monitoredDatabase.Config.SourceLogPath);
            long num             = ShipControl.HighestGenerationInDirectory(di, monitoredDatabase.Config.LogFilePrefix, suffix);
            long num2            = ShipControl.LowestGenerationInDirectory(di, monitoredDatabase.Config.LogFilePrefix, suffix, false);

            for (long num3 = num2; num3 <= num; num3 += 1L)
            {
                this.CheckSeedingCancelled();
                try
                {
                    monitoredDatabase.SendLog(num3, this.m_channel, null);
                }
                catch (FileIOonSourceException ex)
                {
                    ExTraceGlobals.SeederServerTracer.TraceDebug <long, Exception>((long)this.GetHashCode(), "failed to send generation 0x{0:X} because {1}", num3, ex.InnerException);
                    this.m_channel.SendException(ex.InnerException);
                    this.CancelSeeding(ex.LocalizedString);
                    return;
                }
            }
            NotifyEndOfLogReply notifyEndOfLogReply = new NotifyEndOfLogReply(this.m_channel, NetworkChannelMessage.MessageType.NotifyEndOfLogReply, num, DateTime.UtcNow);

            this.TraceDebug("reached the end of log files", new object[0]);
            notifyEndOfLogReply.Send();
        }
예제 #2
0
        private void ProbeForLowestLogPresent()
        {
            DirectoryInfo di = new DirectoryInfo(this.Configuration.DestinationLogPath);
            long          lowestGenerationPresent = ShipControl.LowestGenerationInDirectory(di, this.Configuration.LogFilePrefix, "." + this.Configuration.LogExtension, false);

            this.FileChecker.FileState.SetLowestGenerationPresent(lowestGenerationPresent);
        }
예제 #3
0
        public long DetermineStartOfLog()
        {
            DirectoryInfo di  = new DirectoryInfo(this.m_sourceDir);
            long          num = ShipControl.LowestGenerationInDirectory(di, this.m_logPrefix, this.m_logSuffix, false);

            ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug <long>((long)this.GetHashCode(), "DetermineStartOfLog 0x{0:x}", num);
            return(num);
        }
예제 #4
0
        private void DetermineEndOfLog()
        {
            if (this.TestCallbackForEndOfLogScan != null)
            {
                this.TestCallbackForEndOfLogScan();
            }
            DirectoryInfo di            = new DirectoryInfo(this.m_sourceDir);
            long          highestLogGen = ShipControl.HighestGenerationInDirectory(di, this.m_logPrefix, this.m_logSuffix);

            this.UpdateCurrentEndOfLog(highestLogGen, true);
        }
예제 #5
0
        // Token: 0x06001D18 RID: 7448 RVA: 0x00082A44 File Offset: 0x00080C44
        public static long HighestGenerationInDirectory(DirectoryInfo di, string prefix, string suffix)
        {
            long result = 0L;

            using (EseLogEnumerator eseLogEnumerator = new EseLogEnumerator(di, prefix, suffix))
            {
                string text = eseLogEnumerator.FindHighestGenerationLogFile();
                if (!string.IsNullOrEmpty(text))
                {
                    ShipControl.GetGenerationNumberFromFilename(Path.GetFileName(text), prefix, out result);
                }
            }
            return(result);
        }
 public void ConfirmLogReset()
 {
     if (this.m_logResetPending)
     {
         Exception ex = null;
         try
         {
             long num = ShipControl.HighestGenerationInDirectory(new DirectoryInfo(this.m_config.DestinationLogPath), this.m_config.LogFilePrefix, "." + this.m_config.LogExtension);
             ExTraceGlobals.ReplicaInstanceTracer.TraceDebug <string, long>((long)this.GetHashCode(), "LogStreamResetOnMount: {0}: log stream reset confirmed at 0x{1:X}", this.m_config.Name, num);
             this.m_logResetPending = false;
             this.m_config.UpdateLastLogGeneratedAndEndOfLogInfo(num);
         }
         catch (IOException ex2)
         {
             ex = ex2;
         }
         catch (SecurityException ex3)
         {
             ex = ex3;
         }
         catch (TransientException ex4)
         {
             ex = ex4;
         }
         catch (AmServerException ex5)
         {
             ex = ex5;
         }
         if (ex != null)
         {
             ExTraceGlobals.ReplicaInstanceTracer.TraceError <string, Exception>((long)this.GetHashCode(), "LogStreamResetOnMount: {0}: log stream reset confirmation failed with exception: {1}", this.m_config.Name, ex);
             return;
         }
     }
     else
     {
         ExTraceGlobals.ReplicaInstanceTracer.TraceDebug <string>((long)this.GetHashCode(), "LogStreamResetOnMount: {0}: normal mount: no log stream reset was pending", this.m_config.Name);
     }
 }
예제 #7
0
        internal static void TryUpdateLastLogGenerationNumberOnMount(ReplayConfiguration config, LogStreamResetOnMount logReset, MountDirectPerformanceTracker mountPerf, int mountFlags, long highestLogGen)
        {
            bool flag = (mountFlags & 2) == 2;

            mountPerf.IsLossyMountEnabled = flag;
            mountPerf.HighestLogGenBefore = highestLogGen;
            mountPerf.HighestLogGenAfter  = highestLogGen;
            ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid, bool>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): fLossyMountEnabled = '{2}'", config.Name, config.IdentityGuid, flag);
            string logDirectory = config.DestinationLogPath;

            if (!flag)
            {
                long lowestLogGen = 0L;
                mountPerf.RunTimedOperation(MountDatabaseDirectOperation.LowestGenerationInDirectory, delegate
                {
                    lowestLogGen = ShipControl.LowestGenerationInDirectory(new DirectoryInfo(logDirectory), config.LogFilePrefix, "." + config.LogExtension, true);
                });
                if (lowestLogGen == 0L)
                {
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug((long)config.GetHashCode(), "Looks like a log stream reset");
                    logReset.ResetLogStream();
                    return;
                }
            }
            if (config.Type == ReplayConfigType.SingleCopySource)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid, ReplayConfigType>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Skipping updating last log generation since the config is of type '{2}'.", config.DisplayName, config.IdentityGuid, config.Type);
                return;
            }
            try
            {
                if (highestLogGen > 0L)
                {
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid, long>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Known highest log generation is {2}.", config.Name, config.IdentityGuid, highestLogGen);
                    mountPerf.RunTimedOperation(MountDatabaseDirectOperation.GenerationAvailableInDirectory, delegate
                    {
                        if (!ShipControl.GenerationAvailableInDirectory(new DirectoryInfo(logDirectory), config.LogFilePrefix, "." + config.LogExtension, highestLogGen))
                        {
                            ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Log file for known highest generation does not exist, will scan directory to determine the max generation.", config.Name, config.IdentityGuid);
                            highestLogGen = 0L;
                        }
                    });
                }
                if (highestLogGen <= 0L)
                {
                    mountPerf.RunTimedOperation(MountDatabaseDirectOperation.HighestGenerationInDirectory, delegate
                    {
                        highestLogGen = ShipControl.HighestGenerationInDirectory(new DirectoryInfo(logDirectory), config.LogFilePrefix, "." + config.LogExtension);
                    });
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Highest log in directory '{2}' is {3}.", new object[]
                    {
                        config.Name,
                        config.IdentityGuid,
                        logDirectory,
                        highestLogGen
                    });
                }
                mountPerf.HighestLogGenAfter = highestLogGen;
                if (highestLogGen <= 0L)
                {
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Skipping updating last log generation since highest log gen is <= 0.", config.Name, config.IdentityGuid);
                }
                else
                {
                    mountPerf.RunTimedOperation(MountDatabaseDirectOperation.UpdateLastLogGeneratedInClusDB, delegate
                    {
                        config.UpdateLastLogGeneratedAndEndOfLogInfo(highestLogGen);
                    });
                }
            }
            catch (IOException ex)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceError((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Caught IO exception for path '{2}'. {3}", new object[]
                {
                    config.Name,
                    config.IdentityGuid,
                    logDirectory,
                    ex
                });
            }
            catch (SecurityException ex2)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceError((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Caught SecurityException for path '{2}'. {3}", new object[]
                {
                    config.Name,
                    config.IdentityGuid,
                    logDirectory,
                    ex2
                });
            }
            catch (ClusterException arg)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceError <string, Guid, ClusterException>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Caught exception at SetLastLogGenerationNumber. {2}", config.Name, config.IdentityGuid, arg);
            }
        }