// Token: 0x060006D8 RID: 1752 RVA: 0x00020D4F File Offset: 0x0001EF4F private void ReportServerBlocked(AmBcsServerChecks checkFailed, LocalizedString error) { if (this.ErrorLogger != null) { this.ErrorLogger.ReportServerFailure(this.ServerToCheck, checkFailed.ToString(), error); } }
private List <AmServerName> DetermineServersToContact() { Guid guid = this.Database.Guid; IADDatabase db = this.Database; IADDatabaseCopy[] databaseCopies = AmBestCopySelectionHelper.GetDatabaseCopies(guid, ref db); if (db != null) { this.Database = db; } AmConfig amConfig = AmSystemManager.Instance.Config; if (amConfig.IsUnknown) { AmTrace.Error("AmMultiNodeRpcNotifier: DB {0}: Invalid AM configuration", new object[] { db.Name }); throw new AmInvalidConfiguration(amConfig.LastError ?? string.Empty); } IAmBcsErrorLogger errorLogger = new AmBcsSingleCopyFailureLogger(); AmBcsServerChecks checksToRun = AmBcsServerChecks.ClusterNodeUp; if (this.ActionCode.IsAutomaticOperation) { checksToRun |= AmBcsServerChecks.DebugOptionDisabled; } IEnumerable <AmServerName> source = from dbCopy in databaseCopies where this.ValidateServer(new AmServerName(dbCopy.HostServerName), db, amConfig, checksToRun, errorLogger) select new AmServerName(dbCopy.HostServerName); return(source.ToList <AmServerName>()); }
public void ChangeActiveServerForThirdParty(string newActiveServerName, TimeSpan lockTimeout) { using (AmDatabaseOperationLock.Lock(base.DatabaseGuid, AmDbLockReason.Move, new TimeSpan?(lockTimeout))) { if (!base.State.IsAdminDismounted) { throw new ChangeActiveServerException(base.DatabaseGuid, newActiveServerName, ReplayStrings.TPRChangeFailedBecauseNotDismounted); } AmServerName activeServer = base.State.ActiveServer; AmServerName amServerName = new AmServerName(newActiveServerName); if (activeServer.Equals(amServerName)) { throw new ChangeActiveServerException(base.DatabaseGuid, newActiveServerName, ReplayStrings.TPRChangeFailedBecauseAlreadyActive(activeServer.ToString())); } IAmBcsErrorLogger errorLogger = new AmBcsSingleCopyFailureLogger(); AmBcsServerChecks checks = AmBcsServerChecks.DebugOptionDisabled | AmBcsServerChecks.ClusterNodeUp | AmBcsServerChecks.DatacenterActivationModeStarted | AmBcsServerChecks.AutoActivationAllowed; LocalizedString empty = LocalizedString.Empty; AmBcsServerValidation amBcsServerValidation = new AmBcsServerValidation(amServerName, activeServer, base.Database, base.Config, errorLogger, null); if (!amBcsServerValidation.RunChecks(checks, ref empty)) { AmTrace.Error("ChangeActiveServerForThirdParty: DB {0}: ValidateServer() returned error: {1}", new object[] { base.DatabaseName, empty }); throw new ChangeActiveServerException(base.DatabaseGuid, newActiveServerName, ReplayStrings.TPRChangeFailedServerValidation(base.DatabaseName, newActiveServerName, empty)); } base.WriteStateMountSkipped(amServerName); this.UpdateAdProperties(true, activeServer); ReplayCrimsonEvents.TPRChangeActiveServerSucceeded.Log <string, Guid, AmServerName, AmServerName>(base.DatabaseName, base.DatabaseGuid, activeServer, amServerName); } }
protected override DatabaseValidationCheck.Result ValidateInternal(DatabaseValidationCheck.Arguments args, ref LocalizedString error) { error = LocalizedString.Empty; AmBcsServerChecks checks = AmBcsServerChecks.DatacenterActivationModeStarted | AmBcsServerChecks.AutoActivationAllowed; AmBcsServerValidation amBcsServerValidation = new AmBcsServerValidation(args.TargetServer, args.ActiveServer, args.Database, null, null, args.ADConfig); if (!amBcsServerValidation.RunChecks(checks, ref error)) { return(DatabaseValidationCheck.Result.Failed); } return(DatabaseValidationCheck.Result.Passed); }
// Token: 0x060006D1 RID: 1745 RVA: 0x00020968 File Offset: 0x0001EB68 public static AmBcsServerChecks GetServerValidationChecks(AmDbActionCode actionCode, bool isServerSpecifiedByAdmin) { AmBcsServerChecks result = AmBcsServerChecks.DebugOptionDisabled | AmBcsServerChecks.ClusterNodeUp | AmBcsServerChecks.DatacenterActivationModeStarted | AmBcsServerChecks.AutoActivationAllowed; if (actionCode.IsAdminMoveOperation) { result = (isServerSpecifiedByAdmin ? (AmBcsServerChecks.ClusterNodeUp | AmBcsServerChecks.DatacenterActivationModeStarted) : (AmBcsServerChecks.ClusterNodeUp | AmBcsServerChecks.DatacenterActivationModeStarted | AmBcsServerChecks.AutoActivationAllowed)); } else if (actionCode.IsAdminMountOperation) { result = (AmBcsServerChecks.ClusterNodeUp | AmBcsServerChecks.DatacenterActivationModeStarted); } return(result); }
// Token: 0x060006D2 RID: 1746 RVA: 0x00020998 File Offset: 0x0001EB98 public bool RunChecks(AmBcsServerChecks checks, ref LocalizedString error) { bool flag = true; error = LocalizedString.Empty; if (flag && AmBcsServerValidation.ShouldRunCheck(checks, AmBcsServerChecks.DebugOptionDisabled)) { flag = this.CheckDebugOption(ref error); } if (flag && AmBcsServerValidation.ShouldRunCheck(checks, AmBcsServerChecks.DatacenterActivationModeStarted)) { flag = this.IsServerStartedForDACMode(ref error); } if (flag && AmBcsServerValidation.ShouldRunCheck(checks, AmBcsServerChecks.ClusterNodeUp)) { flag = this.IsClusterNodeUp(ref error); } if (flag && AmBcsServerValidation.ShouldRunCheck(checks, AmBcsServerChecks.AutoActivationAllowed)) { flag = this.IsAutoActivationAllowed(ref error); } return(flag); }
// 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); }
private bool ValidateServer(AmServerName serverName, IADDatabase db, AmConfig amConfig, AmBcsServerChecks checksToRun, IAmBcsErrorLogger errorLogger) { if (serverName.IsLocalComputerName) { return(true); } LocalizedString empty = LocalizedString.Empty; AmBcsServerValidation amBcsServerValidation = new AmBcsServerValidation(serverName, null, db, amConfig, errorLogger, null); bool flag = amBcsServerValidation.RunChecks(checksToRun, ref empty); if (!flag) { AmTrace.Error("AmMultiNodeRpcNotifier: DB {0}: ValidateServer() returned error: {1}", new object[] { db.Name, empty }); } return(flag); }
// Token: 0x060006D3 RID: 1747 RVA: 0x00020A03 File Offset: 0x0001EC03 private static bool ShouldRunCheck(AmBcsServerChecks checksToRun, AmBcsServerChecks checkInQuestion) { return((checksToRun & checkInQuestion) == checkInQuestion); }
// 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); }