public static bool TryGetReplicationEventInfo(CheckId checkId, ReplicationCheckResultEnum result, out ReplicationEventBaseInfo eventInfo)
 {
     eventInfo = null;
     if (ReplicationEventLookupTable.s_checksEventTable.ContainsKey((int)checkId))
     {
         if (ReplicationEventLookupTable.s_checksEventTable[(int)checkId].ContainsKey((int)result))
         {
             eventInfo = ReplicationEventLookupTable.s_checksEventTable[(int)checkId][(int)result];
             return(true);
         }
         DiagCore.RetailAssert(false, "Missing event entry for CheckId {0} and result {1}.", new object[]
         {
             checkId,
             result
         });
     }
     return(false);
 }
Esempio n. 2
0
        public void LogEvents(CheckId checkId, ReplicationCheckResultEnum result, List <MessageInfo> messages)
        {
            ReplicationEventBaseInfo replicationEventBaseInfo = null;

            if (!ReplicationEventLookupTable.TryGetReplicationEventInfo(checkId, result, out replicationEventBaseInfo))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <CheckId, ReplicationCheckResultEnum>((long)this.GetHashCode(), "LogEvents(): Could not find ReplicationEventBaseInfo for Check '{0}' with Result '{1}'.", checkId, result);
                return;
            }
            if (replicationEventBaseInfo.EventType == ReplicationEventType.Null)
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <CheckId, ReplicationCheckResultEnum>((long)this.GetHashCode(), "LogEvents(): NullEventInfo encountered for check {0} and result {1}. No event will be logged.", checkId, result);
                return;
            }
            if (replicationEventBaseInfo.EventType != ReplicationEventType.MOM)
            {
                if (replicationEventBaseInfo.EventType == ReplicationEventType.AppLog)
                {
                    bool flag = false;
                    Dictionary <string, ReplicationEvent> dictionary = null;
                    if (!this.m_AppLogSingleEvents.TryGetValue((int)checkId, out dictionary))
                    {
                        dictionary = new Dictionary <string, ReplicationEvent>();
                        flag       = true;
                    }
                    foreach (MessageInfo messageInfo in messages)
                    {
                        if (messageInfo.IsTransitioningState)
                        {
                            ReplicationEvent replicationEvent = new ReplicationEvent(replicationEventBaseInfo);
                            replicationEvent.AddEvent(messageInfo.Message);
                            dictionary[messageInfo.InstanceIdentity] = replicationEvent;
                        }
                    }
                    if (flag)
                    {
                        this.m_AppLogSingleEvents[(int)checkId] = dictionary;
                        return;
                    }
                }
                else
                {
                    DiagCore.RetailAssert(false, "Unhandled ReplicationEventType!", new object[0]);
                }
                return;
            }
            int              momEventId   = ((MomEventInfo)replicationEventBaseInfo).MomEventId;
            string           eventMessage = this.BuildErrorMessageForMomEvent(messages);
            ReplicationEvent replicationEvent2;

            if (this.m_MomEvents.TryGetValue(momEventId, out replicationEvent2))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <int>((long)this.GetHashCode(), "LogEvent(): Attempting to add another eventId {0}, having logged it already.", momEventId);
                replicationEvent2.AddEvent(eventMessage);
                return;
            }
            ExTraceGlobals.HealthChecksTracer.TraceDebug <int>((long)this.GetHashCode(), "LogEvent(): Attempting to add eventId {0} for the first time.", momEventId);
            replicationEvent2 = new ReplicationEvent(replicationEventBaseInfo);
            replicationEvent2.AddEvent(eventMessage);
            this.m_MomEvents[momEventId] = replicationEvent2;
        }
Esempio n. 3
0
 public ReplicationEvent(ReplicationEventBaseInfo eventInfo)
 {
     this.m_EventInfo     = eventInfo;
     this.m_EventMessages = new List <string>();
 }