// Token: 0x060006F5 RID: 1781 RVA: 0x0002140C File Offset: 0x0001F60C private List <AmServerName> DetermineServersToContact() { AmServerName sourceServerName = this.m_bcsContext.SourceServerName; IADDatabase database = this.m_bcsContext.Database; AmConfig amConfig = this.m_amConfig; this.PopulateDatabaseCopiesIfNecessary(); List <AmServerName> list = new List <AmServerName>(this.m_dbCopies.Length); string name = database.Name; LocalizedString empty = LocalizedString.Empty; AmBcsServerChecks serverValidationChecks = AmBcsServerValidation.GetServerValidationChecks(this.m_bcsContext.ActionCode, false); foreach (IADDatabaseCopy iaddatabaseCopy in this.m_dbCopies) { AmServerName amServerName = new AmServerName(iaddatabaseCopy.HostServerName); AmBcsServerValidation amBcsServerValidation = new AmBcsServerValidation(amServerName, sourceServerName, database, amConfig, this.m_bcsContext.ErrorLogger, null); if (amBcsServerValidation.RunChecks(serverValidationChecks, ref empty)) { list.Add(amServerName); } } return(list); }
// 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); }