Ejemplo n.º 1
0
 protected void CompleteMerge()
 {
     base.TestIntegration.Barrier("PostponeResumeAccessToMailbox", new Action(base.RefreshRequestIfNeeded));
     base.ReportProgress(true);
     base.TimeTracker.SetTimestamp(RequestJobTimestamp.InitialSeedingCompleted, new DateTime?(DateTime.UtcNow));
     base.SyncStage                = SyncStage.SyncFinished;
     base.OverallProgress          = 100;
     base.TimeTracker.CurrentState = RequestState.Completed;
     CommonUtils.CatchKnownExceptions(delegate
     {
         this.MailboxMerger.ClearSyncState(SyncStateClearReason.MergeComplete);
     }, null);
     CommonUtils.CatchKnownExceptions(delegate
     {
         base.Report.Append(MrsStrings.ReportRequestCompleted);
         MoveHistoryEntryInternal moveHistoryEntryInternal;
         base.CompleteRequest(this.MailboxMerger.IsOlcSync, out moveHistoryEntryInternal);
         RequestJobLog.Write(base.CachedRequestJob, RequestState.InitialSeedingComplete);
     }, delegate(Exception failure)
     {
         LocalizedString localizedString = CommonUtils.FullExceptionMessage(failure);
         MailboxReplicationService.LogEvent(MRSEventLogConstants.Tuple_FailedToUpdateCompletedRequest, new object[]
         {
             base.RequestJobIdentity,
             base.GetRequestKeyGuid().ToString(),
             base.RequestJobStoringMDB.ToString(),
             localizedString
         });
     });
 }
Ejemplo n.º 2
0
 protected override void FinalizeMerge()
 {
     base.CheckBadItemCount(true);
     base.ReportProgress(true);
     base.SyncStage       = SyncStage.IncrementalSync;
     base.OverallProgress = this.CopyEndPercentage;
     base.TimeTracker.SetTimestamp(RequestJobTimestamp.InitialSeedingCompleted, new DateTime?(DateTime.UtcNow));
     RequestJobLog.Write(base.CachedRequestJob, RequestState.InitialSeedingComplete);
     base.ScheduleWorkItem <bool>(new Action <bool>(this.IncrementalSync), true, WorkloadType.Unknown);
 }
Ejemplo n.º 3
0
        protected override RequestState RelinquishAction(TransactionalRequestJob requestJob, ReportData report)
        {
            FailureRec failureRec = QuarantinedJobs.Get(base.RequestGuid);

            if (failureRec == null)
            {
                return(RequestState.Relinquished);
            }
            report.Append(MrsStrings.JobIsQuarantined, failureRec, ReportEntryFlags.Fatal);
            requestJob.Suspend = true;
            requestJob.Status  = RequestStatus.Failed;
            requestJob.TimeTracker.SetTimestamp(RequestJobTimestamp.Failure, new DateTime?(DateTime.UtcNow));
            QuarantinedJobs.Remove(base.RequestGuid);
            RequestJobLog.Write(requestJob);
            return(RequestState.Failed);
        }
