internal static void Assert(bool condition, string format, RecordProcessingMode param1) { if (condition == false) { var failFastMessage = string.Format(System.Globalization.CultureInfo.InvariantCulture, format, param1); FailFast(failFastMessage); // AMW - Force break into debugger for ease of debugging Debugger.Break(); } }
private void PrepareToProcessRecord(LogRecord record, RecordProcessingMode processingMode) { Utility.Assert( processingMode < RecordProcessingMode.ProcessImmediately, "processingMode < RecordProcessingMode.ProcessImmediately"); var logicalRecord = record as LogicalLogRecord; if (logicalRecord != null) { this.processor.PrepareToProcessLogicalRecord(); } else { this.processor.PrepareToProcessPhysicalRecord(); } }
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; }