示例#1
0
        internal PhysicalLogWriter(
            ILogicalLog logicalLogStream,
            LogRecord tailRecord,
            PhysicalLogWriterCallbackManager callbackManager,
            Exception closedException,
            ITracer tracer,
            int maxWriteCacheSizeInMB,
            IncomingBytesRateCounterWriter incomingBytesRateCounterWriter,
            LogFlushBytesRateCounterWriter logFlushBytesRateCounterWriter,
            AvgBytesPerFlushCounterWriter bytesPerFlushCounterWriter,
            AvgFlushLatencyCounterWriter avgFlushLatencyCounterWriter,
            AvgSerializationLatencyCounterWriter avgSerializationLatencyCounterWriter)
        {
            Utility.Assert(callbackManager != null, "PhysicalLogWriter cannot accept null callback managers");

            this.incomingBytesRateCounterWriter       = incomingBytesRateCounterWriter;
            this.logFlushBytesRateCounterWriter       = logFlushBytesRateCounterWriter;
            this.bytesPerFlushCounterWriter           = bytesPerFlushCounterWriter;
            this.avgFlushLatencyCounterWriter         = avgFlushLatencyCounterWriter;
            this.avgSerializationLatencyCounterWriter = avgSerializationLatencyCounterWriter;

            this.maxWriteCacheSizeInBytes = maxWriteCacheSizeInMB * 1024 * 1024;
            this.Init(tracer, closedException);
            this.logicalLogStream = logicalLogStream;
            this.callbackManager  = callbackManager;
            this.SetTailRecord(tailRecord);
            Utility.Assert(
                this.currentLogTailPosition == (ulong)logicalLogStream.WritePosition,
                "this.currentLogTailPosition:{0} should be equal to logicalLogStream.WritePosition:{1}",
                this.currentLogTailPosition, logicalLogStream.WritePosition);
            this.recordWriter           = new BinaryWriter(new MemoryStream());
            this.recomputeRecordOffsets = false;
        }
示例#2
0
        internal PhysicalLogWriter(
            ILogicalLog logicalLogStream,
            PhysicalLogWriterCallbackManager callbackManager,
            ITracer tracer,
            int maxWriteCacheSizeInMB,
            IncomingBytesRateCounterWriter incomingBytesRateCounterWriter,
            LogFlushBytesRateCounterWriter logFlushBytesRateCounterWriter,
            AvgBytesPerFlushCounterWriter bytesPerFlushCounterWriter,
            AvgFlushLatencyCounterWriter avgFlushLatencyCounterWriter,
            AvgSerializationLatencyCounterWriter avgSerializationLatencyCounterWriter,
            bool recomputeRecordOffsets)
        {
            Utility.Assert(callbackManager != null, "PhysicalLogWriter cannot accept null callback managers");

            this.maxWriteCacheSizeInBytes = maxWriteCacheSizeInMB * 1024 * 1024;
            this.Init(tracer, null);
            this.logicalLogStream                     = logicalLogStream;
            this.callbackManager                      = callbackManager;
            this.currentLogTailPosition               = (ulong)logicalLogStream.WritePosition;
            this.currentLogTailRecord                 = LogRecord.InvalidLogRecord;
            this.currentLogTailPsn                    = new PhysicalSequenceNumber(-1);
            this.lastPhysicalRecord                   = null;
            this.incomingBytesRateCounterWriter       = incomingBytesRateCounterWriter;
            this.logFlushBytesRateCounterWriter       = logFlushBytesRateCounterWriter;
            this.bytesPerFlushCounterWriter           = bytesPerFlushCounterWriter;
            this.avgFlushLatencyCounterWriter         = avgFlushLatencyCounterWriter;
            this.avgSerializationLatencyCounterWriter = avgSerializationLatencyCounterWriter;
            this.recordWriter           = new BinaryWriter(new MemoryStream());
            this.recomputeRecordOffsets = recomputeRecordOffsets;
        }