Ejemplo n.º 4
0
        protected override void MakeConnections()
        {
            Exception sourceConnectFailure = null;
            Exception targetConnectFailure = null;
            int       sourceVersion        = 0;
            int       targetVersion        = 0;
            string    sourceServerName     = null;
            string    targetServerName     = null;

            CommonUtils.CatchKnownExceptions(delegate
            {
                MrsTracer.Service.Debug("Attempting to connect to the destination mailbox {0}.", new object[]
                {
                    this.MailboxMerger.TargetTracingID
                });
                this.MailboxMerger.ConnectDestinationMailbox(MailboxConnectFlags.None);
            }, delegate(Exception failure)
            {
                MrsTracer.Service.Warning("Failed to connect to destination mailbox: {0}", new object[]
                {
                    CommonUtils.FullExceptionMessage(failure)
                });
                targetConnectFailure = failure;
            });
            if (targetConnectFailure == null)
            {
                MailboxServerInformation mailboxServerInformation = this.MailboxMerger.DestMailbox.GetMailboxServerInformation();
                MailboxInformation       mailboxInformation       = this.MailboxMerger.DestMailbox.GetMailboxInformation();
                this.MailboxMerger.TargetServerInfo = mailboxServerInformation;
                if (mailboxServerInformation != null)
                {
                    ConnectivityRec connectivityRec = new ConnectivityRec(ServerKind.Target, mailboxInformation, mailboxServerInformation);
                    base.Report.Append(MrsStrings.ReportDestinationMailboxConnection(this.MailboxMerger.TargetTracingID, mailboxServerInformation.ServerInfoString, (mailboxInformation != null) ? mailboxInformation.MdbName : "(null)"), connectivityRec);
                    targetServerName = mailboxServerInformation.MailboxServerName;
                    targetVersion    = mailboxServerInformation.MailboxServerVersion;
                }
                if (!this.MailboxMerger.DestMailbox.MailboxExists())
                {
                    throw new MailboxDoesNotExistPermanentException(this.MailboxMerger.TargetTracingID);
                }
                MrsTracer.Service.Debug("Destination mailbox {0} exists.", new object[]
                {
                    this.MailboxMerger.TargetTracingID
                });
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.LastSuccessfulTargetConnection, new DateTime?(DateTime.UtcNow));
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.TargetConnectionFailure, null);
                this.MailboxMerger.LoadSyncState(base.Report);
            }
            if (targetConnectFailure == null)
            {
                this.AfterTargetConnect();
            }
            CommonUtils.CatchKnownExceptions(delegate
            {
                MrsTracer.Service.Debug("Connecting to the source mailbox {0}.", new object[]
                {
                    this.MailboxMerger.SourceTracingID
                });
                this.MailboxMerger.ConnectSourceMailbox(MailboxConnectFlags.None);
            }, delegate(Exception failure)
            {
                MrsTracer.Service.Warning("Failed to connect to source mailbox: {0}", new object[]
                {
                    CommonUtils.FullExceptionMessage(failure)
                });
                sourceConnectFailure = failure;
            });
            if (sourceConnectFailure == null)
            {
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.LastSuccessfulSourceConnection, new DateTime?(DateTime.UtcNow));
                base.TimeTracker.SetTimestamp(RequestJobTimestamp.SourceConnectionFailure, null);
                MailboxServerInformation mailboxServerInformation2 = this.MailboxMerger.SourceMailbox.GetMailboxServerInformation();
                MailboxInformation       mailboxInformation2       = this.MailboxMerger.SourceMailbox.GetMailboxInformation();
                this.MailboxMerger.SourceServerInfo = mailboxServerInformation2;
                if (mailboxServerInformation2 != null)
                {
                    ConnectivityRec connectivityRec2 = new ConnectivityRec(ServerKind.Source, mailboxInformation2, mailboxServerInformation2);
                    base.Report.Append(MrsStrings.ReportSourceMailboxConnection(this.MailboxMerger.SourceTracingID, mailboxServerInformation2.ServerInfoString, (mailboxInformation2 != null) ? mailboxInformation2.MdbName : "(null)"), connectivityRec2);
                    sourceServerName = mailboxServerInformation2.MailboxServerName;
                    sourceVersion    = mailboxServerInformation2.MailboxServerVersion;
                }
            }
            if (sourceConnectFailure != null || targetConnectFailure != null)
            {
                base.CheckRequestIsValid();
                if (sourceConnectFailure != null)
                {
                    throw sourceConnectFailure;
                }
                if (targetConnectFailure != null)
                {
                    throw targetConnectFailure;
                }
            }
            base.SaveRequest(true, delegate(TransactionalRequestJob rj)
            {
                this.TimeTracker.SetTimestamp(RequestJobTimestamp.Failure, null);
                this.TimeTracker.SetTimestamp(RequestJobTimestamp.Suspended, null);
                rj.FailureCode   = null;
                rj.FailureType   = null;
                rj.FailureSide   = null;
                rj.Message       = LocalizedString.Empty;
                rj.SourceServer  = sourceServerName;
                rj.SourceVersion = sourceVersion;
                rj.TargetServer  = targetServerName;
                rj.TargetVersion = targetVersion;
                rj.Status        = RequestStatus.InProgress;
                this.TimeTracker.CurrentState = RequestState.InitialSeeding;
                RequestJobLog.Write(rj);
            });
            if (!string.IsNullOrEmpty(base.CachedRequestJob.ContentFilter))
            {
                RestrictionData contentRestriction;
                string          text;
                ContentFilterBuilder.ProcessContentFilter(base.CachedRequestJob.ContentFilter, base.CachedRequestJob.ContentFilterLCID, null, this.MailboxMerger.SourceMailboxWrapper, out contentRestriction, out text);
                this.MailboxMerger.ContentRestriction = contentRestriction;
            }
            if (this.MailboxMerger.SupportsRuleAPIs)
            {
                this.MailboxMerger.SourceMailbox.ConfigMailboxOptions(MailboxOptions.IgnoreExtendedRuleFAIs);
            }
            this.MailboxMerger.ExchangeSourceAndTargetVersions();
            base.ScheduleWorkItem(new Action(this.StartMerge), WorkloadType.Unknown);
        }