Ejemplo n.º 1
0
 private static TimeSpan PickLightJobs()
 {
     TestIntegration.Instance.Barrier("DontPickupJobs", null);
     CommonUtils.CatchKnownExceptions(delegate
     {
         DateTime utcNow = DateTime.UtcNow;
         if (utcNow > MRSService.nextLightJobsFullScanTime)
         {
             double num = CommonUtils.Randomize(ConfigBase <MRSConfigSchema> .GetConfig <TimeSpan>("FullScanLightJobsPollingPeriod").TotalSeconds, 0.2);
             MRSService.nextLightJobsFullScanTime = utcNow + TimeSpan.FromSeconds(num);
             MrsTracer.Service.Debug("Next light job full scan in {0} seconds, at {1}", new object[]
             {
                 (int)num,
                 MRSService.nextLightJobsFullScanTime
             });
             foreach (Guid mdbGuid in MapiUtils.GetDatabasesOnThisServer())
             {
                 MRSQueue.Get(mdbGuid).Tickle(MRSQueue.ScanType.Light);
             }
         }
         List <Guid> queuesToScan = MRSQueue.GetQueuesToScan(MRSQueue.ScanType.Light);
         if (queuesToScan != null)
         {
             foreach (Guid mdbGuid2 in queuesToScan)
             {
                 CommonUtils.CheckForServiceStopping();
                 MRSQueue.Get(mdbGuid2).PickupLightJobs();
             }
         }
     }, null);
     return(ConfigBase <MRSConfigSchema> .GetConfig <TimeSpan>("LightJobPickupPeriod"));
 }
Ejemplo n.º 2
0
        public static void Tickle(Guid mailboxGuid, Guid requestQueueMdbGuid, MoveRequestNotification operation)
        {
            MrsTracer.Service.Debug("Processing tickled mailbox: {0}, requestQueueMdbGuid: {1}, operation: {2}", new object[]
            {
                mailboxGuid,
                requestQueueMdbGuid,
                operation
            });
            if (MailboxSyncerJobs.ProcessJob(mailboxGuid, false, delegate(BaseJob job)
            {
                job.NeedToRefreshRequest = true;
            }))
            {
                return;
            }
            MRSQueue mrsqueue = MRSQueue.Get(requestQueueMdbGuid);

            switch (operation)
            {
            case MoveRequestNotification.Created:
            case MoveRequestNotification.Canceled:
                mrsqueue.Tickle(MRSQueue.ScanType.Heavy);
                return;

            case MoveRequestNotification.Updated:
            case MoveRequestNotification.SuspendResume:
                mrsqueue.Tickle(MRSQueue.ScanType.Light);
                mrsqueue.Tickle(MRSQueue.ScanType.Heavy);
                return;

            default:
                return;
            }
        }
Ejemplo n.º 3
0
 private static TimeSpan PickHeavyJobs()
 {
     TestIntegration.Instance.Barrier("DontPickupJobs", null);
     CommonUtils.CatchKnownExceptions(delegate
     {
         DateTime utcNow = DateTime.UtcNow;
         bool flag       = false;
         TimeSpan config = ConfigBase <MRSConfigSchema> .GetConfig <TimeSpan>("ADInconsistencyCleanUpPeriod");
         if (config != TimeSpan.Zero && MRSService.lastADCleanUpScanFinishTime != null)
         {
             DateTime t = utcNow;
             if (t >= MRSService.lastADCleanUpScanFinishTime + config)
             {
                 ThreadPool.QueueUserWorkItem(new WaitCallback(MRSService.CleanADOprhanAndInconsistency));
             }
         }
         ReservationManager.UpdateHealthState();
         if (utcNow >= MRSService.NextFullScanTime)
         {
             MailboxReplicationServicePerformanceCounters.LastScanTime.RawValue = CommonUtils.TimestampToPerfcounterLong(utcNow);
             MRSService.lastFullScanTime = utcNow;
             flag         = true;
             double value = CommonUtils.Randomize(ConfigBase <MRSConfigSchema> .GetConfig <TimeSpan>("FullScanMoveJobsPollingPeriod").TotalSeconds, 0.2);
             MRSService.NextFullScanTime = utcNow + TimeSpan.FromSeconds(value);
             MrsTracer.Service.Debug("Next full scan at {0}", new object[]
             {
                 MRSService.NextFullScanTime
             });
             foreach (Guid mdbGuid in MapiUtils.GetDatabasesOnThisServer())
             {
                 MRSQueue.Get(mdbGuid).Tickle(MRSQueue.ScanType.Heavy);
             }
         }
         int num = 0;
         List <Guid> queuesToScan = MRSQueue.GetQueuesToScan(MRSQueue.ScanType.Heavy);
         if (queuesToScan != null)
         {
             foreach (Guid mdbGuid2 in queuesToScan)
             {
                 CommonUtils.CheckForServiceStopping();
                 bool flag2;
                 MRSQueue.Get(mdbGuid2).PickupHeavyJobs(out flag2);
                 if (flag2)
                 {
                     num++;
                 }
             }
         }
         if (flag)
         {
             MRSService.lastFullScanDuration = (long)(DateTime.UtcNow - utcNow).TotalMilliseconds;
             MailboxReplicationServicePerformanceCounters.LastScanDuration.RawValue     = MRSService.lastFullScanDuration;
             MailboxReplicationServicePerformanceCounters.UnreachableDatabases.RawValue = (long)num;
         }
     }, null);
     return(ConfigBase <MRSConfigSchema> .GetConfig <TimeSpan>("HeavyJobPickupPeriod"));
 }
Ejemplo n.º 4
0
        public static LocalizedString GetJobPickupFailureMessageForRequest(Guid requestGuid)
        {
            LocalizedString result = LocalizedString.Empty;
            List <Guid>     list   = MRSQueue.GetQueues();

            if (!list.IsNullOrEmpty())
            {
                foreach (Guid mdbGuid in list)
                {
                    MRSQueue            mrsqueue        = MRSQueue.Get(mdbGuid);
                    List <JobPickupRec> lastScanResults = mrsqueue.LastScanResults;
                    if (!lastScanResults.IsNullOrEmpty())
                    {
                        JobPickupRec jobPickupRec = lastScanResults.Find((JobPickupRec x) => x.RequestGuid == requestGuid);
                        if (jobPickupRec != null)
                        {
                            result = jobPickupRec.GetPickupFailureMessage();
                            break;
                        }
                    }
                }
            }
            return(result);
        }