コード例 #1
0
        private bool RunChecks(AmServerName sourceServer, AmServerName targetServer, RpcDatabaseCopyStatus2 status, AmBcsChecks amBcsChecks, out AmBcsChecks completedChecks, ref LocalizedString error)
        {
            bool flag = this.HasNotBeenTried(targetServer, ref error);

            completedChecks = AmBcsChecks.None;
            if (flag)
            {
                if (this.m_bcsContext.ActionCode.IsMountOrRemountOperation && AmServerName.IsEqual(sourceServer, targetServer))
                {
                    AmTrace.Debug("BCS: Target server '{0}' is skipping validation checks to allow mount to take place for database '{1}'.", new object[]
                    {
                        targetServer.NetbiosName,
                        this.m_bcsContext.GetDatabaseNameOrGuid()
                    });
                    flag = true;
                }
                else
                {
                    AmBcsCopyValidation amBcsCopyValidation = new AmBcsCopyValidation(this.m_bcsContext.DatabaseGuid, this.m_bcsContext.GetDatabaseNameOrGuid(), amBcsChecks, sourceServer, targetServer, status, this.m_bcsContext.ErrorLogger, this.m_bcsContext.SkipValidationChecks, this.m_bcsContext.ComponentStateWrapper);
                    flag            = amBcsCopyValidation.RunChecks(ref error);
                    completedChecks = amBcsCopyValidation.CompletedChecks;
                }
            }
            else
            {
                AmTrace.Debug("BCS: Target server '{0}' has already been tried for database '{1}'.", new object[]
                {
                    targetServer.NetbiosName,
                    this.m_bcsContext.GetDatabaseNameOrGuid()
                });
            }
            return(flag);
        }
コード例 #2
0
        // Token: 0x06000691 RID: 1681 RVA: 0x0001FF30 File Offset: 0x0001E130
        private bool IsTotalQueueLengthLessThanMaxThreshold(ref LocalizedString error)
        {
            string dbName = this.DbName;
            RpcDatabaseCopyStatus2 copyStatus   = this.CopyStatus;
            AmServerName           targetServer = this.TargetServer;
            bool flag = AmBcsCopyValidation.IsTotalQueueLengthLessThanMaxThreshold(dbName, copyStatus, targetServer, ref error);

            if (!flag)
            {
                this.ReportCopyStatusFailure(AmBcsChecks.TotalQueueLengthMaxAllowed, error);
            }
            return(flag);
        }
コード例 #3
0
        // Token: 0x0600068F RID: 1679 RVA: 0x0001FE8C File Offset: 0x0001E08C
        private bool IsCopyQueueLengthAcceptable(ref LocalizedString error)
        {
            string dbName = this.DbName;
            RpcDatabaseCopyStatus2 copyStatus   = this.CopyStatus;
            AmServerName           targetServer = this.TargetServer;
            bool flag = AmBcsCopyValidation.IsRealCopyQueueLengthAcceptable(dbName, copyStatus, 10, targetServer, ref error);

            if (!flag)
            {
                this.ReportCopyStatusFailure(AmBcsChecks.CopyQueueLength, error);
            }
            return(flag);
        }
コード例 #4
0
        // Token: 0x0600068D RID: 1677 RVA: 0x0001FDE4 File Offset: 0x0001DFE4
        private bool IsHealthyOrDisconnected(ref LocalizedString error)
        {
            string dbName = this.DbName;
            RpcDatabaseCopyStatus2 copyStatus   = this.CopyStatus;
            AmServerName           targetServer = this.TargetServer;
            bool flag = AmBcsCopyValidation.IsHealthyOrDisconnected(dbName, copyStatus, targetServer, ref error);

            if (!flag)
            {
                this.ReportCopyStatusFailure(AmBcsChecks.IsHealthyOrDisconnected, error);
            }
            return(flag);
        }
