internal MRSRequestWrapper(IConfigurationSession session, MRSRequestType type, string commonName) { base.RequestType = type; ADObjectId relativeContainerId = ADHandler.GetRelativeContainerId(type); base.SetId(session, relativeContainerId, commonName); }
internal static ADObjectId GetRootId(IConfigurationSession configSession, MRSRequestType type) { if (!configSession.SessionSettings.IsTenantScoped && CommonUtils.IsMultiTenantEnabled()) { return(null); } ADObjectId descendantId = configSession.GetOrgContainerId().GetDescendantId(ADHandler.RelativeMRSContainer); return(descendantId.GetDescendantId(ADHandler.GetRelativeContainerId(type))); }
public override MRSRequestWrapper CreateRequestIndexEntryFromRequestJob(RequestJobBase requestJob, IConfigurationSession session) { return(new MRSRequestWrapper(session, requestJob.RequestType, ADHandler.GenerateCommonName(requestJob.Name, requestJob.SourceAlias, requestJob.TargetAlias)) { Name = requestJob.Name, RequestGuid = requestJob.RequestGuid, Status = requestJob.Status, Flags = requestJob.Flags, RemoteHostName = requestJob.RemoteHostName, BatchName = requestJob.BatchName, SourceMDB = requestJob.SourceDatabase, TargetMDB = requestJob.TargetDatabase, StorageMDB = requestJob.WorkItemQueueMdb, FilePath = requestJob.FilePath, TargetUserId = requestJob.TargetUserId, SourceUserId = requestJob.SourceUserId, OrganizationId = requestJob.OrganizationId }); }
internal static MRSRequestWrapper Read(IConfigurationSession configSession, Guid requestGuid, MRSRequestType type) { QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, MRSRequestSchema.MailboxMoveRequestGuid, requestGuid); ADObjectId rootId = ADHandler.GetRootId(configSession, type); IEnumerable <MRSRequestWrapper> enumerable = configSession.FindPaged <MRSRequestWrapper>(filter, rootId, !configSession.SessionSettings.IsTenantScoped, null, 2); MRSRequestWrapper result = null; using (IEnumerator <MRSRequestWrapper> enumerator = enumerable.GetEnumerator()) { if (enumerator.MoveNext()) { result = enumerator.Current; if (enumerator.MoveNext()) { throw new RequestGuidNotUniquePermanentException(requestGuid.ToString(), type.ToString()); } } } return(result); }
internal static MRSRequestWrapper[] Find(IConfigurationSession configSession, QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy) { QueryFilter filter2 = ADHandler.ConvertFilter(filter); return((MRSRequestWrapper[])configSession.Find <MRSRequestWrapper>(filter2, rootId, deepSearch, sortBy)); }
public override void Save(RequestIndexEntryProvider requestIndexEntryProvider, MRSRequestWrapper instance) { ADHandler.Save(requestIndexEntryProvider.ConfigSession, instance); }
public override MRSRequestWrapper Read(RequestIndexEntryProvider requestIndexEntryProvider, RequestIndexEntryObjectId identity) { return(ADHandler.Read(requestIndexEntryProvider.ConfigSession, identity.RequestGuid, identity.RequestType)); }
public override IEnumerable <MRSRequestWrapper> FindPaged(RequestIndexEntryProvider requestIndexEntryProvider, QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize) { QueryFilter filter2 = ADHandler.ConvertFilter(filter); return(requestIndexEntryProvider.ConfigSession.FindPaged <MRSRequestWrapper>(filter2, rootId, deepSearch, sortBy, pageSize)); }
public override MRSRequestWrapper[] Find(RequestIndexEntryProvider requestIndexEntryProvider, QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy) { return(ADHandler.Find(requestIndexEntryProvider.ConfigSession, filter, rootId, deepSearch, sortBy)); }
private static void CleanADOrphanAndInconsistencyForNonMoves(IConfigurationSession configSession, MRSRequestType requestType, RequestJobProvider rjProvider, Guid dbGuid) { ADObjectId requestQueueId = new ADObjectId(dbGuid); RequestIndexEntryQueryFilter requestIndexEntryQueryFilter = new RequestIndexEntryQueryFilter(); requestIndexEntryQueryFilter.IndexId = new RequestIndexId(RequestIndexLocation.AD); requestIndexEntryQueryFilter.RequestType = requestType; requestIndexEntryQueryFilter.RequestQueueId = requestQueueId; MRSRequestWrapper[] array = ADHandler.Find(configSession, requestIndexEntryQueryFilter, null, true, null); if (array != null && array.Length > 0) { bool needUpdateAD = false; MRSRequestWrapper[] array2 = array; for (int i = 0; i < array2.Length; i++) { MRSRequestWrapper request = array2[i]; CommonUtils.CatchKnownExceptions(delegate { needUpdateAD = false; if (request.Status != RequestStatus.None) { RequestStatisticsBase requestStatisticsBase = (RequestStatisticsBase)rjProvider.Read <RequestStatisticsBase>(new RequestJobObjectId(request.RequestGuid, dbGuid, null)); if (requestStatisticsBase == null || (!requestStatisticsBase.IsFake && requestStatisticsBase.Status == RequestStatus.None)) { MrsTracer.Service.Debug("CleanADOrphanAndInconsistencyForRequests():AD orphan {0} found for DB {1}", new object[] { request.RequestGuid, dbGuid }); ADHandler.Delete(configSession, request); return; } if (requestStatisticsBase.IsFake) { MrsTracer.Service.Debug("CleanADOrphanAndInconsistencyForRequests():request {0} is uplevel/Fake, ignoring it", new object[] { request.RequestGuid }); return; } if (requestStatisticsBase.IndexEntries == null || requestStatisticsBase.IndexEntries.Count == 0) { MrsTracer.Service.Debug("CleanADOrphanAndInconsistencyForRequests():request {0} has been removed from AD, ignoring it", new object[] { request.RequestGuid }); return; } if (requestStatisticsBase.TimeTracker.GetCurrentDurationChunk() > ADInconsistencyCheck.updateLatencyThreshhold) { if (requestStatisticsBase.Status != requestStatisticsBase.IndexEntries[0].Status) { MrsTracer.Service.Debug("CleanADOrphanAndInconsistencyForRequests():AD inconsistency {0} found for DB {1}, AD status is {2} but store status is {3}", new object[] { request.RequestGuid, dbGuid, request.Status, requestStatisticsBase.Status }); request.Status = requestStatisticsBase.Status; needUpdateAD = true; } if (requestStatisticsBase.Flags != requestStatisticsBase.IndexEntries[0].Flags) { MrsTracer.Service.Debug("CleanADOrphanAndInconsistencyForRequests():AD inconsistency {0} found for DB {1}, AD flags is {2} but store flags is {3}", new object[] { request.RequestGuid, dbGuid, request.Flags, requestStatisticsBase.Flags }); request.Flags = requestStatisticsBase.Flags; needUpdateAD = true; } if (needUpdateAD) { ADHandler.Save(configSession, request); return; } } } else { MrsTracer.Service.Debug("CleanADOrphanAndInconsistencyForRequests():request {0} for {1} has been removed from AD, store orphan will be handled by MRS pick up job logic", new object[] { request.RequestGuid, dbGuid }); } }, delegate(Exception f) { MrsTracer.Service.Error("CleanADOrphanAndInconsistencyForRequests() failed for DB {0}. Request type {1} Request guid {2} Error: {3}", new object[] { dbGuid, requestType.ToString(), request.RequestGuid, CommonUtils.FullExceptionMessage(f, true) }); MRSService.LogEvent(MRSEventLogConstants.Tuple_ScanADInconsistencyRequestFailEvent, new object[] { dbGuid, requestType.ToString(), request.RequestGuid, CommonUtils.FullExceptionMessage(f, true) }); }); } return; } MrsTracer.Service.Debug("CleanADOrphanAndInconsistencyForRequests(): No {0} requests found for DB {1}", new object[] { requestType, dbGuid }); }