示例#3
0
 internal MemoryLogManager(
     string baseLogFileAlias,
     IncomingBytesRateCounterWriter incomingBytesRateCounter,
     LogFlushBytesRateCounterWriter logFlushBytesRateCounter,
     AvgBytesPerFlushCounterWriter bytesPerFlushCounterWriter,
     AvgFlushLatencyCounterWriter avgFlushLatencyCounterWriter,
     AvgSerializationLatencyCounterWriter avgSerializationLatencyCounterWriter)
     : base(
         baseLogFileAlias,
         incomingBytesRateCounter,
         logFlushBytesRateCounter,
         bytesPerFlushCounterWriter,
         avgFlushLatencyCounterWriter,
         avgSerializationLatencyCounterWriter)
 {
 }
 internal FileLogManager(
     string baseLogFileAlias,
     IncomingBytesRateCounterWriter incomingBytesRateCounter,
     LogFlushBytesRateCounterWriter logFlushBytesRateCounter,
     AvgBytesPerFlushCounterWriter bytesPerFlushCounterWriter,
     AvgFlushLatencyCounterWriter avgFlushLatencyCounterWriter,
     AvgSerializationLatencyCounterWriter avgSerializationLatencyCounterWriter)
     : this(
         baseLogFileAlias,
         incomingBytesRateCounter,
         logFlushBytesRateCounter,
         bytesPerFlushCounterWriter,
         avgFlushLatencyCounterWriter,
         avgSerializationLatencyCounterWriter,
         new LogWriteFaultInjectionParameters())
 {
 }
示例#5
0
        internal KtlLogManager(
            string baseLogFileAlias,
            IncomingBytesRateCounterWriter incomingBytesRateCounter,
            LogFlushBytesRateCounterWriter logFlushBytesRateCounter,
            AvgBytesPerFlushCounterWriter bytesPerFlushCounterWriter,
            AvgFlushLatencyCounterWriter avgFlushLatencyCounterWriter,
            AvgSerializationLatencyCounterWriter avgSerializationLatencyCounterWriter,
            LogWriteFaultInjectionParameters logWriteDelayParameters)
            : base(
                baseLogFileAlias,
                incomingBytesRateCounter,
                logFlushBytesRateCounter,
                bytesPerFlushCounterWriter,
                avgFlushLatencyCounterWriter,
                avgSerializationLatencyCounterWriter)
        {
            this.physicalLogManager = null;
            this.physicalLog        = null;

            this.logWriteDelayParameters = logWriteDelayParameters;
        }
示例#6
0
 protected LogManager(
     string baseLogFileAlias,
     IncomingBytesRateCounterWriter incomingBytesRateCounter,
     LogFlushBytesRateCounterWriter logFlushBytesRateCounter,
     AvgBytesPerFlushCounterWriter bytesPerFlushCounterWriter,
     AvgFlushLatencyCounterWriter avgFlushLatencyCounterWriter,
     AvgSerializationLatencyCounterWriter avgSerializationLatencyCounterWriter)
 {
     this.BaseLogFileAlias                     = baseLogFileAlias;
     this.CurrentLogFileAlias                  = this.BaseLogFileAlias;
     this.LogicalLog                           = null;
     this.IsDisposed                           = false;
     this.LogHeadRecordPosition                = 0;
     this.PhysicalLogWriter                    = null;
     this.logReaderRanges                      = new List <LogReaderRange>();
     this.earliestLogReader                    = LogReaderRange.DefaultLogReaderRange;
     this.pendingLogHeadTruncationContext      = null;
     this.IncomingBytesRateCounterWriter       = incomingBytesRateCounter;
     this.LogFlushBytesRateCounterWriter       = logFlushBytesRateCounter;
     this.AvgFlushLatencyCounterWriter         = avgFlushLatencyCounterWriter;
     this.AvgSerializationLatencyCounterWriter = avgSerializationLatencyCounterWriter;
     this.BytesPerFlushCounterWriter           = bytesPerFlushCounterWriter;
 }