private static void ProcessDuplicateRecord(LogRecord record) { record.CompletedFlush(null); record.CompletedApply(null); record.CompletedProcessing(null); return; }
public async Task ImmediatelyProcessRecord( LogRecord record, Exception flushException, RecordProcessingMode processingMode) { Utility.Assert( processingMode > RecordProcessingMode.Normal, "processingMode ({0}) > RecordProcessingMode.Normal", processingMode); // TODO: Temporary double check. Utility.Assert(record.RecordType != LogRecordType.Backup, "record.RecordType != LogRecordType.Backup"); Exception exception = null; if (flushException != null) { Utility.Assert( this.logException != null, "FlushException is {0} and this.logException is null", flushException); exception = flushException; } // In case there was an apply failure, we should fault any further applies of any records. // Without this, we could end up assuming that all applies have succeeded and as a result, issue a checkpoint call if (exception == null) { exception = this.serviceException; } FabricEvents.Events.RecordProcessedImmediatelyNoise( this.tracer.Type, (int)this.roleContextDrainState.DrainingStream, record.Psn.PSN); var information = string.Empty; switch (record.RecordType) { case LogRecordType.TruncateHead: this.checkpointManager.ApplyLogHeadTruncationIfPermitted(exception, record); break; case LogRecordType.BeginCheckpoint: if (processingMode == RecordProcessingMode.ProcessImmediately) { goto default; } await this.checkpointManager.ApplyCheckpointIfPermitted(exception, record).ConfigureAwait(false); break; case LogRecordType.Information: information = '-' + ((InformationLogRecord)record).InformationEvent.ToString(); goto case LogRecordType.EndCheckpoint; case LogRecordType.EndCheckpoint: case LogRecordType.TruncateTail: case LogRecordType.Indexing: case LogRecordType.UpdateEpoch: goto default; default: record.CompletedApply(exception); break; } if (processingMode == RecordProcessingMode.ProcessImmediately) { FabricEvents.Events.RecordProcessedImmediately( this.tracer.Type, (int)this.roleContextDrainState.DrainingStream, information, record.Psn.PSN); record.CompletedProcessing(null); } return; }