コード例 #5
0
        // Token: 0x06000728 RID: 1832 RVA: 0x00022C0C File Offset: 0x00020E0C
        public AmServerName FindNextBestCopy()
        {
            AmServerName    amServerName = null;
            LocalizedString error        = LocalizedString.Empty;
            bool            flag         = false;
            AmBcsChecks     amBcsChecks  = AmBcsChecks.None;

            if (!this.m_fInitialized)
            {
                this.m_bcsWatch.Start();
                try
                {
                    if (this.m_bcsContext.ShouldLogSubactionEvent)
                    {
                        ReplayCrimsonEvents.BcsInitiated.LogGeneric(this.m_bcsContext.PrepareSubaction(new object[]
                        {
                            this.BestCopySelectionType,
                            false
                        }));
                    }
                    bool fDbNeverMounted = false;
                    this.m_perfTracker.RunTimedOperation(BcsOperation.HasDatabaseBeenMounted, delegate
                    {
                        fDbNeverMounted = !AmBestCopySelectionHelper.HasDatabaseBeenMounted(this.m_bcsContext.DatabaseGuid, this.m_amConfig);
                        this.m_bcsContext.DatabaseNeverMounted = fDbNeverMounted;
                    });
                    AmBcsServerValidation serverValidator = new AmBcsServerValidation(this.m_targetServerName, this.m_bcsContext.SourceServerName, this.m_bcsContext.Database, this.m_amConfig, this.m_bcsContext.ErrorLogger, null);
                    AmBcsServerChecks     serverChecks    = AmBcsServerValidation.GetServerValidationChecks(this.m_bcsContext.ActionCode, true);
                    bool serverChecksPassed = false;
                    this.m_perfTracker.RunTimedOperation(BcsOperation.DetermineServersToContact, delegate
                    {
                        serverChecksPassed = serverValidator.RunChecks(serverChecks, ref error);
                    });
                    if (!serverChecksPassed)
                    {
                        goto IL_39C;
                    }
                    if (!fDbNeverMounted && !this.m_bcsContext.ActionCode.IsMountOrRemountOperation)
                    {
                        List <AmServerName> serversToContact = new List <AmServerName>(2);
                        serversToContact.Add(this.m_targetServerName);
                        if (!AmServerName.IsEqual(this.m_bcsContext.SourceServerName, this.m_targetServerName) && (this.m_bcsContext.SkipValidationChecks & AmBcsSkipFlags.SkipActiveCopyChecks) == AmBcsSkipFlags.None)
                        {
                            serversToContact.Add(this.m_bcsContext.SourceServerName);
                        }
                        this.m_perfTracker.RunTimedOperation(BcsOperation.GetCopyStatusRpc, delegate
                        {
                            this.ConstructBcsStatusTable(serversToContact);
                        });
                        AmBcsServerFailureLogger amBcsServerFailureLogger = this.m_bcsContext.ErrorLogger as AmBcsServerFailureLogger;
                        string concatenatedErrorString = amBcsServerFailureLogger.GetConcatenatedErrorString();
                        if (concatenatedErrorString != null)
                        {
                            error = new LocalizedString(concatenatedErrorString);
                            goto IL_39C;
                        }
                    }
                    this.m_fInitialized = true;
                }
                finally
                {
                    this.m_bcsWatch.Stop();
                    this.m_perfTracker.RecordDuration(BcsOperation.BcsOverall, this.m_bcsWatch.Elapsed);
                    this.m_perfTracker.LogEvent();
                }
            }
            if (this.TargetHasBeenTried(ref error))
            {
                this.m_bcsContext.ErrorLogger.ReportServerFailure(this.m_targetServerName, "CopyHasBeenTriedCheck", error, false);
            }
            else
            {
                if (this.m_bcsContext.ActionCode.IsMountOrRemountOperation)
                {
                    amBcsChecks = AmBcsChecks.None;
                    AmTrace.Debug("BCS: FindNextBestCopy: Skipping validation checks for Database '{0}' on server '{1}'.", new object[]
                    {
                        this.m_bcsContext.GetDatabaseNameOrGuid(),
                        this.m_targetServerName
                    });
                }
                else if (this.m_bcsContext.DatabaseNeverMounted)
                {
                    amBcsChecks = AmBcsChecks.IsPassiveCopy;
                    AmTrace.Debug("BCS: FindNextBestCopy: Database '{0}' has never been mounted. Running non-status related checks.", new object[]
                    {
                        this.m_bcsContext.GetDatabaseNameOrGuid()
                    });
                }
                else
                {
                    if (!this.CheckActiveForMove(ref error))
                    {
                        goto IL_39C;
                    }
                    amBcsChecks = (AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsCatalogStatusHealthy | AmBcsChecks.CopyQueueLength | AmBcsChecks.ReplayQueueLength | AmBcsChecks.IsPassiveCopy | AmBcsChecks.IsSeedingSource | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.MaxActivesUnderPreferredLimit);
                }
                RpcDatabaseCopyStatus2 copyStatus = null;
                this.m_bcsContext.StatusTable.TryGetValue(this.m_targetServerName, out copyStatus);
                AmBcsCopyValidation amBcsCopyValidation = new AmBcsCopyValidation(this.m_bcsContext.DatabaseGuid, this.m_bcsContext.GetDatabaseNameOrGuid(), amBcsChecks, this.m_bcsContext.SourceServerName, this.m_targetServerName, copyStatus, this.m_bcsContext.ErrorLogger, this.m_bcsContext.SkipValidationChecks, this.m_bcsContext.ComponentStateWrapper);
                flag        = amBcsCopyValidation.RunChecks(ref error);
                amBcsChecks = amBcsCopyValidation.CompletedChecks;
            }
IL_39C:
            if (flag)
            {
                AmTrace.Info("BCS: FindNextBestCopy: DatabaseCopy: '{0}\\{1}' passed validation checks.", new object[]
                {
                    this.m_bcsContext.GetDatabaseNameOrGuid(),
                    this.m_targetServerName.NetbiosName
                });
                amServerName = this.m_targetServerName;
                this.m_serverAlreadyTried = this.m_targetServerName;
                ReplayCrimsonEvents.BcsDbMoveChecksPassed.Log <string, Guid, AmServerName, AmBcsChecks>(this.m_bcsContext.GetDatabaseNameOrGuid(), this.m_bcsContext.DatabaseGuid, amServerName, amBcsChecks);
            }
            else
            {
                AmTrace.Error("BCS: FindNextBestCopy: DatabaseCopy: '{0}\\{1}'. Checks returned error: {2}", new object[]
                {
                    this.m_bcsContext.GetDatabaseNameOrGuid(),
                    this.m_targetServerName.NetbiosName,
                    error
                });
                AmBcsServerFailureLogger amBcsServerFailureLogger2 = this.m_bcsContext.ErrorLogger as AmBcsServerFailureLogger;
                string concatenatedErrorString2 = amBcsServerFailureLogger2.GetConcatenatedErrorString();
                this.m_lastException = new AmBcsSingleCopyValidationException(concatenatedErrorString2);
                ReplayCrimsonEvents.BcsDbMoveChecksFailed.Log <string, Guid, AmServerName, AmBcsChecks, LocalizedString>(this.m_bcsContext.GetDatabaseNameOrGuid(), this.m_bcsContext.DatabaseGuid, this.m_targetServerName, amBcsChecks, error);
            }
            return(amServerName);
        }