// Token: 0x06000547 RID: 1351 RVA: 0x00028860 File Offset: 0x00026A60 private void HandleFailure(ExpirationExecutor.Action retentionActionType, Folder sourceFolder, BaseFolderType targetFolder, Exception exception, int failureCount, ref List <Exception> allExceptionsSoFar) { Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ExpirationOfCurrentBatchFailed, null, new object[] { this.primaryMailboxSession.MailboxOwner, retentionActionType.ToString(), (sourceFolder == null) ? string.Empty : sourceFolder.DisplayName, (targetFolder == null) ? string.Empty : targetFolder.DisplayName, (sourceFolder == null) ? string.Empty : sourceFolder.Id.ObjectId.ToHexEntryId(), (targetFolder == null) ? string.Empty : targetFolder.FolderId.Id, (exception == null) ? string.Empty : exception.ToString() }); if (this.statisticsLogEntry != null) { this.statisticsLogEntry.NumberOfBatchesFailedToMoveInArchiveProcessor += 1L; } if (exception != null) { allExceptionsSoFar.Add(exception); } if (failureCount > MailboxData.MaxErrorsAllowed) { throw new TransientMailboxException(Strings.descELCEnforcerTooManyErrors(this.primaryMailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), MailboxData.MaxErrorsAllowed), new AggregateException(allExceptionsSoFar), null); } }
// Token: 0x06000527 RID: 1319 RVA: 0x0002701C File Offset: 0x0002521C private void MoveItemsInBatches(List <ItemData> listToSend, Folder sourceFolder, Folder targetFolder, ElcSubAssistant elcSubAssistant, ExpirationExecutor.Action retentionActionType, int totalFailuresSoFar, ref List <Exception> allExceptionsSoFar, out List <string> foldersWithErrors, out int newMoveErrorsTotal) { int count = listToSend.Count; int num = 0; int i = 0; long num2 = 0L; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; bool flag = false; Exception ex = null; ItemData[] sourceArray = listToSend.ToArray(); foldersWithErrors = new List <string>(); newMoveErrorsTotal = 0; try { while (i < count) { int num7 = (count - i >= 100) ? 100 : (count - i); List <ItemId> list; List <VersionedId> list2; bool flag2; int num8; Dictionary <ItemData.EnforcerType, int> dictionary; num2 += (long)this.CopyIdsToTmpArray(sourceArray, i, num7, this.MaxMessageSizeInArchive, out list, out list2, out flag2, out num8, out dictionary); num5 += num8; int count2 = list.Count; if (flag2) { foldersWithErrors.Add(sourceFolder.DisplayName); RemoteArchiveProcessor.Tracer.TraceDebug <RemoteArchiveProcessor, string>((long)this.GetHashCode(), "{0}: Added folder {1} to the list of bad folders to be event logged.", this, sourceFolder.DisplayName); } if (count2 > 0) { ex = null; flag = this.EwsDataProvider.MoveItems(list, targetFolder.Id, out ex); if (flag) { RemoteArchiveProcessor.Tracer.TraceDebug <RemoteArchiveProcessor, int>((long)this.GetHashCode(), "{0}: Moved to archive batch of {1} items.", this, count2); } } else { RemoteArchiveProcessor.Tracer.TraceDebug <RemoteArchiveProcessor>((long)this.GetHashCode(), "{0}: The tmpList was empty during this loop. Nothing to send, don't do anything.", this); } i += num7; num += count2; if (!flag) { RemoteArchiveProcessor.Tracer.TraceError((long)this.GetHashCode(), "{0}: An error occured when trying to expire a batch of {1} items. Expiration action is {2}. Result: {3}", new object[] { this, count2, retentionActionType.ToString(), ex }); Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ExpirationOfCurrentBatchFailed, null, new object[] { this.primaryMailboxSession.MailboxOwner, retentionActionType.ToString(), (sourceFolder == null) ? string.Empty : sourceFolder.DisplayName, (targetFolder == null) ? string.Empty : targetFolder.DisplayName, (sourceFolder == null) ? string.Empty : sourceFolder.Id.ObjectId.ToHexEntryId(), (targetFolder == null) ? string.Empty : targetFolder.Id.ToString(), (ex == null) ? string.Empty : ex.ToString() }); newMoveErrorsTotal++; num6++; if (ex != null) { allExceptionsSoFar.Add(ex); } if (totalFailuresSoFar + newMoveErrorsTotal > MailboxData.MaxErrorsAllowed) { throw new TransientMailboxException(Strings.descELCEnforcerTooManyErrors(this.primaryMailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), MailboxData.MaxErrorsAllowed), new AggregateException(allExceptionsSoFar), null); } } else { num3 += (dictionary.ContainsKey(ItemData.EnforcerType.DumpsterExpirationEnforcer) ? dictionary[ItemData.EnforcerType.DumpsterExpirationEnforcer] : 0); num4 += (dictionary.ContainsKey(ItemData.EnforcerType.ExpirationTagEnforcer) ? dictionary[ItemData.EnforcerType.ExpirationTagEnforcer] : 0); } } } finally { ELCPerfmon.TotalItemsExpired.IncrementBy((long)num); ELCPerfmon.TotalSizeItemsExpired.IncrementBy(num2); ELCPerfmon.TotalItemsMoved.IncrementBy((long)num); ELCPerfmon.TotalSizeItemsMoved.IncrementBy(num2); if (this.statisticsLogEntry != null) { this.statisticsLogEntry.NumberOfItemsActuallyArchivedByDumpsterExpirationEnforcer += (long)num3; this.statisticsLogEntry.NumberOfItemsActuallyArchivedByTag += (long)num4; this.statisticsLogEntry.NumberOfItemsSkippedDueToSizeRestrictionInArchiveProcessor += (long)num5; this.statisticsLogEntry.NumberOfBatchesFailedToMoveInArchiveProcessor += (long)num6; } } }
// Token: 0x06000391 RID: 913 RVA: 0x00019028 File Offset: 0x00017228 private void InternalExpireInBatches(List <ItemData> listToSend, ExpirationExecutor.Action retentionActionType, Folder sourcefolder, Folder targetFolder) { int count = listToSend.Count; int num = 0; int i = 0; int num2 = 0; long num3 = 0L; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; int num8 = 0; int num9 = 0; int num10 = 0; int num11 = 0; int num12 = 0; OperationResult operationResult = OperationResult.Succeeded; Exception ex = null; ItemData[] sourceArray = listToSend.ToArray(); int num13 = 0; int num14 = 0; try { while (i < count) { base.ElcAssistant.ThrottleStoreCallAndCheckForShutdown(base.MailboxData.MailboxSession.MailboxOwner); int num15 = (count - i >= 100) ? 100 : (count - i); switch (retentionActionType) { case ExpirationExecutor.Action.SoftDelete: case ExpirationExecutor.Action.PermanentlyDelete: { VersionedId[] array = new VersionedId[num15]; num3 += (long)base.CopyIdsToTmpArray(sourceArray, i, array, num15); num2 = num15; Dictionary <ItemData.EnforcerType, int> numberOfItemsProcessedByEachEnforcer = ItemData.GetNumberOfItemsProcessedByEachEnforcer(sourceArray, i, num15); AggregateOperationResult aggregateOperationResult; if (retentionActionType == ExpirationExecutor.Action.SoftDelete) { num8 = (numberOfItemsProcessedByEachEnforcer.ContainsKey(ItemData.EnforcerType.ExpirationTagEnforcer) ? numberOfItemsProcessedByEachEnforcer[ItemData.EnforcerType.ExpirationTagEnforcer] : 0); aggregateOperationResult = base.MailboxData.MailboxSession.Delete(DeleteItemFlags.SoftDelete | DeleteItemFlags.SuppressReadReceipt, array); } else { num11 = (numberOfItemsProcessedByEachEnforcer.ContainsKey(ItemData.EnforcerType.DiscoveryHoldEnforcer) ? numberOfItemsProcessedByEachEnforcer[ItemData.EnforcerType.DiscoveryHoldEnforcer] : 0); num9 = (numberOfItemsProcessedByEachEnforcer.ContainsKey(ItemData.EnforcerType.DumpsterExpirationEnforcer) ? numberOfItemsProcessedByEachEnforcer[ItemData.EnforcerType.DumpsterExpirationEnforcer] : 0); num10 = (numberOfItemsProcessedByEachEnforcer.ContainsKey(ItemData.EnforcerType.DumpsterQuotaEnforcer) ? numberOfItemsProcessedByEachEnforcer[ItemData.EnforcerType.DumpsterQuotaEnforcer] : 0); num8 = (numberOfItemsProcessedByEachEnforcer.ContainsKey(ItemData.EnforcerType.ExpirationTagEnforcer) ? numberOfItemsProcessedByEachEnforcer[ItemData.EnforcerType.ExpirationTagEnforcer] : 0); aggregateOperationResult = base.MailboxData.MailboxSession.Delete(DeleteItemFlags.HardDelete | DeleteItemFlags.SuppressReadReceipt, array); } operationResult = aggregateOperationResult.OperationResult; ex = ElcExceptionHelper.ExtractExceptionsFromAggregateOperationResult(aggregateOperationResult); break; } case ExpirationExecutor.Action.MoveToDiscoveryHolds: case ExpirationExecutor.Action.MoveToMigratedMessages: case ExpirationExecutor.Action.MoveToPurges: { VersionedId[] array2 = new VersionedId[num15]; num3 += (long)base.CopyIdsToTmpArray(sourceArray, i, array2, num15); num2 = num15; Dictionary <ItemData.EnforcerType, int> numberOfItemsProcessedByEachEnforcer2 = ItemData.GetNumberOfItemsProcessedByEachEnforcer(sourceArray, i, num15); if (num2 > 0) { if (sourcefolder != null) { StoreObjectId destinationFolderId; if (ExpirationExecutor.Action.MoveToPurges == retentionActionType) { num13 = (numberOfItemsProcessedByEachEnforcer2.ContainsKey(ItemData.EnforcerType.DumpsterExpirationEnforcer) ? numberOfItemsProcessedByEachEnforcer2[ItemData.EnforcerType.DumpsterExpirationEnforcer] : 0); destinationFolderId = base.MailboxData.MailboxSession.GetDefaultFolderId(DefaultFolderType.RecoverableItemsPurges); } else if (ExpirationExecutor.Action.MoveToDiscoveryHolds == retentionActionType) { num9 = (numberOfItemsProcessedByEachEnforcer2.ContainsKey(ItemData.EnforcerType.DumpsterExpirationEnforcer) ? numberOfItemsProcessedByEachEnforcer2[ItemData.EnforcerType.DumpsterExpirationEnforcer] : 0); num10 = (numberOfItemsProcessedByEachEnforcer2.ContainsKey(ItemData.EnforcerType.DumpsterQuotaEnforcer) ? numberOfItemsProcessedByEachEnforcer2[ItemData.EnforcerType.DumpsterQuotaEnforcer] : 0); destinationFolderId = base.MailboxData.MailboxSession.CowSession.CheckAndCreateDiscoveryHoldsFolder(base.MailboxData.MailboxSession); } else { destinationFolderId = base.MailboxData.MailboxSession.CowSession.CheckAndCreateMigratedMessagesFolder(); } if (this.IsMoveClearNrnFlightingEnabled()) { sourcefolder.ClearNotReadNotificationPending(array2); } GroupOperationResult groupOperationResult = sourcefolder.MoveItems(destinationFolderId, array2); if (groupOperationResult.OperationResult == OperationResult.Succeeded) { TagExpirationExecutor.Tracer.TraceDebug <TagExpirationExecutor, string, int>((long)this.GetHashCode(), "{0}: Moved to {1} batch of {2} items.", this, retentionActionType.ToString(), num2); } else { operationResult = groupOperationResult.OperationResult; ex = groupOperationResult.Exception; } } } else { TagExpirationExecutor.Tracer.TraceDebug <TagExpirationExecutor>((long)this.GetHashCode(), "{0}: The tmpList was empty during this loop. Nothing to send, don't do anything.", this); } break; } } i += num15; num += num2; if (operationResult == OperationResult.Failed || operationResult == OperationResult.PartiallySucceeded) { TagExpirationExecutor.Tracer.TraceError((long)this.GetHashCode(), "{0}: An error occured when trying to expire a batch of {1} items. Expiration action is {2}. Result: {3}", new object[] { this, num2, retentionActionType, operationResult }); Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ExpirationOfCurrentBatchFailed, null, new object[] { base.MailboxData.MailboxSession.MailboxOwner, retentionActionType.ToString(), (sourcefolder == null) ? string.Empty : sourcefolder.DisplayName, (targetFolder == null) ? string.Empty : targetFolder.DisplayName, (sourcefolder == null) ? string.Empty : sourcefolder.Id.ObjectId.ToHexEntryId(), (targetFolder == null) ? string.Empty : targetFolder.Id.ObjectId.ToHexEntryId(), (ex == null) ? string.Empty : ex.ToString() }); num12++; base.MailboxData.ThrowIfErrorsOverLimit(ex); } else { num7 += num11; num5 += num9; num6 += num10; num4 += num8; num14 += num13; } } } finally { ELCPerfmon.TotalItemsExpired.IncrementBy((long)num); ELCPerfmon.TotalSizeItemsExpired.IncrementBy(num3); switch (retentionActionType) { case ExpirationExecutor.Action.SoftDelete: ELCPerfmon.TotalItemsSoftDeleted.IncrementBy((long)num); ELCPerfmon.TotalSizeItemsSoftDeleted.IncrementBy(num3); break; case ExpirationExecutor.Action.PermanentlyDelete: ELCPerfmon.TotalItemsPermanentlyDeleted.IncrementBy((long)num); ELCPerfmon.TotalSizeItemsPermanentlyDeleted.IncrementBy(num3); break; case ExpirationExecutor.Action.MoveToDiscoveryHolds: ELCPerfmon.TotalItemsMovedToDiscoveryHolds.IncrementBy((long)num); ELCPerfmon.TotalSizeItemsMovedToDiscoveryHolds.IncrementBy(num3); break; } base.MailboxData.StatisticsLogEntry.NumberOfItemsActuallyDeletedByDiscoveryHoldEnforcer += (long)num7; base.MailboxData.StatisticsLogEntry.NumberOfItemsActuallyDeletedByDumpsterExpirationEnforcer += (long)num5; base.MailboxData.StatisticsLogEntry.NumberOfItemsActuallyDeletedByDumpsterQuotaEnforcer += (long)num6; base.MailboxData.StatisticsLogEntry.NumberOfItemsActuallyDeletedByTag += (long)num4; base.MailboxData.StatisticsLogEntry.NumberOfBatchesFailedToExpireInExpirationExecutor += (long)num12; base.MailboxData.StatisticsLogEntry.NumberOfItemsActuallyMovedToPurgesByDumpsterExpirationEnforcer += (long)num14; } }
// Token: 0x0600050E RID: 1294 RVA: 0x00026080 File Offset: 0x00024280 private void ExpireInBatches(List <ItemData> listToSend, Folder sourceFolder, Folder targetFolder, ElcSubAssistant elcSubAssistant, ExpirationExecutor.Action retentionActionType, int totalFailuresSoFar, ref List <Exception> allExceptionsSoFar, out List <string> foldersWithErrors, out int newMoveErrorsTotal) { int count = listToSend.Count; int num = 0; int i = 0; int num2 = 0; int num3 = 0; long num4 = 0L; int num5 = 0; int num6 = 0; int num7 = 0; int num8 = 0; OperationResult operationResult = OperationResult.Succeeded; Exception ex = null; ItemData[] sourceArray = listToSend.ToArray(); foldersWithErrors = new List <string>(); newMoveErrorsTotal = 0; try { while (i < count) { elcSubAssistant.ThrottleStoreCallAndCheckForShutdown(this.archiveMailboxSession.MailboxOwner, ELCHealthMonitor.GetArchiveResourceHealthMonitorKeys(this.archiveMailboxSession, this.primaryMailboxSession)); num2 = ((count - i >= 100) ? 100 : (count - i)); List <VersionedId> list; bool flag; int num9; Dictionary <ItemData.EnforcerType, int> dictionary; num4 += (long)LocalArchiveProcessor.CopyIdsToTmpArray(sourceArray, i, num2, this.MaxMessageSizeInArchive, out list, out flag, out num9, out dictionary); num7 += num9; num3 = list.Count; if (flag) { foldersWithErrors.Add(sourceFolder.DisplayName); LocalArchiveProcessor.Tracer.TraceDebug <LocalArchiveProcessor, string>((long)this.GetHashCode(), "{0}: Added folder {1} to the list of bad folders to be event logged.", this, sourceFolder.DisplayName); } if (num3 > 0) { GroupOperationResult groupOperationResult = sourceFolder.CopyItems(this.archiveMailboxSession, targetFolder.Id, list.ToArray()); if (groupOperationResult.OperationResult == OperationResult.Succeeded) { LocalArchiveProcessor.Tracer.TraceDebug <LocalArchiveProcessor, int>((long)this.GetHashCode(), "{0}: Copied to archive batch of {1} items. Will proceed to hard delete the batch.", this, num3); try { this.primaryMailboxSession.COWSettings.TemporaryDisableHold = true; AggregateOperationResult aggregateOperationResult = this.primaryMailboxSession.Delete(DeleteItemFlags.HardDelete | DeleteItemFlags.SuppressReadReceipt, list.ToArray()); operationResult = aggregateOperationResult.OperationResult; ex = ElcExceptionHelper.ExtractExceptionsFromAggregateOperationResult(aggregateOperationResult); goto IL_18E; } finally { this.primaryMailboxSession.COWSettings.TemporaryDisableHold = false; } } operationResult = groupOperationResult.OperationResult; ex = groupOperationResult.Exception; } else { LocalArchiveProcessor.Tracer.TraceDebug <LocalArchiveProcessor>((long)this.GetHashCode(), "{0}: The tmpList was empty during this loop. Nothing to send, don't do anything.", this); } IL_18E: i += num2; num += num3; if (operationResult == OperationResult.Failed || operationResult == OperationResult.PartiallySucceeded) { LocalArchiveProcessor.Tracer.TraceError((long)this.GetHashCode(), "{0}: An error occured when trying to expire a batch of {1} items. Expiration action is {2}. Result: {3}", new object[] { this, num3, retentionActionType.ToString(), operationResult }); Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ExpirationOfCurrentBatchFailed, null, new object[] { this.primaryMailboxSession.MailboxOwner, retentionActionType.ToString(), (sourceFolder == null) ? string.Empty : sourceFolder.DisplayName, (targetFolder == null) ? string.Empty : targetFolder.DisplayName, (sourceFolder == null) ? string.Empty : sourceFolder.Id.ObjectId.ToHexEntryId(), (targetFolder == null) ? string.Empty : targetFolder.Id.ObjectId.ToHexEntryId(), (ex == null) ? string.Empty : ex.ToString() }); newMoveErrorsTotal++; num8++; if (ex != null) { allExceptionsSoFar.Add(ex); } if (totalFailuresSoFar + newMoveErrorsTotal > MailboxData.MaxErrorsAllowed) { throw new TransientMailboxException(Strings.descELCEnforcerTooManyErrors(this.primaryMailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), MailboxData.MaxErrorsAllowed), new AggregateException(allExceptionsSoFar), null); } } else { num5 += (dictionary.ContainsKey(ItemData.EnforcerType.DumpsterExpirationEnforcer) ? dictionary[ItemData.EnforcerType.DumpsterExpirationEnforcer] : 0); num6 += (dictionary.ContainsKey(ItemData.EnforcerType.ExpirationTagEnforcer) ? dictionary[ItemData.EnforcerType.ExpirationTagEnforcer] : 0); } } } finally { ELCPerfmon.TotalItemsExpired.IncrementBy((long)num); ELCPerfmon.TotalSizeItemsExpired.IncrementBy(num4); ELCPerfmon.TotalItemsMoved.IncrementBy((long)num); ELCPerfmon.TotalSizeItemsMoved.IncrementBy(num4); if (this.statisticsLogEntry != null) { this.statisticsLogEntry.NumberOfItemsActuallyArchivedByDumpsterExpirationEnforcer += (long)num5; this.statisticsLogEntry.NumberOfItemsActuallyArchivedByTag += (long)num6; this.statisticsLogEntry.NumberOfItemsSkippedDueToSizeRestrictionInArchiveProcessor += (long)num7; this.statisticsLogEntry.NumberOfBatchesFailedToMoveInArchiveProcessor += (long)num8; } } }