예제 #1
0
        public bool ReaderHasBytesToParse()
        {
            long logFileSize = this.GetLogFileSize();

            if (logFileSize == 0L)
            {
                return(false);
            }
            if (this.lastReaderProcessedEndOffset < this.lastCheckedEndOffsertBeforeHoles)
            {
                ServiceLogger.LogCommon(ServiceLogger.LogLevel.Error, "lastReaderProcessedEndOffset", string.Format("this.lastReaderProcessedEndOffset {0}, lastCheckedEndOffsertBeforeHoles {1}", this.lastReaderProcessedEndOffset, this.lastCheckedEndOffsertBeforeHoles), ServiceLogger.Component.WatermarkFile, this.instance, this.logFileFullName);
                Tools.DebugAssert(false, string.Format("this.lastReaderProcessedEndOffset {0}, lastCheckedEndOffsertBeforeHoles {1}", this.lastReaderProcessedEndOffset, this.lastCheckedEndOffsertBeforeHoles));
            }
            if (this.blocksNeedReprocessing.Count == 0 && this.lastCheckedEndOffsertBeforeHoles < this.lastReaderProcessedEndOffset)
            {
                if (this.inMemoryBatchCount == 0)
                {
                    this.FindUnprocessedHoles();
                }
                else
                {
                    ServiceLogger.LogCommon(ServiceLogger.LogLevel.Debug, "MemoryBatchCountNotZero", this.inMemoryBatchCount.ToString(), ServiceLogger.Component.WatermarkFile, this.instance, this.logFileFullName);
                }
            }
            return(this.blocksNeedReprocessing.Count > 0 || logFileSize > this.lastReaderProcessedEndOffset);
        }
예제 #2
0
 private void TraceBlockNeedProcessing(long startOffset, long endOffset)
 {
     if (ServiceLogger.ServiceLogLevel == ServiceLogger.LogLevel.Debug)
     {
         string message = string.Format("FindblocksNeedProcessing for {0} add ({1}, {2})", Path.GetFileName(this.logFileFullName), startOffset, endOffset);
         ExTraceGlobals.ReaderTracer.TraceDebug((long)this.GetHashCode(), message);
         ServiceLogger.LogCommon(ServiceLogger.LogLevel.Debug, "FindblocksNeedProcessing", string.Format("{0},{1}", startOffset, endOffset), ServiceLogger.Component.WatermarkFile, this.instance, this.LogFileFullName);
     }
 }
예제 #3
0
        public bool IsLogCompleted()
        {
            bool flag = this.ReaderHasBytesToParse();

            ServiceLogger.LogCommon(ServiceLogger.LogLevel.Debug, "LogIsNotCompleted", string.Format("{0}, {1}, {2}, {3} ", new object[]
            {
                this.blocksNeedReprocessing.Count,
                this.lastCheckedEndOffsertBeforeHoles,
                this.lastReaderProcessedEndOffset,
                this.inMemoryBatchCount
            }), ServiceLogger.Component.WatermarkFile, this.instance, this.logFileFullName);
            return(!flag && this.lastCheckedEndOffsertBeforeHoles >= this.GetLogFileSize());
        }
예제 #4
0
        internal void FindUnprocessedHoles()
        {
            if (ServiceLogger.ServiceLogLevel == ServiceLogger.LogLevel.Debug)
            {
                string message = string.Format("FindblocksNeedProcessing found {0} blocks processed for {1}", this.blocksProcessed.Count, this.LogFileFullName);
                ExTraceGlobals.ReaderTracer.TraceDebug((long)this.GetHashCode(), message);
            }
            Tools.DebugAssert(this.blocksNeedReprocessing.Count == 0, "this.blocksNeedProcessing.Count == 0");
            bool foundHole             = false;
            Action <long, long> action = delegate(long s, long e)
            {
                foundHole = true;
                LogFileRange logFileRange2 = new LogFileRange(s, e, ProcessingStatus.NeedProcessing);
                this.TraceBlockNeedProcessing(logFileRange2.StartOffset, logFileRange2.EndOffset);
                this.blocksNeedReprocessing.Add(logFileRange2);
            };
            long num = 0L;

            lock (this.blocksProcessedLock)
            {
                int count = this.blocksProcessed.Count;
                this.lastCheckedEndOffsertBeforeHoles = 0L;
                for (int i = 0; i < count; i++)
                {
                    LogFileRange logFileRange = this.blocksProcessed.Values[i];
                    if (logFileRange.EndOffset < logFileRange.StartOffset)
                    {
                        ServiceLogger.LogCommon(ServiceLogger.LogLevel.Error, "Invalid watermark range", string.Format("{0},{1}", logFileRange.StartOffset, logFileRange.EndOffset), ServiceLogger.Component.WatermarkFile, "", "");
                        Tools.DebugAssert(false, string.Format("detected invalid range {0},{1}", logFileRange.StartOffset, logFileRange.EndOffset));
                    }
                    else
                    {
                        if (num < logFileRange.StartOffset)
                        {
                            action(num, logFileRange.StartOffset);
                        }
                        num = Math.Max(num, logFileRange.EndOffset);
                        if (!foundHole)
                        {
                            this.lastCheckedEndOffsertBeforeHoles = num;
                        }
                    }
                }
            }
            if (this.lastReaderProcessedEndOffset > num)
            {
                action(num, this.lastReaderProcessedEndOffset);
            }
        }
예제 #5
0
 public static void Log(ServiceLogger.LogLevel logLevel, ServiceLogger.Component componentName, LogUploaderEventLogConstants.Message message, string customData, string logFileType, string logFilePath)
 {
     ServiceLogger.LogCommon(logLevel, message.ToString(), customData, componentName, logFileType, logFilePath);
 }