private bool RunChecksWrapper(AmBcsChecks checks, out AmServerName selectedCopy, AmServerName targetServer, RpcDatabaseCopyStatus2 copyStatus) { LocalizedString empty = LocalizedString.Empty; selectedCopy = null; AmBcsChecks amBcsChecks; bool flag = this.RunChecks(this.m_bcsContext.SourceServerName, targetServer, copyStatus, checks, out amBcsChecks, ref empty); if (flag) { AmTrace.Info("BCS: DatabaseCopy '{0}' on server '{1}' passed checks: {2}", new object[] { this.m_bcsContext.GetDatabaseNameOrGuid(), targetServer, checks }); selectedCopy = targetServer; ReplayCrimsonEvents.BcsDbNodeChecksPassed.Log <string, Guid, AmServerName, AmBcsChecks>(this.m_bcsContext.GetDatabaseNameOrGuid(), this.m_bcsContext.DatabaseGuid, targetServer, amBcsChecks); } else { AmTrace.Error("BCS: DatabaseCopy '{0}' on server '{1}' failed checks: {2}", new object[] { this.m_bcsContext.GetDatabaseNameOrGuid(), targetServer, checks }); } return(flag); }
// Token: 0x06000688 RID: 1672 RVA: 0x0001FBF0 File Offset: 0x0001DDF0 private bool ShouldBeSkipped(AmBcsChecks checkInQuestion) { if ((checkInQuestion & (AmBcsChecks)RegistryParameters.BcsCheckToDisable) == checkInQuestion) { AmTrace.Info("BCS Check {0} skipped since registry parameters is configured to skip it. (Reg.BcsCheckToDisable={1})", new object[] { checkInQuestion, RegistryParameters.BcsCheckToDisable }); return(true); } if (this.IsSkipFlagSpecified(AmBcsSkipFlags.LegacySkipAllChecks)) { return(true); } bool flag = false; if (!flag && this.IsSkipFlagSpecified(AmBcsSkipFlags.SkipClientExperienceChecks)) { flag = this.IsCheckInSkippedList(AmBcsSkippedCheckDefinitions.SkipClientExperienceChecks, checkInQuestion); } if (!flag && this.IsSkipFlagSpecified(AmBcsSkipFlags.SkipHealthChecks)) { flag = this.IsCheckInSkippedList(AmBcsSkippedCheckDefinitions.SkipHealthChecks, checkInQuestion); } if (!flag && this.IsSkipFlagSpecified(AmBcsSkipFlags.SkipLagChecks)) { flag = this.IsCheckInSkippedList(AmBcsSkippedCheckDefinitions.SkipLagChecks, checkInQuestion); } if (!flag && this.IsSkipFlagSpecified(AmBcsSkipFlags.SkipMaximumActiveDatabasesChecks)) { flag = this.IsCheckInSkippedList(AmBcsSkippedCheckDefinitions.SkipMaximumActiveDatabasesChecks, checkInQuestion); } return(flag); }
// Token: 0x06000695 RID: 1685 RVA: 0x00020074 File Offset: 0x0001E274 internal bool IsManagedAvailabilityChecksSucceeded(ref LocalizedString error, out AmBcsChecks completedChecks) { bool flag = true; completedChecks = AmBcsChecks.None; List <string> list = new List <string>(); if (this.ComponentStateWrapper == null) { return(true); } if (this.ShouldRunCheck(AmBcsChecks.ManagedAvailabilityInitiatorBetterThanSource)) { completedChecks |= AmBcsChecks.ManagedAvailabilityInitiatorBetterThanSource; flag = this.ComponentStateWrapper.IsInitiatorComponentBetterThanSource(this.TargetServer, list); if (!flag && list.Count > 0) { string failures = string.Join(",", list.ToArray()); error = ReplayStrings.AmBcsManagedAvailabilityCheckFailed(this.SourceServer.NetbiosName, this.TargetServer.NetbiosName, this.ComponentStateWrapper.InitiatingComponentName, failures); this.ReportCopyStatusFailure(AmBcsChecks.ManagedAvailabilityInitiatorBetterThanSource, error); } } if (flag) { list.Clear(); AmBcsChecks amBcsChecks = AmBcsChecks.None; if (this.ShouldRunCheck(AmBcsChecks.ManagedAvailabilityAllHealthy)) { amBcsChecks = AmBcsChecks.ManagedAvailabilityAllHealthy; flag = this.ComponentStateWrapper.IsAllComponentsHealthy(this.TargetServer, list); } else if (this.ShouldRunCheck(AmBcsChecks.ManagedAvailabilityUptoNormalHealthy)) { amBcsChecks = AmBcsChecks.ManagedAvailabilityUptoNormalHealthy; flag = this.ComponentStateWrapper.IsUptoNormalComponentsHealthy(this.TargetServer, list); } else if (this.ShouldRunCheck(AmBcsChecks.ManagedAvailabilityAllBetterThanSource)) { amBcsChecks = AmBcsChecks.ManagedAvailabilityAllBetterThanSource; flag = this.ComponentStateWrapper.IsComponentsBettterThanSource(this.TargetServer, list); } else if (this.ShouldRunCheck(AmBcsChecks.ManagedAvailabilitySameAsSource)) { amBcsChecks = AmBcsChecks.ManagedAvailabilitySameAsSource; flag = this.ComponentStateWrapper.IsComponentsAtleastSameAsSource(this.TargetServer, list); } if (flag) { completedChecks |= amBcsChecks; } else if (list.Count > 0) { string failures2 = string.Join(",", list.ToArray()); error = ReplayStrings.AmBcsManagedAvailabilityCheckFailed(this.SourceServer.NetbiosName, this.TargetServer.NetbiosName, this.ComponentStateWrapper.InitiatingComponentName, failures2); this.ReportCopyStatusFailure(amBcsChecks, error); } } return(flag); }
// Token: 0x06000686 RID: 1670 RVA: 0x0001FB9C File Offset: 0x0001DD9C internal bool ShouldRunCheck(AmBcsChecks checkInQuestion) { bool flag = (this.ChecksToRun & checkInQuestion) == checkInQuestion; if (checkInQuestion == AmBcsChecks.IsPassiveCopy) { return(flag); } return(flag && !this.ShouldBeSkipped(checkInQuestion)); }
// Token: 0x0600066D RID: 1645 RVA: 0x0001F678 File Offset: 0x0001D878 public AmBcsCopyValidation(Guid dbGuid, string dbName, AmBcsChecks checksToRun, AmServerName sourceServer, AmServerName targetServer, RpcDatabaseCopyStatus2 copyStatus, IAmBcsErrorLogger errorLogger, AmBcsSkipFlags skipValidationChecks, ComponentStateWrapper csw) { this.DbGuid = dbGuid; this.DbName = dbName; this.ChecksToRun = checksToRun; this.SourceServer = sourceServer; this.TargetServer = targetServer; this.CopyStatus = copyStatus; this.ComponentStateWrapper = csw; this.ErrorLogger = errorLogger; this.SkipValidationChecks = skipValidationChecks; AmTrace.Debug("AmBcsCopyValidation: Constructed with SkipValidationChecks='{0}'", new object[] { skipValidationChecks }); }
private AmServerName RunPhaseN(AmBcsChecks checks) { bool flag = false; AmServerName result = null; AmServerName amServerName = null; if (this.m_bcsContext.ActionCode.Reason == AmDbActionReason.ActivationDisabled) { checks |= AmBcsChecks.ActivationEnabled; } if (this.m_bcsContext.ActionCode.IsMountOrRemountOperation || this.m_bcsContext.ActionCode.IsAdminMoveOperation) { amServerName = this.m_bcsContext.SourceServerName; if (this.m_bcsContext.IsSourceServerAllowedForMount) { flag = this.RunChecksWrapper(checks, out result, amServerName, null); } else { AmTrace.Debug("BCS: RunPhaseN: Ignoring source server {0} since determine servers did not allow it.", new object[] { amServerName }); } } if (!flag) { foreach (KeyValuePair <AmServerName, RpcDatabaseCopyStatus2> keyValuePair in this.m_sortedStatusCollection) { if (!AmServerName.IsEqual(amServerName, keyValuePair.Key)) { flag = this.RunChecksWrapper(checks, out result, keyValuePair.Key, keyValuePair.Value); if (flag) { break; } } } } return(result); }
// Token: 0x0600068B RID: 1675 RVA: 0x0001FCF6 File Offset: 0x0001DEF6 private void ReportCopyStatusFailure(AmBcsChecks checkThatFailed, LocalizedString error) { this.ErrorLogger.ReportCopyStatusFailure(this.TargetServer, checkThatFailed.ToString(), this.ChecksToRun.ToString(), error); }
// Token: 0x0600068A RID: 1674 RVA: 0x0001FCC8 File Offset: 0x0001DEC8 private bool IsCheckInSkippedList(IEnumerable <AmBcsChecks> checks, AmBcsChecks checkInQuestion) { return(checks.Any((AmBcsChecks check) => (checkInQuestion & check) == check)); }
// Token: 0x06000687 RID: 1671 RVA: 0x0001FBCC File Offset: 0x0001DDCC internal bool ShouldRunManagedAvailabilityChecks() { AmBcsChecks amBcsChecks = AmBcsChecks.ManagedAvailabilityInitiatorBetterThanSource | AmBcsChecks.ManagedAvailabilityAllHealthy | AmBcsChecks.ManagedAvailabilityUptoNormalHealthy | AmBcsChecks.ManagedAvailabilityAllBetterThanSource | AmBcsChecks.ManagedAvailabilitySameAsSource; return((this.ChecksToRun & amBcsChecks) > AmBcsChecks.None); }
// Token: 0x0600066C RID: 1644 RVA: 0x0001F654 File Offset: 0x0001D854 public AmBcsCopyValidation(Guid dbGuid, string dbName, AmBcsChecks checksToRun, AmServerName sourceServer, AmServerName targetServer, RpcDatabaseCopyStatus2 copyStatus, IAmBcsErrorLogger errorLogger, AmBcsSkipFlags skipValidationChecks) : this(dbGuid, dbName, checksToRun, sourceServer, targetServer, copyStatus, errorLogger, skipValidationChecks, null) { }
// Token: 0x06000685 RID: 1669 RVA: 0x0001F960 File Offset: 0x0001DB60 public bool RunChecks(ref LocalizedString error) { bool flag = true; AmBcsChecks checksToRun = this.ChecksToRun; error = LocalizedString.Empty; this.CompletedChecks = AmBcsChecks.None; if (flag && this.ShouldRunCheck(AmBcsChecks.IsPassiveCopy)) { this.CompletedChecks |= AmBcsChecks.IsPassiveCopy; flag = this.IsPassiveCopy(ref error); } if (flag && this.ShouldRunCheck(AmBcsChecks.ActivationEnabled)) { this.CompletedChecks |= AmBcsChecks.ActivationEnabled; flag = this.IsActivationEnabled(ref error); } if (flag && this.ShouldRunCheck(AmBcsChecks.MaxActivesUnderHighestLimit)) { this.CompletedChecks |= AmBcsChecks.MaxActivesUnderHighestLimit; flag = this.IsMaxActivesUnderHighestLimit(ref error); } if (flag && this.ShouldRunCheck(AmBcsChecks.IsHealthyOrDisconnected)) { this.CompletedChecks |= AmBcsChecks.IsHealthyOrDisconnected; flag = this.IsHealthyOrDisconnected(ref error); } if (flag && this.ShouldRunCheck(AmBcsChecks.TotalQueueLengthMaxAllowed)) { this.CompletedChecks |= AmBcsChecks.TotalQueueLengthMaxAllowed; flag = this.IsTotalQueueLengthLessThanMaxThreshold(ref error); } if (flag && this.ShouldRunCheck(AmBcsChecks.MaxActivesUnderPreferredLimit)) { this.CompletedChecks |= AmBcsChecks.MaxActivesUnderPreferredLimit; flag = this.IsMaxActivesUnderPreferredLimit(ref error); } if (flag && this.ShouldRunCheck(AmBcsChecks.CopyQueueLength)) { this.CompletedChecks |= AmBcsChecks.CopyQueueLength; flag = this.IsCopyQueueLengthAcceptable(ref error); } if (flag && this.ShouldRunCheck(AmBcsChecks.ReplayQueueLength)) { this.CompletedChecks |= AmBcsChecks.ReplayQueueLength; flag = this.IsReplayQueueLengthAcceptable(ref error); } if (flag && this.ShouldRunCheck(AmBcsChecks.IsSeedingSource)) { this.CompletedChecks |= AmBcsChecks.IsSeedingSource; flag = this.IsPassiveSeedingSource(ref error); } if (flag && this.ShouldRunCheck(AmBcsChecks.IsCatalogStatusHealthy)) { this.CompletedChecks |= AmBcsChecks.IsCatalogStatusHealthy; flag = this.IsCatalogStatusHealthy(ref error); } if (flag && this.ShouldRunCheck(AmBcsChecks.IsCatalogStatusCrawling)) { this.CompletedChecks |= AmBcsChecks.IsCatalogStatusCrawling; flag = this.IsCatalogStatusCrawling(ref error); } if (flag && this.ShouldRunManagedAvailabilityChecks()) { AmBcsChecks amBcsChecks; flag = this.IsManagedAvailabilityChecksSucceeded(ref error, out amBcsChecks); this.CompletedChecks |= amBcsChecks; } if (flag && this.ShouldRunCheck(AmBcsChecks.MaxActivesUnderHighestLimit)) { this.CompletedChecks |= AmBcsChecks.MaxActivesUnderHighestLimit; flag = this.UpdateActiveIfMaxActivesNotExceededHighestLimit(ref error); } if (flag && this.ShouldRunCheck(AmBcsChecks.MaxActivesUnderPreferredLimit)) { this.CompletedChecks |= AmBcsChecks.MaxActivesUnderPreferredLimit; flag = this.UpdateActiveIfMaxActivesNotExceededPreferredLimit(ref error); } return(flag); }
// 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); }
public AmServerName FindNextBestCopy() { AmServerName amServerName = null; AmBcsChecks amBcsChecks = AmBcsChecks.None; try { this.Initialize(); List <AmBcsChecks> list = new List <AmBcsChecks> { AmBcsChecks.ManagedAvailabilityAllHealthy, AmBcsChecks.ManagedAvailabilityUptoNormalHealthy, AmBcsChecks.ManagedAvailabilityAllBetterThanSource, AmBcsChecks.ManagedAvailabilitySameAsSource }; if (!this.m_bcsContext.ActionCode.IsAutomaticManagedAvailabilityFailover) { list.Add(AmBcsChecks.None); } else { amBcsChecks = AmBcsChecks.ManagedAvailabilityInitiatorBetterThanSource; } if (this.m_bcsContext.DatabaseNeverMounted) { AmTrace.Debug("FindNextBestCopy: Database '{0}' has never been mounted. Running non-status related checks.", new object[] { this.m_bcsContext.GetDatabaseNameOrGuid() }); if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsPassiveCopy); } } else { if (this.m_bcsContext.ActionCode.IsAdminMoveOperation) { AmBcsChecks amBcsChecks2 = AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsCatalogStatusHealthy | AmBcsChecks.CopyQueueLength | AmBcsChecks.ReplayQueueLength | AmBcsChecks.IsPassiveCopy | AmBcsChecks.IsSeedingSource | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderPreferredLimit; AmBcsChecks amBcsChecks3 = AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.CopyQueueLength | AmBcsChecks.ReplayQueueLength | AmBcsChecks.IsCatalogStatusCrawling | AmBcsChecks.IsPassiveCopy | AmBcsChecks.IsSeedingSource | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderPreferredLimit; using (List <AmBcsChecks> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { AmBcsChecks amBcsChecks4 = enumerator.Current; AmBcsChecks amBcsChecks5 = amBcsChecks4 | amBcsChecks; if (amServerName == null) { AmBcsChecks amBcsChecks6 = amBcsChecks2 | amBcsChecks5; AmTrace.Debug("FindNextBestCopy: IsAdminMoveOperation='true', so first attempting '{0}' checks.", new object[] { amBcsChecks6 }); amServerName = this.RunPhaseN(amBcsChecks6); } if (amServerName == null) { AmBcsChecks amBcsChecks7 = amBcsChecks3 | amBcsChecks5; AmTrace.Debug("FindNextBestCopy: IsAdminMoveOperation='true', so second attempting '{0}' checks.", new object[] { amBcsChecks7 }); amServerName = this.RunPhaseN(amBcsChecks7); } if (amServerName != null) { break; } } goto IL_2FA; } } if (this.m_bcsContext.ActionCode.Reason == AmDbActionReason.CatalogFailureItem) { AmTrace.Debug("FindNextBestCopy: Catalog induced failover, so a healthy catalog must be found", new object[0]); using (List <AmBcsChecks> .Enumerator enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { AmBcsChecks amBcsChecks8 = enumerator2.Current; if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsCatalogStatusHealthy | AmBcsChecks.CopyQueueLength | AmBcsChecks.ReplayQueueLength | AmBcsChecks.IsPassiveCopy | AmBcsChecks.IsSeedingSource | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderPreferredLimit | amBcsChecks8); } if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsCatalogStatusHealthy | AmBcsChecks.ReplayQueueLength | AmBcsChecks.IsPassiveCopy | AmBcsChecks.IsSeedingSource | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderPreferredLimit | amBcsChecks8); } if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsCatalogStatusHealthy | AmBcsChecks.CopyQueueLength | AmBcsChecks.IsPassiveCopy | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderHighestLimit | amBcsChecks8); } if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsCatalogStatusHealthy | AmBcsChecks.IsPassiveCopy | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderHighestLimit | amBcsChecks8); } if (amServerName != null) { break; } } goto IL_2FA; } } foreach (AmBcsChecks amBcsChecks9 in list) { AmBcsChecks amBcsChecks10 = amBcsChecks9 | amBcsChecks; if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsCatalogStatusHealthy | AmBcsChecks.CopyQueueLength | AmBcsChecks.ReplayQueueLength | AmBcsChecks.IsPassiveCopy | AmBcsChecks.IsSeedingSource | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderPreferredLimit | amBcsChecks10); } if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.CopyQueueLength | AmBcsChecks.ReplayQueueLength | AmBcsChecks.IsCatalogStatusCrawling | AmBcsChecks.IsPassiveCopy | AmBcsChecks.IsSeedingSource | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderPreferredLimit | amBcsChecks10); } if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsCatalogStatusHealthy | AmBcsChecks.ReplayQueueLength | AmBcsChecks.IsPassiveCopy | AmBcsChecks.IsSeedingSource | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderPreferredLimit | amBcsChecks10); } if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.ReplayQueueLength | AmBcsChecks.IsCatalogStatusCrawling | AmBcsChecks.IsPassiveCopy | AmBcsChecks.IsSeedingSource | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderPreferredLimit | amBcsChecks10); } if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.ReplayQueueLength | AmBcsChecks.IsPassiveCopy | AmBcsChecks.IsSeedingSource | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderHighestLimit | amBcsChecks10); } if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsCatalogStatusHealthy | AmBcsChecks.CopyQueueLength | AmBcsChecks.IsPassiveCopy | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderHighestLimit | amBcsChecks10); } if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.CopyQueueLength | AmBcsChecks.IsCatalogStatusCrawling | AmBcsChecks.IsPassiveCopy | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderHighestLimit | amBcsChecks10); } if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsCatalogStatusHealthy | AmBcsChecks.IsPassiveCopy | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderHighestLimit | amBcsChecks10); } if (amServerName == null) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsCatalogStatusCrawling | AmBcsChecks.IsPassiveCopy | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.ActivationEnabled | AmBcsChecks.MaxActivesUnderHighestLimit | amBcsChecks10); } if (amServerName == null && amBcsChecks10 == AmBcsChecks.None) { amServerName = this.RunPhaseN(AmBcsChecks.IsHealthyOrDisconnected | AmBcsChecks.IsPassiveCopy | AmBcsChecks.TotalQueueLengthMaxAllowed | AmBcsChecks.MaxActivesUnderHighestLimit | amBcsChecks10); } if (amServerName != null) { break; } } } IL_2FA :; } finally { if (!AmServerName.IsNullOrEmpty(amServerName)) { this.AddAttemptedServer(amServerName); } } if (this.m_attemptedServers == null || this.m_attemptedServers.Count == 0) { AmTrace.Error("FindNextBestCopy: Database '{0}' has no possible copies for activation.", new object[] { this.m_bcsContext.GetDatabaseNameOrGuid() }); if (this.Context.ErrorLogger.GetLastException() == null) { Exception ex = new AmDbNotMountedNoViableServersException(this.m_bcsContext.GetDatabaseNameOrGuid()); this.m_lastException = new AmBcsSelectionException(ex.Message, ex); } } return(amServerName); }
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); }