private static void CallXsoAndMapExceptions(IDiagnosticsSession tracer, Guid mailboxGuid, MdbDocumentAdapter.CallXso xsoCall) { try { xsoCall(); } catch (ConnectionFailedTransientException ex) { tracer.TraceError <Guid, ConnectionFailedTransientException>("Failed to connect to mailbox {0}, exception: {1}", mailboxGuid, ex); throw new ComponentFailedTransientException(Strings.ConnectionToMailboxFailed(mailboxGuid), ex); } catch (ConnectionFailedPermanentException ex2) { tracer.TraceError <Guid, ConnectionFailedPermanentException>("Failed to connect to mailbox {0}, exception: {1}", mailboxGuid, ex2); throw new ComponentFailedPermanentException(Strings.ConnectionToMailboxFailed(mailboxGuid), ex2); } catch (ObjectNotFoundException ex3) { tracer.TraceDebug <Guid, ObjectNotFoundException>("Got exception from XSO (MDB: {0}): {1}", mailboxGuid, ex3); throw new DocumentFailureException(ex3); } catch (CorruptDataException ex4) { tracer.TraceDebug <Guid, CorruptDataException>("Got exception from XSO (MDB: {0}): {1}", mailboxGuid, ex4); throw new DocumentFailureException(ex4); } catch (PropertyErrorException ex5) { tracer.TraceDebug <Guid, PropertyErrorException>("Got exception from XSO (MDB: {0}): {1}", mailboxGuid, ex5); throw new DocumentFailureException(ex5); } catch (MailboxUnavailableException ex6) { tracer.TraceDebug <Guid, MailboxUnavailableException>("Got exception from XSO (MDB: {0}): {1}", mailboxGuid, ex6); throw new DocumentFailureException(ex6); } catch (StoragePermanentException innerException) { throw new ComponentFailedPermanentException(innerException); } catch (StorageTransientException innerException2) { throw new ComponentFailedTransientException(innerException2); } }
// Token: 0x060014A4 RID: 5284 RVA: 0x00076AF0 File Offset: 0x00074CF0 internal void ProcessMailbox(MailboxSession session, IDiagnosticsSession diagnosticsSession, bool isRecipientInfoBasedRelevanceEnabled = false) { Util.ThrowOnNullArgument(session, "session"); Util.ThrowOnNullArgument(diagnosticsSession, "diagnosticsSession"); PeopleRelevanceFeeder.Tracer.TraceDebug <Guid>((long)this.GetHashCode(), "Processing Mailbox {0}", session.MailboxGuid); if (string.IsNullOrEmpty(session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString())) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Skipping mailbox {0} because owner's primary SMTP address is blank.", new object[] { session }); return; } try { try { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); PeopleModelItem modelData = MdbPeopleModelDataBinderFactory.Current.CreateInstance(session).GetModelData(); PeopleRelevanceFeeder.Tracer.TraceDebug <bool, Version, DateTime>((long)this.GetHashCode(), "Got people inference model item. Default Model = {0} Version = {1} LastModifiedTime = {2} ", modelData.IsDefaultModel, modelData.Version, modelData.LastModifiedTime); IDocument document = null; IEnumerable <IRecipientInfo> enumerable = null; int num = 0; int num2 = 0; int num3; if (isRecipientInfoBasedRelevanceEnabled) { PeopleRelevanceFeeder.Tracer.TraceDebug((long)this.GetHashCode(), "Querying recipients' usage metrics"); enumerable = this.recipientInfoGenerator.RunTrainingQuery(session); num3 = enumerable.Count <IRecipientInfo>(); } else { PeopleRelevanceFeeder.Tracer.TraceDebug((long)this.GetHashCode(), "Running the training query from SentItems"); document = this.sentItemsGenerator.RunTrainingQuery(session, modelData); num3 = document.NestedDocuments.Count; } if (num3 > 0) { IDocument document2 = PeopleRelevanceDocumentFactory.Current.CreatePeopleRelevanceDocument(modelData, document, session.MailboxGuid, session.MailboxOwner.Alias); ExAssert.RetailAssert(document2 != null, "People Relevance document is null"); if (isRecipientInfoBasedRelevanceEnabled) { document2.SetProperty(PeopleRelevanceSchema.RecipientInfoEnumerable, enumerable); } document2.SetProperty(PeopleRelevanceSchema.IsBasedOnRecipientInfoData, isRecipientInfoBasedRelevanceEnabled); document2.SetProperty(PeopleRelevanceSchema.MailboxOwner, new MdbRecipient(session.MailboxOwner, session.PreferedCulture)); PeopleRelevanceFeeder.Tracer.TraceDebug <IIdentity>((long)this.GetHashCode(), "Created a people relevance document Identity - {0}", document2.Identity); this.peopleRelevanceProcessingPipeline.ProcessDocument(document2, new DocumentProcessingContext(session)); stopwatch.Stop(); if (isRecipientInfoBasedRelevanceEnabled) { object obj; if (document2.TryGetProperty(PeopleRelevanceSchema.ContactList, out obj)) { num = (obj as IDictionary <string, IInferenceRecipient>).Count <KeyValuePair <string, IInferenceRecipient> >(); } } else { num = document.NestedDocuments.Count; } num2 = num3 - num; Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ProcessingStatisticsForPeopleRelevanceFeeder, null, new object[] { session.MailboxOwner.LegacyDn, num3, num, num2, stopwatch.Elapsed.TotalMilliseconds }); } else { stopwatch.Stop(); } PeopleRelevanceFeeder.Tracer.TraceDebug((long)this.GetHashCode(), "The people and time feeder for mailbox {0} picked {1} {2} to process. Number of {2} successfully processed {3} and number of items failed to be processed {4}. Total time taken to process this mailbox {5}.", new object[] { session.MailboxOwner.LegacyDn, num3, isRecipientInfoBasedRelevanceEnabled ? "usage metrics" : "sent items", num, num2, stopwatch.Elapsed.TotalMilliseconds }); } catch (MessageSubmissionExceededException ex) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to save model because it's too large. Exception: {0}", new object[] { ex }); } catch (QuotaExceededException ex2) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to reset model or to run training query because mailbox is full. Exception: {0}", new object[] { ex2 }); } catch (NestedDocumentCountZeroException ex3) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Failures, "Failed to process training document because it's corrupt. Nested document count is ZERO. Exception: {0}", new object[] { ex3 }); throw; } catch (ObjectNotFoundException ex4) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Failures, "Failed to validate recipient cache. Exception: {0}", new object[] { ex4 }); } catch (StorageTransientException ex5) { if (!(ex5.InnerException is MapiExceptionTimeout)) { if (ex5.InnerException is MapiExceptionNetworkError) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to read model because of network error.", new object[0]); } throw; } diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to read model because of I/O timeout. Exception: {0}", new object[] { ex5 }); } catch (StoragePermanentException ex6) { if (ex6.InnerException is MapiExceptionDatabaseError) { diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to read model because of database-level error. Exception: {0}", new object[] { ex6 }); throw; } if (!(ex6.InnerException is MapiExceptionMaxObjsExceeded)) { throw; } diagnosticsSession.LogDiagnosticsInfo(DiagnosticsLoggingTag.Warnings, "Failed to reset model because cannot create user configuration message. Exception: {0}", new object[] { ex6 }); } } catch (ComponentException ex7) { if (ex7.InnerException == null) { throw; } if (ex7.InnerException is ObjectNotFoundException) { diagnosticsSession.TraceError <ComponentException>("Received ObjectNotFoundException from the main pipeline. Exception: {0} ", ex7); } else if (ex7.InnerException is CorruptDataException) { diagnosticsSession.TraceError <ComponentException>("Received CorruptDataException from the main pipeline. Exception: {0}", ex7); } else { if (typeof(StoragePermanentException).IsAssignableFrom(ex7.InnerException.GetType()) || typeof(StorageTransientException).IsAssignableFrom(ex7.InnerException.GetType()) || typeof(DataSourceTransientException).IsAssignableFrom(ex7.InnerException.GetType())) { diagnosticsSession.TraceError <Exception>("Received storage or data source exception from the main pipeline. Exception: {0}", ex7.InnerException); throw ex7.InnerException; } throw; } } }
private static void TraceAndThrowPermanentException(IDiagnosticsSession tracer, LocalizedString errorString, LocalizedException ex) { tracer.TraceError <LocalizedString, LocalizedException>("Error: {0}, exception: {1}", errorString, ex); throw new ComponentFailedPermanentException(errorString, ex); }
internal static UserConfiguration ResetModel(string userConfigurationName, UserConfigurationTypes userConfigType, MailboxSession session, bool deleteOld, IDiagnosticsSession diagnosticSession) { StoreId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.Inbox); OperationResult operationResult = OperationResult.Succeeded; Exception ex = null; if (deleteOld) { try { operationResult = session.UserConfigurationManager.DeleteFolderConfigurations(defaultFolderId, new string[] { userConfigurationName }); } catch (ObjectNotFoundException ex2) { ex = ex2; if (diagnosticSession != null) { diagnosticSession.TraceDebug <string, ObjectNotFoundException>("FAI message '{0}' is missing. Exception: {1}", userConfigurationName, ex2); } } if (operationResult != OperationResult.Succeeded && ex == null) { if (diagnosticSession != null) { diagnosticSession.TraceError(string.Format("Deletion of user configuration (userConfiguration Name = {0}) failed. OperationResult = {1}. ObjectNotFoundException = {2}", userConfigurationName, operationResult.ToString(), ex), new object[0]); } throw new DeleteItemsException(string.Format("Deletion of user configuration (userConfiguration Name = {0}) failed. OperationResult = {1}. ObjectNotFoundException = {2}", userConfigurationName, operationResult.ToString(), ex)); } } UserConfiguration userConfiguration = null; try { userConfiguration = session.UserConfigurationManager.CreateFolderConfiguration(userConfigurationName, userConfigType, defaultFolderId); userConfiguration.Save(); } catch (Exception ex3) { if (diagnosticSession != null && !(ex3 is QuotaExceededException)) { if (ex3 is StoragePermanentException) { diagnosticSession.SendInformationalWatsonReport(ex3, string.Format("Creation of user configuration failed (userConfiguration Name = {0}) deleteOld flag was {1}. Result of deletion of user configuration OperationResult = {2}. ObjectNotFoundException = {3}", new object[] { userConfigurationName, deleteOld, deleteOld ? operationResult.ToString() : "Not Applicable", ex })); } else { diagnosticSession.TraceError("Creation of user configuration failed (userConfiguration Name = {0}) deleteOld flag was {1}. Result of deletion of user configuration OperationResult = {2}. ObjectNotFoundException = {3}. Exception = {4}", new object[] { userConfigurationName, deleteOld, deleteOld ? operationResult.ToString() : "Not Applicable", ex, ex3.ToString() }); } } if (userConfiguration != null) { userConfiguration.Dispose(); } throw; } return(userConfiguration); }