// Token: 0x0600241E RID: 9246 RVA: 0x000A8F28 File Offset: 0x000A7128 private void CheckServerForCopy(IADDatabase db, string serverName) { AmServerName amServerName = new AmServerName(serverName); IADDatabaseCopy dbCopy = null; Exception ex = this.DoADAction(delegate(object param0, EventArgs param1) { foreach (IADDatabaseCopy iaddatabaseCopy in db.DatabaseCopies) { if (MachineName.Comparer.Equals(iaddatabaseCopy.HostServerName, amServerName.NetbiosName)) { dbCopy = iaddatabaseCopy; return; } } }); if (dbCopy != null) { return; } ExTraceGlobals.ThirdPartyManagerTracer.TraceDebug(0L, "CheckServerForCopy:no copy of {0} guid={1} on {2}. Ex={3}", new object[] { db.Name, db.Guid, serverName, ex }); if (ex == null) { throw new NoCopyOnServerException(db.Guid, db.Name, serverName); } throw ex; }
// Token: 0x060007AC RID: 1964 RVA: 0x00024EE0 File Offset: 0x000230E0 public static List <AmDatabaseMoveResult> Move(AmDbMoveArguments moveArgs) { List <AmDatabaseMoveResult> result; using (BatchDatabaseOperation batchDatabaseOperation = new BatchDatabaseOperation()) { IADConfig adconfig = Dependencies.ADConfig; IEnumerable <IADDatabase> databasesOnServer = adconfig.GetDatabasesOnServer(moveArgs.TargetServer); AmConfig config = AmSystemManager.Instance.Config; foreach (IADDatabase iaddatabase in databasesOnServer) { IADDatabaseCopy databaseCopy = iaddatabase.GetDatabaseCopy(moveArgs.TargetServer.NetbiosName); if (databaseCopy != null && iaddatabase.ReplicationType == ReplicationType.Remote && databaseCopy.ActivationPreference == 1 && !MoveBackToServer.IsAlreadyOnTarget(iaddatabase, moveArgs.TargetServer, config)) { batchDatabaseOperation.AddOperation(new AmDbMoveOperation(iaddatabase, moveArgs.ActionCode) { Arguments = moveArgs }); } } batchDatabaseOperation.DispatchOperations(); batchDatabaseOperation.WaitForComplete(); List <AmDbOperation> completedOperationList = batchDatabaseOperation.GetCompletedOperationList(); List <AmDatabaseMoveResult> list = new List <AmDatabaseMoveResult>(completedOperationList.Count); foreach (AmDbOperation amDbOperation in completedOperationList) { if (amDbOperation.DetailedStatus != null) { list.Add(amDbOperation.ConvertDetailedStatusToRpcMoveResult(amDbOperation.DetailedStatus)); } } result = list; } return(result); }
private IADDatabaseCopy GetDatabaseCopy(IADDatabase db, AmServerName server) { IADDatabaseCopy databaseCopy = db.GetDatabaseCopy(server.NetbiosName); if (databaseCopy == null || !databaseCopy.IsValid) { throw new RlmDatabaseCopyInvalidException(db.Name, server.NetbiosName); } return(databaseCopy); }
// Token: 0x06001505 RID: 5381 RVA: 0x0005356C File Offset: 0x0005176C private IADDatabaseCopy GetDatabaseCopyFromDb(IADDatabase database, IADDatabaseCopy dbCopy) { foreach (IADDatabaseCopy iaddatabaseCopy in database.AllDatabaseCopies) { if (iaddatabaseCopy.Guid.Equals(dbCopy.Guid)) { return(iaddatabaseCopy); } } return(null); }
private void ProcessDatabaseInternal(IADDatabase db, IMonitoringADConfig adConfig) { if (db.ReplicationType != ReplicationType.Remote) { ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Database '{0}' is not a replicated database. Skipping this database.", db.Name); return; } IADDatabaseCopy databaseCopy = this.GetDatabaseCopy(db, AmServerName.LocalComputerName); EnhancedTimeSpan replayLagTime = databaseCopy.ReplayLagTime; if (replayLagTime == EnhancedTimeSpan.Zero) { ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' is not a lag copy. Skipping this database.", db.Name); return; } ReplayLagManager.Tracer.TraceDebug <string, EnhancedTimeSpan>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' is a lag copy. Configured lag: {1}. Processing this database.", db.Name, replayLagTime); DatabaseAvailabilityValidator databaseAvailabilityValidator = new DatabaseAvailabilityValidator(db, ReplayLagManager.NUM_AVAILABLE_NONLAG_COPIES_MIN, this.m_statusLookup, adConfig, null, true); IHealthValidationResult healthValidationResult = databaseAvailabilityValidator.Run(); int num = ReplayLagManager.NUM_AVAILABLE_NONLAG_COPIES_MIN; if (healthValidationResult.IsTargetCopyHealthy) { num++; ReplayLagManager.Tracer.TraceDebug <string, int>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local lag-copy of Database '{0}' is available. Increasing the minimum available copy count to: {1}", db.Name, num); } CopyStatusClientCachedEntry targetCopyStatus = healthValidationResult.TargetCopyStatus; if (healthValidationResult.HealthyCopiesCount >= num) { ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' has met availability critera. Replay Lag will be re-instated as necessary.", db.Name); if (this.m_errorSuppression.ReportSuccess(db.Guid, ReplayLagManager.EnableLagSuppressionWindow)) { this.EnableReplayLag(db, targetCopyStatus); return; } ReplayLagManager.Tracer.TraceDebug <string, double>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: '{0}': Skipping EnableReplayLag() due to transient suppression of {1} secs", db.Name, ReplayLagManager.EnableLagSuppressionWindow.TotalSeconds); return; } else { ReplayLagManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: Local copy of Database '{0}' has *NOT* met availability critera. Replay Lag will be played down as necessary.", db.Name); string errorMessageWithoutFullStatus = healthValidationResult.ErrorMessageWithoutFullStatus; if (this.m_errorSuppression.ReportFailure(db.Guid, ReplayLagManager.DisableLagSuppressionWindow)) { this.DisableReplayLag(db, targetCopyStatus, errorMessageWithoutFullStatus); return; } ReplayLagManager.Tracer.TraceDebug <string, double>((long)this.GetHashCode(), "ReplayLagManager.ProcessDatabase: '{0}': Skipping DisableReplayLag() due to transient suppression of {1} secs", db.Name, ReplayLagManager.DisableLagSuppressionWindow.TotalSeconds); ReplayCrimsonEvents.RLMDisableReplayLagRequestSuppressed.LogPeriodic <string, string, Guid, string, TimeSpan>(Environment.MachineName, DateTimeHelper.FourHours, db.Name, Environment.MachineName, db.Guid, errorMessageWithoutFullStatus, ReplayLagManager.DisableLagSuppressionWindow); return; } }
// Token: 0x06000C45 RID: 3141 RVA: 0x000365B8 File Offset: 0x000347B8 private RemoteReplayConfiguration(IADDatabaseAvailabilityGroup dag, IADDatabase database, IADServer server, string activeFqdn, LockType lockType, ReplayConfigType type) { try { if (database == null) { throw new NullDatabaseException(); } if (server == null) { throw new ErrorNullServerFromDb(database.Name); } if (activeFqdn == null) { throw new ArgumentException("Caller must provide the active node"); } IADDatabaseCopy databaseCopy = database.GetDatabaseCopy(server.Name); if (databaseCopy == null) { throw new NullDbCopyException(); } this.m_server = server; this.m_database = database; this.m_targetNodeFqdn = server.Fqdn; this.m_sourceNodeFqdn = activeFqdn; this.m_type = type; this.m_autoDatabaseMountDial = this.m_server.AutoDatabaseMountDial; if (type == ReplayConfigType.RemoteCopyTarget) { this.m_replayState = ReplayState.GetReplayState(this.m_targetNodeFqdn, this.m_sourceNodeFqdn, lockType, this.Identity, this.Database.Name); } else { this.m_replayState = ReplayState.GetReplayState(this.m_sourceNodeFqdn, this.m_sourceNodeFqdn, lockType, this.Identity, this.Database.Name); } this.m_replayLagTime = databaseCopy.ReplayLagTime; this.m_truncationLagTime = databaseCopy.TruncationLagTime; this.m_activationPreference = databaseCopy.ActivationPreference; base.PopulatePropertiesFromDag(dag); } finally { this.BuildDebugString(); } }
// Token: 0x06000C44 RID: 3140 RVA: 0x0003651C File Offset: 0x0003471C public static bool IsServerValidRcrTarget(IADDatabase database, IADServer server, out int maxDB, string sourceDomain, bool fThrow) { maxDB = 0; if (server == null) { throw new ArgumentNullException("server"); } if (server.IsMailboxServer) { if (server.Edition == ServerEditionType.Enterprise || server.Edition == ServerEditionType.EnterpriseEvaluation) { maxDB = 100; } else { maxDB = 5; } IADDatabaseCopy[] databaseCopies = database.DatabaseCopies; int i = 0; while (i < databaseCopies.Length) { IADDatabaseCopy iaddatabaseCopy = databaseCopies[i]; if (string.Equals(iaddatabaseCopy.HostServerName, server.Name)) { if (fThrow) { throw new InvalidRcrConfigAlreadyHostsDb(server.Name, database.Name); } return(false); } else { i++; } } return(true); } if (fThrow) { throw new InvalidRcrConfigOnNonMailboxException(server.Name); } return(false); }
// Token: 0x06001511 RID: 5393 RVA: 0x00053854 File Offset: 0x00051A54 protected virtual IEnumerable <IADDatabaseCopy> LookupDatabaseCopies(IADServer miniServer) { MonitoringADConfig.Tracer.TraceDebug <string>((long)this.GetHashCode(), "LookupDatabases ( {0} ): Searching for all valid/invalid database copies...", miniServer.Name); IEnumerable <IADDatabaseCopy> dbCopies = null; IADToplogyConfigurationSession adSession = this.AdSessionPartiallyConsistent; Exception ex = ADUtils.RunADOperation(delegate() { dbCopies = adSession.GetAllDatabaseCopies(miniServer); }, 2); if (ex != null) { MonitoringADConfig.Tracer.TraceError <string, string>((long)this.GetHashCode(), "LookupDatabases ( {0} ): Got exception: {1}", miniServer.Name, AmExceptionHelper.GetExceptionToStringOrNoneString(ex)); throw new MonitoringCouldNotFindDatabasesException(miniServer.Name, ex.Message, ex); } if (dbCopies == null) { dbCopies = new IADDatabaseCopy[0]; } return(dbCopies); }
// Token: 0x06001510 RID: 5392 RVA: 0x00053808 File Offset: 0x00051A08 protected virtual IADDatabase LookupDatabaseFromCopy(IADDatabaseCopy dbCopy) { return(this.AdLookup.DatabaseLookup.ReadAdObjectByObjectId(dbCopy.Id.Parent)); }
// Token: 0x060011CA RID: 4554 RVA: 0x00049F40 File Offset: 0x00048140 public void PossiblyReportObjectsNotFoundInAD(IMonitoringADConfig adConfig) { base.WriterLockedOperation(delegate { List <AmServerName> list = new List <AmServerName>(); List <Guid> list2 = new List <Guid>(); List <Tuple <DbHealthInfo, DbCopyHealthInfo> > list3 = new List <Tuple <DbHealthInfo, DbCopyHealthInfo> >(); foreach (ServerHealthInfo serverHealthInfo in this.m_serverInfos.Values) { if (adConfig.LookupMiniServerByName(serverHealthInfo.ServerName) == null) { this.ReportTransition(serverHealthInfo.ServerFoundInAD, false); if (this.IsADObjectMissingTooLong(serverHealthInfo.ServerFoundInAD.FailedDuration)) { list.Add(serverHealthInfo.ServerName); } } } foreach (KeyValuePair <Guid, DbHealthInfo> keyValuePair in this.m_dbServerInfos) { Guid key = keyValuePair.Key; DbHealthInfo value = keyValuePair.Value; IADDatabase iaddatabase = null; bool flag = true; if (adConfig.DatabaseByGuidMap.TryGetValue(key, out iaddatabase)) { flag = false; } foreach (DbCopyHealthInfo dbCopyHealthInfo in value.DbServerInfos.Values) { bool flag2 = true; if (!flag) { IADDatabaseCopy databaseCopy = iaddatabase.GetDatabaseCopy(dbCopyHealthInfo.ServerName.NetbiosName); if (databaseCopy != null) { flag2 = false; } } if (flag2) { this.ReportTransition(dbCopyHealthInfo.CopyFoundInAD, false); if (this.IsADObjectMissingTooLong(dbCopyHealthInfo.CopyFoundInAD.FailedDuration)) { list3.Add(new Tuple <DbHealthInfo, DbCopyHealthInfo>(value, dbCopyHealthInfo)); } } } if (flag) { this.ReportTransition(value.DbFoundInAD, false); if (this.IsADObjectMissingTooLong(value.DbFoundInAD.FailedDuration)) { list2.Add(key); } } } if (list.Count > 0) { foreach (AmServerName key2 in list) { this.m_serverInfos.Remove(key2); } } if (list3.Count > 0) { foreach (Tuple <DbHealthInfo, DbCopyHealthInfo> tuple in list3) { tuple.Item1.RemoveDbCopy(tuple.Item2.ServerName); } } if (list2.Count > 0) { foreach (Guid key3 in list2) { this.m_dbServerInfos.Remove(key3); } } }); }