示例#1
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            DatabaseCopy dataObject = base.DataObject;

            base.InternalProcessRecord();
            if (base.HasErrors)
            {
                TaskLogger.LogExit();
                return;
            }
            this.m_database.InvalidDatabaseCopiesAllowed = true;
            this.RunConfigurationUpdaterRpc();
            try
            {
                ReplayState.DeleteState((this.m_server != null) ? this.m_server.Fqdn : this.m_serverName, this.m_database);
            }
            catch (SecurityException ex)
            {
                this.WriteWarning(Strings.ErrorCannotDeleteReplayState(this.m_database.Name, this.m_serverName, ex.Message));
            }
            catch (UnauthorizedAccessException ex2)
            {
                this.WriteWarning(Strings.ErrorCannotDeleteReplayState(this.m_database.Name, this.m_serverName, ex2.Message));
            }
            catch (IOException ex3)
            {
                this.WriteWarning(Strings.ErrorCannotDeleteReplayState(this.m_database.Name, this.m_serverName, ex3.Message));
            }
            catch (RemoteRegistryTimedOutException ex4)
            {
                this.WriteWarning(Strings.ErrorCannotDeleteReplayState(this.m_database.Name, this.m_serverName, ex4.Message));
            }
            string pathName = this.m_database.EdbFilePath.PathName;

            if (string.IsNullOrEmpty(pathName))
            {
                this.WriteWarning(Strings.NeedRemoveCopyLogFileManuallyAfterCopyDisabledRcr(this.m_database.Name, this.m_database.LogFolderPath.PathName, this.m_serverName));
            }
            else
            {
                this.WriteWarning(Strings.NeedRemoveCopyFileManuallyAfterCopyDisabledRcr(this.m_database.Name, this.m_database.LogFolderPath.PathName, pathName, this.m_serverName));
            }
            DatabaseTasksHelper.UpdateDataGuaranteeConstraint((ITopologyConfigurationSession)base.DataSession, this.m_database, new Task.TaskWarningLoggingDelegate(this.WriteWarning));
            TaskLogger.LogExit();
        }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.InternalProcessRecord();
            if (this.m_invalidDbCopy == null && !this.m_fConfigOnly)
            {
                ReplayState.DeleteState(this.m_server.Fqdn, this.DataObject, true);
            }
            DatabaseCopy databaseCopy = this.m_invalidDbCopy ?? new DatabaseCopy();

            databaseCopy.HostServer = (ADObjectId)this.m_server.Identity;
            if (base.Fields["ActivationPreference"] == null)
            {
                if (this.m_invalidDbCopy == null)
                {
                    this.ActivationPreference = (uint)(this.DataObject.AllDatabaseCopies.Length + 1);
                }
                else
                {
                    this.ActivationPreference = (uint)this.m_invalidDbCopy.ActivationPreference;
                }
            }
            databaseCopy.ActivationPreference = (int)this.ActivationPreference;
            DatabaseCopy databaseCopy2 = null;

            if (databaseCopy.ActivationPreference == 1)
            {
                databaseCopy2 = databaseCopy;
            }
            else if (this.ActivationPreference != 0U)
            {
                databaseCopy2 = SetMailboxDatabaseCopy.GetDatabaseCopyOfPreference1(new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), this.DataObject, databaseCopy);
            }
            ActivationPreferenceSetter <DatabaseCopy> activationPreferenceSetter = new ActivationPreferenceSetter <DatabaseCopy>(this.DataObject.AllDatabaseCopies, databaseCopy, (this.m_invalidDbCopy == null) ? EntryAction.Insert : EntryAction.Modify);
            UpdateResult updateResult = activationPreferenceSetter.UpdateCachedValues();

            if (updateResult == UpdateResult.AllChanged)
            {
                activationPreferenceSetter.SaveAllUpdatedValues(base.DataSession);
            }
            databaseCopy.ReplayLagTime     = this.m_replayLagTime;
            databaseCopy.TruncationLagTime = this.m_truncationLagTime;
            databaseCopy.SetId(this.DataObject.Id.GetChildId(this.m_server.Name.ToUpperInvariant()));
            databaseCopy.ParentObjectClass = (this.DataObject.IsPublicFolderDatabase ? PublicFolderDatabase.MostDerivedClass : MailboxDatabase.MostDerivedClass);
            if (databaseCopy2 != null)
            {
                base.WriteVerbose(Strings.UpdatingLegDnForDatabaseCopy(databaseCopy.Name));
                ITopologyConfigurationSession adSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.IgnoreInvalid, base.SessionSettings, 338, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\database\\AddMailboxDatabaseCopy.cs");
                SetMailboxDatabaseCopy.UpdateServerLegdnForDatabaseSite(new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), adSession, databaseCopy2);
            }
            base.WriteVerbose(Strings.UpdatingDatabaseCopyObject(databaseCopy.HostServer.Name, databaseCopy.ReplayLagTime.ToString(), databaseCopy.TruncationLagTime.ToString()));
            base.DataSession.Save(databaseCopy);
            MailboxDatabase database = databaseCopy.GetDatabase <MailboxDatabase>();

            if (this.m_firstCopy && database.DataMoveReplicationConstraint == DataMoveReplicationConstraintParameter.None)
            {
                database.DataMoveReplicationConstraint = DataMoveReplicationConstraintParameter.SecondCopy;
                base.DataSession.Save(database);
                base.WriteVerbose(Strings.ConstraintUpgrade(database.Identity.ToString(), DataMoveReplicationConstraintParameter.None, DataMoveReplicationConstraintParameter.SecondCopy));
            }
            ITopologyConfigurationSession topologyConfigurationSession = (ITopologyConfigurationSession)base.DataSession;

            ADObjectId[] array = DagTaskHelper.DetermineRemoteSites(topologyConfigurationSession, databaseCopy.OriginatingServer, this.m_server);
            if (array != null)
            {
                DagTaskHelper.ForceReplication(topologyConfigurationSession, databaseCopy, array, this.DataObject.Identity.ToString(), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
            }
            if (!this.m_fConfigOnly)
            {
                this.RunSourceConfigurationUpdaterRpc();
            }
            if (!this.IsThirdPartyReplicationEnabled && !this.m_SeedingPostponedSpecified && !base.SeedingPostponed && !this.m_fConfigOnly)
            {
                base.CreateTargetEdbDirectory();
                base.PerformSeedIfNecessary();
            }
            if (!this.m_fConfigOnly)
            {
                this.RunTargetConfigurationUpdaterRpc();
            }
            this.WriteWarning(Strings.WarnAdministratorToRestartService(this.m_server.Name));
            TaskLogger.LogExit();
        }