public static List <string> GetServersWithServerRoleInSite(string serverName, ServerRole serverRole) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); IADServer iadserver = null; if (!string.IsNullOrEmpty(serverName)) { if (!SharedHelper.StringIEquals(serverName, "localhost")) { goto IL_2F; } } try { iadserver = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName); goto IL_5A; } catch (LocalServerNotFoundException) { goto IL_5A; } IL_2F: string nodeNameFromFqdn = MachineName.GetNodeNameFromFqdn(serverName); iadserver = iadtoplogyConfigurationSession.FindServerByName(nodeNameFromFqdn); string arg = "FindServerByName"; if (iadserver == null) { ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <string, string>(0L, "GetServersWithServerRoleInSite: {0} didn't find any server for {1}", arg, serverName); } IL_5A: return(ReplayConfiguration.GetServersWithServerRoleInSiteByServer(iadserver, serverRole)); }
private ActiveManager(bool enableRpcCaching, IFindAdObject <IADDatabaseAvailabilityGroup> dagLookup, IFindAdObject <IADServer> serverLookup, IFindMiniServer miniServerLookup, IFindAdObject <IADClientAccessArray> casLookup, IFindMiniClientAccessServerOrArray miniCasArrayLookup, IFindAdObject <IADDatabase> databaseLookup, ITopologyConfigurationSession adSession, bool isService) { ExTraceGlobals.ActiveManagerClientTracer.TraceDebug <bool>((long)this.GetHashCode(), "Active Manager is instantiated (cacheEnabled={0})", enableRpcCaching); if (adSession == null) { throw new ArgumentNullException("adSession"); } IADToplogyConfigurationSession adSession2 = ADSessionFactory.CreateWrapper(adSession); this.m_isCacheEnabled = enableRpcCaching; this.m_adSession = adSession; this.m_disposeTracker = this.GetDisposeTracker(); if (this.m_isCacheEnabled) { this.m_dagLookup = (dagLookup ?? new AdObjectLookupCache <IADDatabaseAvailabilityGroup>(adSession2, AdObjectLookupCache <IADDatabaseAvailabilityGroup> .TimeToLive, AdObjectLookupCache <IADDatabaseAvailabilityGroup> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabaseAvailabilityGroup> .AdOperationTimeout)); this.m_casLookup = (casLookup ?? new AdObjectLookupCache <IADClientAccessArray>(adSession2, AdObjectLookupCache <IADClientAccessArray> .TimeToLive, AdObjectLookupCache <IADClientAccessArray> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADClientAccessArray> .AdOperationTimeout)); this.m_miniServerLookup = (miniServerLookup ?? new MiniServerLookupCache(adSession2, MiniServerLookupCache.TimeToLive, MiniServerLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniServerLookupCache.AdOperationTimeout)); this.m_miniCasArrayLookup = (miniCasArrayLookup ?? new MiniClientAccessServerOrArrayLookupCache(this.m_adSession, MiniClientAccessServerOrArrayLookupCache.TimeToLive, MiniClientAccessServerOrArrayLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniClientAccessServerOrArrayLookupCache.AdOperationTimeout)); this.m_databaseLookup = (databaseLookup ?? new AdObjectLookupCache <IADDatabase>(adSession2, AdObjectLookupCache <IADDatabase> .TimeToLive, AdObjectLookupCache <IADDatabase> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabase> .AdOperationTimeout)); if (!isService) { this.EnableMinimization(); } } else { this.m_dagLookup = (dagLookup ?? new SimpleAdObjectLookup <IADDatabaseAvailabilityGroup>(adSession2)); this.m_casLookup = (casLookup ?? new SimpleAdObjectLookup <IADClientAccessArray>(adSession2)); this.m_miniServerLookup = (miniServerLookup ?? new SimpleMiniServerLookup(adSession2)); this.m_miniCasArrayLookup = (miniCasArrayLookup ?? new SimpleMiniClientAccessServerOrArrayLookup(this.m_adSession)); this.m_databaseLookup = (databaseLookup ?? new SimpleAdObjectLookup <IADDatabase>(adSession2)); } this.CacheUpdateInterval = new TimeSpan(0, 0, 60); this.m_isRunningInService = isService; }
// Token: 0x060000AB RID: 171 RVA: 0x00004F20 File Offset: 0x00003120 protected override void RunInternal() { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); IADServer iadserver = iadtoplogyConfigurationSession.FindServerByName(this.m_nodeName.NetbiosName); if (iadserver == null) { throw new ServerNotFoundException(this.m_nodeName.NetbiosName); } IADDatabase[] array = iadtoplogyConfigurationSession.GetAllDatabases(iadserver).ToArray <IADDatabase>(); if (array.Length <= 0) { AmTrace.Info("Server '{0}' does not have any databases that needs to be marked as dismounted", new object[] { this.m_nodeName }); return; } AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, this.m_reasonCode, AmDbActionCategory.SyncState); foreach (IADDatabase db in array) { AmDbClusterDatabaseSyncOperation operation = new AmDbClusterDatabaseSyncOperation(db, actionCode); this.m_clusDbSyncRequests++; base.EnqueueDatabaseOperation(operation); } base.StartDatabaseOperations(); }
internal static void UpdateServerLegdnForDatabaseSite(Task.TaskErrorLoggingDelegate writeErrorDelegate, Task.TaskVerboseLoggingDelegate writeVerboseDelegate, ITopologyConfigurationSession adSession, DatabaseCopy dbCopy) { ADObjectId hostServer = dbCopy.HostServer; PropertyDefinition[] properties = new PropertyDefinition[] { ServerSchema.ServerSite }; MiniServer miniServer = adSession.ReadMiniServer(hostServer, properties); if (miniServer == null) { writeErrorDelegate(new ADServerNotFoundException(hostServer.ToString()), ErrorCategory.InvalidArgument, null); } IADToplogyConfigurationSession adSession2 = ADSessionFactory.CreateWrapper(adSession); SimpleAdObjectLookup <IADClientAccessArray> findClientAccessArray = new SimpleAdObjectLookup <IADClientAccessArray>(adSession2); SimpleMiniClientAccessServerOrArrayLookup findMiniClientAccessServer = new SimpleMiniClientAccessServerOrArrayLookup(adSession); ADObjectId serverSite = miniServer.ServerSite; LegacyDN legacyDN = ActiveManagerImplementation.FindClientAccessArrayOrServerFromSite(serverSite, miniServer.Id, findClientAccessArray, findMiniClientAccessServer, AdObjectLookupFlags.ReadThrough); ADObjectId parent = dbCopy.Id.Parent; Database database = adSession.Read <Database>(parent); if (legacyDN != null) { LegacyDN databaseLegacyDNFromRcaLegacyDN = Database.GetDatabaseLegacyDNFromRcaLegacyDN(legacyDN, database.IsPublicFolderDatabase); database.ExchangeLegacyDN = databaseLegacyDNFromRcaLegacyDN.ToString(); writeVerboseDelegate(Strings.UpdatingLegDnForDatabaseToServer(database.Name, legacyDN.ToString(), legacyDN.ToString())); adSession.Save(database); return; } ExTraceGlobals.CmdletsTracer.TraceDebug <ADObjectId>(0L, "Could not find a new CAS machines for site '{0}'. Leaving the database's legdn unchanged.", serverSite); }
public static void TaskConstructAllDatabaseConfigurations(IADDatabaseAvailabilityGroup dag, IADServer server, out List <ReplayConfiguration> activeConfigurations, out List <ReplayConfiguration> passiveConfigurations) { activeConfigurations = new List <ReplayConfiguration>(20); passiveConfigurations = new List <ReplayConfiguration>(48); ActiveManager noncachingActiveManagerInstance = ActiveManager.GetNoncachingActiveManagerInstance(); IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); IEnumerable <IADDatabase> allDatabases = iadtoplogyConfigurationSession.GetAllDatabases(server); if (allDatabases != null) { foreach (IADDatabase mdb in allDatabases) { bool flag; Exception ex; ReplayConfiguration replayConfiguration = ReplayConfiguration.GetReplayConfiguration(dag, mdb, server, noncachingActiveManagerInstance, out flag, out ex); if (replayConfiguration != null) { if (flag) { activeConfigurations.Add(replayConfiguration); } else { passiveConfigurations.Add(replayConfiguration); } } } } }
public static IADDatabaseAvailabilityGroup GetLocalServerDatabaseAvailabilityGroup(out string errorMessage) { IADDatabaseAvailabilityGroup iaddatabaseAvailabilityGroup = null; Exception ex = null; errorMessage = string.Empty; try { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); IADServer iadserver = iadtoplogyConfigurationSession.FindServerByName(Dependencies.ManagementClassHelper.LocalMachineName); if (iadserver != null) { iaddatabaseAvailabilityGroup = iadtoplogyConfigurationSession.FindDagByServer(iadserver); if (iaddatabaseAvailabilityGroup == null) { ex = new CouldNotFindDagObjectForServer(iadserver.Name); } } else { ex = new CouldNotFindServerObject(Environment.MachineName); } } catch (ADTransientException ex2) { AmTrace.Error("GetLocalServerDatabaseAvailabilityGroup got exception: {0}", new object[] { ex2 }); ex = ex2; } catch (ADExternalException ex3) { AmTrace.Error("GetLocalServerDatabaseAvailabilityGroup got exception: {0}", new object[] { ex3 }); ex = ex3; } catch (ADOperationException ex4) { AmTrace.Error("GetLocalServerDatabaseAvailabilityGroup got exception: {0}", new object[] { ex4 }); ex = ex4; } if (iaddatabaseAvailabilityGroup == null) { errorMessage = ex.Message; if (string.IsNullOrEmpty(errorMessage)) { errorMessage = ex.ToString(); } } return(iaddatabaseAvailabilityGroup); }
public void DoDumpsterRedeliveryIfRequired(Guid dbGuid) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true); IADDatabase db = iadtoplogyConfigurationSession.FindDatabaseByGuid(dbGuid); IADServer server = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName); IADDatabaseAvailabilityGroup dag = iadtoplogyConfigurationSession.FindDagByServer(server); ReplayConfiguration replayConfig = RemoteReplayConfiguration.TaskGetReplayConfig(dag, db, server); DumpsterRedeliveryWrapper.DoRedeliveryIfRequired(replayConfig); }
public void TriggerDumpsterEx(Guid dbGuid, bool fTriggerSafetyNet, DateTime failoverTimeUtc, DateTime startTimeUtc, DateTime endTimeUtc, long lastLogGenBeforeActivation, long numLogsLost) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true); IADDatabase db = iadtoplogyConfigurationSession.FindDatabaseByGuid(dbGuid); IADServer server = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName); IADDatabaseAvailabilityGroup dag = iadtoplogyConfigurationSession.FindDagByServer(server); ReplayConfiguration configuration = RemoteReplayConfiguration.TaskGetReplayConfig(dag, db, server); DumpsterRedeliveryWrapper.MarkRedeliveryRequired(configuration, failoverTimeUtc, startTimeUtc, endTimeUtc, lastLogGenBeforeActivation, numLogsLost); }
public void TriggerDumpster(Guid dbGuid, DateTime inspectorTime) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true); IADDatabase db = iadtoplogyConfigurationSession.FindDatabaseByGuid(dbGuid); IADServer server = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName); IADDatabaseAvailabilityGroup dag = iadtoplogyConfigurationSession.FindDagByServer(server); ReplayConfiguration configuration = RemoteReplayConfiguration.TaskGetReplayConfig(dag, db, server); DumpsterRedeliveryWrapper.MarkRedeliveryRequired(configuration, inspectorTime, 0L, 0L); }
internal ADConfigLookupComponent() { IReplayAdObjectLookup replayAdObjectLookup = Dependencies.ReplayAdObjectLookup; IReplayAdObjectLookup replayAdObjectLookupPartiallyConsistent = Dependencies.ReplayAdObjectLookupPartiallyConsistent; this.AdSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); this.AdSessionPartiallyConsistent = ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true); this.ADConfigManager = new MonitoringADConfigManager(replayAdObjectLookup, replayAdObjectLookupPartiallyConsistent, this.AdSession, this.AdSessionPartiallyConsistent); Dependencies.Container.RegisterInstance <IMonitoringADConfigProvider>(this.ADConfigManager); }
// Token: 0x06000087 RID: 135 RVA: 0x000045F4 File Offset: 0x000027F4 protected IADDatabase[] GetDatabases() { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); IADServer iadserver = iadtoplogyConfigurationSession.FindServerByName(this.m_nodeName.NetbiosName); if (iadserver == null) { throw new ServerNotFoundException(this.m_nodeName.NetbiosName); } return(iadtoplogyConfigurationSession.GetAllDatabases(iadserver).ToArray <IADDatabase>()); }
protected void Initialize(ConsistencyMode adConsistencyMode) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(adConsistencyMode, ADSessionSettings.FromRootOrgScopeSet(), 92, "Initialize", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Replay\\Service\\NoncachingReplayAdObjectLookup.cs"); this.AdSession = topologyConfigurationSession; IADToplogyConfigurationSession adSession = ADSessionFactory.CreateWrapper(topologyConfigurationSession); this.DagLookup = new SimpleAdObjectLookup <IADDatabaseAvailabilityGroup>(adSession); this.DatabaseLookup = new SimpleAdObjectLookup <IADDatabase>(adSession); this.ServerLookup = new SimpleAdObjectLookup <IADServer>(adSession); this.MiniServerLookup = new SimpleMiniServerLookup(adSession); }
// Token: 0x06001E72 RID: 7794 RVA: 0x0008A730 File Offset: 0x00088930 protected void Initialize(ConsistencyMode adConsistencyMode) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(adConsistencyMode, ADSessionSettings.FromRootOrgScopeSet(), 101, "Initialize", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Replay\\Service\\ReplayAdObjectLookup.cs"); IADToplogyConfigurationSession adSession = ADSessionFactory.CreateWrapper(topologyConfigurationSession); TimeSpan timeToLive = TimeSpan.FromSeconds((double)RegistryParameters.AdObjectCacheHitTtlInSec); TimeSpan timeToNegativeLive = TimeSpan.FromSeconds((double)RegistryParameters.AdObjectCacheMissTtlInSec); this.AdSession = topologyConfigurationSession; this.DagLookup = new AdObjectLookupCache <IADDatabaseAvailabilityGroup>(adSession, timeToLive, timeToNegativeLive); this.DatabaseLookup = new AdObjectLookupCache <IADDatabase>(adSession, timeToLive, timeToNegativeLive); this.ServerLookup = new AdObjectLookupCache <IADServer>(adSession, timeToLive, timeToNegativeLive); this.MiniServerLookup = new MiniServerLookupCache(adSession, timeToLive, timeToNegativeLive); }
internal static void GetDatabaseNameAndPath(Guid databaseGuid, out string databaseName, out string databaseFilePath) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateFullyConsistentRootOrgSession(true); IADDatabase iaddatabase = iadtoplogyConfigurationSession.FindDatabaseByGuid(databaseGuid); databaseName = iaddatabase.Name; if (iaddatabase.EdbFilePath != null) { databaseFilePath = iaddatabase.EdbFilePath.ToString(); return; } databaseFilePath = null; }
public static ActiveManager CreateCustomActiveManager(bool cacheRpcRequests, IFindAdObject <IADDatabaseAvailabilityGroup> dagLookup, IFindAdObject <IADServer> serverLookup, IFindMiniServer miniServerLookup, IFindAdObject <IADClientAccessArray> casLookup, IFindMiniClientAccessServerOrArray miniCasArrayLookup, IFindAdObject <IADDatabase> databaseLookup, ITopologyConfigurationSession adSession, bool isService) { if (adSession == null) { adSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 1200, "CreateCustomActiveManager", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ActiveManager\\ActiveManager.cs"); } IADToplogyConfigurationSession adSession2 = ADSessionFactory.CreateWrapper(adSession); dagLookup = (dagLookup ?? new SimpleAdObjectLookup <IADDatabaseAvailabilityGroup>(adSession2)); serverLookup = (serverLookup ?? new SimpleAdObjectLookup <IADServer>(adSession2)); miniServerLookup = (miniServerLookup ?? new SimpleMiniServerLookup(adSession2)); casLookup = (casLookup ?? new SimpleAdObjectLookup <IADClientAccessArray>(adSession2)); miniCasArrayLookup = (miniCasArrayLookup ?? new SimpleMiniClientAccessServerOrArrayLookup(adSession)); databaseLookup = (databaseLookup ?? new SimpleAdObjectLookup <IADDatabase>(adSession2)); return(new ActiveManager(cacheRpcRequests, dagLookup, serverLookup, miniServerLookup, casLookup, miniCasArrayLookup, databaseLookup, adSession, isService)); }
public static ActiveManager GetNoncachingActiveManagerInstance() { if (ActiveManager.s_uncachedActiveManager == null) { lock (ActiveManager.s_singletonLock) { if (ActiveManager.s_uncachedActiveManager == null) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 1023, "GetNoncachingActiveManagerInstance", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ActiveManager\\ActiveManager.cs"); IADToplogyConfigurationSession adSession = ADSessionFactory.CreateWrapper(topologyConfigurationSession); ActiveManager.s_uncachedActiveManager = new ActiveManager(false, new SimpleAdObjectLookup <IADDatabaseAvailabilityGroup>(adSession), new SimpleAdObjectLookup <IADServer>(adSession), new SimpleMiniServerLookup(adSession), new SimpleAdObjectLookup <IADClientAccessArray>(adSession), new SimpleMiniClientAccessServerOrArrayLookup(topologyConfigurationSession), new SimpleAdObjectLookup <IADDatabase>(adSession), topologyConfigurationSession, false); ActiveManager.s_uncachedActiveManager.SuppressDisposeTracker(); } } } return(ActiveManager.s_uncachedActiveManager); }
public static ActiveManager GetCachingActiveManagerInstance() { if (ActiveManager.s_cachedActiveManager == null) { lock (ActiveManager.s_singletonLock) { if (ActiveManager.s_cachedActiveManager == null) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 1240, "GetCachingActiveManagerInstance", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ActiveManager\\ActiveManager.cs"); IADToplogyConfigurationSession adSession = ADSessionFactory.CreateWrapper(topologyConfigurationSession); TimeSpan timeSpan = new TimeSpan(0, 0, 45); ActiveManager.s_cachedActiveManager = new ActiveManager(true, new AdObjectLookupCache <IADDatabaseAvailabilityGroup>(adSession, timeSpan, timeSpan, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabaseAvailabilityGroup> .AdOperationTimeout), new AdObjectLookupCache <IADServer>(adSession, AdObjectLookupCache <IADServer> .TimeToLive, AdObjectLookupCache <IADServer> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADServer> .AdOperationTimeout), new MiniServerLookupCache(adSession, MiniServerLookupCache.TimeToLive, MiniServerLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniServerLookupCache.AdOperationTimeout), new AdObjectLookupCache <IADClientAccessArray>(adSession, AdObjectLookupCache <IADClientAccessArray> .TimeToLive, AdObjectLookupCache <IADClientAccessArray> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADClientAccessArray> .AdOperationTimeout), new MiniClientAccessServerOrArrayLookupCache(topologyConfigurationSession, MiniClientAccessServerOrArrayLookupCache.TimeToLive, MiniClientAccessServerOrArrayLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniClientAccessServerOrArrayLookupCache.AdOperationTimeout), new AdObjectLookupCache <IADDatabase>(adSession, AdObjectLookupCache <IADDatabase> .TimeToLive, AdObjectLookupCache <IADDatabase> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabase> .AdOperationTimeout), topologyConfigurationSession, false); ActiveManager.s_cachedActiveManager.SuppressDisposeTracker(); } } } return(ActiveManager.s_cachedActiveManager); }
private void CleanupStaleEntries(IClusterDB clusdb) { IMonitoringADConfig config = Dependencies.MonitoringADConfigProvider.GetConfig(true); HashSet <Guid> validDatabaseGuids; HashSet <Guid> databasesToBeDeleted = this.GetDatabasesToBeDeleted(config, clusdb, out validDatabaseGuids); Dictionary <Guid, IADServer> validServers; HashSet <Guid> serversToBeDeleted = this.GetServersToBeDeleted(config, clusdb, out validServers); if (databasesToBeDeleted.Count == 0 && serversToBeDeleted.Count == 0) { this.staleDatabases.Clear(); this.staleServers.Clear(); return; } IADToplogyConfigurationSession adSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); this.CleanupDatabases(adSession, clusdb, databasesToBeDeleted, validDatabaseGuids); this.CleanupServers(adSession, clusdb, serversToBeDeleted, validServers); }
// Token: 0x0600241D RID: 9245 RVA: 0x000A8E60 File Offset: 0x000A7060 private IADDatabase LookupDatabase(Guid databaseId) { IADDatabase db = null; Exception ex = this.DoADAction(delegate(object param0, EventArgs param1) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); db = iadtoplogyConfigurationSession.FindDatabaseByGuid(databaseId); }); if (db != null) { return(db); } ExTraceGlobals.ThirdPartyManagerTracer.TraceDebug <Guid, Exception>(0L, "LookupDatabase({0}) failed. Ex={1}", databaseId, ex); if (ex == null) { throw new NoSuchDatabaseException(databaseId); } throw ex; }
// Token: 0x0600002B RID: 43 RVA: 0x000024F0 File Offset: 0x000006F0 public static string ResolveFqdn(string shortNodeName, bool throwException) { string fqdn = null; Exception ex = SharedHelper.RunADOperationEx(delegate(object param0, EventArgs param1) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); iadtoplogyConfigurationSession.UseConfigNC = false; iadtoplogyConfigurationSession.UseGlobalCatalog = true; IADComputer iadcomputer = iadtoplogyConfigurationSession.FindComputerByHostName(shortNodeName); if (iadcomputer != null && !string.IsNullOrEmpty(iadcomputer.DnsHostName)) { fqdn = iadcomputer.DnsHostName; return; } if (throwException) { throw new AmGetFqdnFailedNotFoundException(shortNodeName); } AmTrace.Error("FQDN resolution of the short name {0} failed. Could not find valid DNS hostname from ADComputer query.", new object[] { shortNodeName }); fqdn = AmServerNameCache.GetFqdnWithLocalDomainSuffix(shortNodeName); }); if (ex != null) { if (throwException) { throw new AmGetFqdnFailedADErrorException(shortNodeName, ex.Message, ex); } AmTrace.Error("FQDN resolution of the short name {0} failed. Error: {1}", new object[] { shortNodeName, ex.Message }); fqdn = AmServerNameCache.GetFqdnWithLocalDomainSuffix(shortNodeName); } return(fqdn); }
public static IADDatabaseAvailabilityGroup GetLocalServerDatabaseAvailabilityGroup(IADToplogyConfigurationSession adSession, out Exception exception) { IADDatabaseAvailabilityGroup dag = null; Exception objNotFoundEx = null; exception = null; exception = SharedHelper.RunADOperationEx(delegate(object param0, EventArgs param1) { if (adSession == null) { adSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); } if (adSession != null) { IADServer iadserver = adSession.FindServerByName(SharedDependencies.ManagementClassHelper.LocalMachineName); if (iadserver != null) { ADObjectId databaseAvailabilityGroup = iadserver.DatabaseAvailabilityGroup; if (databaseAvailabilityGroup != null) { dag = adSession.ReadADObject <IADDatabaseAvailabilityGroup>(databaseAvailabilityGroup); return; } } else { objNotFoundEx = new CouldNotFindServerObject(Environment.MachineName); } } }); if (objNotFoundEx != null) { exception = objNotFoundEx; } return(dag); }
public static ActiveManager CreateRemoteActiveManager(string domainControllerName, NetworkCredential networkCredential, bool createCachingActiveManager) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(domainControllerName, true, ConsistencyMode.FullyConsistent, networkCredential, ADSessionSettings.FromRootOrgScopeSet(), 1071, "CreateRemoteActiveManager", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\ActiveManager\\ActiveManager.cs"); IADToplogyConfigurationSession adSession = ADSessionFactory.CreateWrapper(topologyConfigurationSession); IFindAdObject <IADDatabaseAvailabilityGroup> dagLookup; IFindAdObject <IADServer> serverLookup; IFindMiniServer miniServerLookup; IFindAdObject <IADClientAccessArray> casLookup; IFindMiniClientAccessServerOrArray miniCasArrayLookup; IFindAdObject <IADDatabase> databaseLookup; if (createCachingActiveManager) { TimeSpan timeSpan = new TimeSpan(0, 0, 75); dagLookup = new AdObjectLookupCache <IADDatabaseAvailabilityGroup>(adSession, timeSpan, timeSpan, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabaseAvailabilityGroup> .AdOperationTimeout); serverLookup = new AdObjectLookupCache <IADServer>(adSession, AdObjectLookupCache <IADServer> .TimeToLive, AdObjectLookupCache <IADServer> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADServer> .AdOperationTimeout); miniServerLookup = new MiniServerLookupCache(adSession, MiniServerLookupCache.TimeToLive, MiniServerLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniServerLookupCache.AdOperationTimeout); casLookup = new AdObjectLookupCache <IADClientAccessArray>(adSession, AdObjectLookupCache <IADClientAccessArray> .TimeToLive, AdObjectLookupCache <IADClientAccessArray> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADClientAccessArray> .AdOperationTimeout); miniCasArrayLookup = new MiniClientAccessServerOrArrayLookupCache(topologyConfigurationSession, MiniClientAccessServerOrArrayLookupCache.TimeToLive, MiniClientAccessServerOrArrayLookupCache.TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, MiniClientAccessServerOrArrayLookupCache.AdOperationTimeout); databaseLookup = new AdObjectLookupCache <IADDatabase>(adSession, AdObjectLookupCache <IADDatabase> .TimeToLive, AdObjectLookupCache <IADDatabase> .TimeToNegativeLive, ActiveManager.s_cacheLockTimeout, AdObjectLookupCache <IADDatabase> .AdOperationTimeout); } else { dagLookup = new SimpleAdObjectLookup <IADDatabaseAvailabilityGroup>(adSession); serverLookup = new SimpleAdObjectLookup <IADServer>(adSession); miniServerLookup = new SimpleMiniServerLookup(adSession); casLookup = new SimpleAdObjectLookup <IADClientAccessArray>(adSession); miniCasArrayLookup = new SimpleMiniClientAccessServerOrArrayLookup(topologyConfigurationSession); databaseLookup = new SimpleAdObjectLookup <IADDatabase>(adSession); } ActiveManager activeManager = new ActiveManager(createCachingActiveManager, dagLookup, serverLookup, miniServerLookup, casLookup, miniCasArrayLookup, databaseLookup, topologyConfigurationSession, false); activeManager.m_networkCredential = networkCredential; ExTraceGlobals.ActiveManagerClientTracer.TraceDebug <string>(0L, "Created an ActiveManager suitable for cross-forest queries, dcName={0}.", domainControllerName); return(activeManager); }
internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { TaskLogger.LogEnter(); if (!typeof(ADRecipient).IsAssignableFrom(typeof(T)) && !typeof(ReducedRecipient).IsAssignableFrom(typeof(T))) { throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type"); } if (Globals.IsConsumerOrganization(session.SessionSettings.CurrentOrganizationId) && ADSessionFactory.UseAggregateSession(session.SessionSettings)) { return(ConsumerMailboxIdParameter.Parse(base.RawIdentity).GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); } EnumerableWrapper <T> enumerableWrapper = EnumerableWrapper <T> .GetWrapper(base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); if (!enumerableWrapper.HasElements() && session is IRecipientSession) { enumerableWrapper = base.GetEnumerableWrapper <T>(enumerableWrapper, this.GetObjectsByAccountName <T>(base.RawIdentity, rootId, (IRecipientSession)session, optionalData)); } if (enumerableWrapper.HasUnfilteredElements() && !enumerableWrapper.HasElements()) { notFoundReason = new LocalizedString?(this.GetErrorMessageForWrongType(this.ToString())); } TaskLogger.LogExit(); return(enumerableWrapper); }
internal override IEnumerable <T> GetObjectsInOrganization <T>(string identityString, ADObjectId rootId, IDirectorySession session, OptionalIdentityData optionalData) { if (Globals.IsConsumerOrganization(session.SessionSettings.CurrentOrganizationId) && ADSessionFactory.UseAggregateSession(session.SessionSettings)) { LocalizedString?localizedString; return(ConsumerMailboxIdParameter.Parse(base.RawIdentity).GetObjects <T>(rootId, session, session, optionalData, out localizedString)); } List <QueryFilter> list = new List <QueryFilter>(); QueryFilter item = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.ExternalDirectoryObjectId, identityString); list.Add(item); SmtpAddress smtpAddress = new SmtpAddress(identityString); if (smtpAddress.IsValidAddress) { QueryFilter item2 = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.EmailAddresses, "SMTP:" + smtpAddress.ToString()); list.Add(item2); QueryFilter item3 = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.ExternalEmailAddress, "SMTP:" + smtpAddress.ToString()); list.Add(item3); QueryFilter item4 = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.WindowsLiveID, smtpAddress.ToString()); list.Add(item4); } QueryFilter item5 = base.CreateWildcardOrEqualFilter(ADUserSchema.UserPrincipalName, identityString); list.Add(item5); QueryFilter item6 = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.LegacyExchangeDN, identityString); list.Add(item6); QueryFilter item7 = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.EmailAddresses, "X500:" + identityString); list.Add(item7); QueryFilter queryFilter = base.CreateWildcardOrEqualFilter(ADRecipientSchema.Alias, identityString); if (queryFilter != null) { list.Add(queryFilter); } if (this.SearchWithDisplayName) { QueryFilter queryFilter2 = base.CreateWildcardOrEqualFilter(ADRecipientSchema.DisplayName, identityString); if (queryFilter2 != null) { list.Add(queryFilter2); } } NetID propertyValue; if (NetID.TryParse(identityString, out propertyValue)) { QueryFilter item8 = new ComparisonFilter(ComparisonOperator.Equal, ADUserSchema.NetID, propertyValue); list.Add(item8); } Guid guid = Guid.Empty; if (base.InternalADObjectId != null) { guid = base.InternalADObjectId.ObjectGuid; } if (Guid.Empty != guid || GuidHelper.TryParseGuid(identityString, out guid)) { list.Add(new ComparisonFilter(ComparisonOperator.Equal, ADMailboxRecipientSchema.ExchangeGuid, guid)); list.Add(new ComparisonFilter(ComparisonOperator.Equal, ADUserSchema.ArchiveGuid, guid)); list.Add(new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.ExchangeObjectId, guid)); list.Add(new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.MailboxGuidsRaw, guid.ToString())); this.rawMailboxGuidInvolvedInSearch = guid; } QueryFilter queryFilter3 = QueryFilter.OrTogether(list.ToArray()); QueryFilter recipientTypeFilter = RecipientIdParameter.GetRecipientTypeFilter(this.RecipientTypes); queryFilter3 = QueryFilter.AndTogether(new QueryFilter[] { queryFilter3, recipientTypeFilter }); EnumerableWrapper <T> enumerableWrapper = EnumerableWrapper <T> .GetWrapper(base.PerformPrimarySearch <T>(queryFilter3, rootId, session, true, optionalData)); if (!enumerableWrapper.HasElements()) { this.rawMailboxGuidInvolvedInSearch = Guid.Empty; OptionalIdentityData optionalIdentityData; if (optionalData == null) { optionalIdentityData = new OptionalIdentityData(); optionalIdentityData.AdditionalFilter = recipientTypeFilter; } else { optionalIdentityData = optionalData.Clone(); optionalIdentityData.AdditionalFilter = QueryFilter.AndTogether(new QueryFilter[] { optionalIdentityData.AdditionalFilter, recipientTypeFilter }); } enumerableWrapper = base.GetEnumerableWrapper <T>(enumerableWrapper, base.GetObjectsInOrganization <T>(identityString, rootId, session, optionalIdentityData)); } return(enumerableWrapper); }
// Token: 0x06000030 RID: 48 RVA: 0x00002874 File Offset: 0x00000A74 public void PopulateForDag() { Dictionary <string, AmServerNameCache.CacheEntry> dictionary = new Dictionary <string, AmServerNameCache.CacheEntry>(16, MachineName.Comparer); Exception ex = SharedHelper.RunADOperationEx(delegate(object param0, EventArgs param1) { IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); Exception ex2; IADDatabaseAvailabilityGroup localServerDatabaseAvailabilityGroup = DirectoryHelper.GetLocalServerDatabaseAvailabilityGroup(iadtoplogyConfigurationSession, out ex2); if (ex2 != null) { AmServerNameCache.Tracer.TraceError <Exception>(0L, "PopulateForDag failed to get DAG: {0}", ex2); return; } if (localServerDatabaseAvailabilityGroup != null) { iadtoplogyConfigurationSession.UseConfigNC = false; iadtoplogyConfigurationSession.UseGlobalCatalog = true; MultiValuedProperty <ADObjectId> servers = localServerDatabaseAvailabilityGroup.Servers; if (servers != null) { foreach (ADObjectId adobjectId in servers) { IADComputer iadcomputer = iadtoplogyConfigurationSession.FindComputerByHostName(adobjectId.Name); if (iadcomputer != null && !string.IsNullOrEmpty(iadcomputer.DnsHostName)) { AmServerNameCache.CacheEntry cacheEntry = new AmServerNameCache.CacheEntry(); cacheEntry.ExpiryTime = ExDateTime.Now + this.TimeToLive; cacheEntry.Fqdn = iadcomputer.DnsHostName; } else { AmServerNameCache.Tracer.TraceError <ADObjectId>(0L, "PopulateForDag could not map server {0}", adobjectId); } } } } }); if (ex != null) { AmServerNameCache.Tracer.TraceError <Exception>(0L, "PopulateForDag did not replace cache because: {0}", ex); return; } if (dictionary != null) { AmServerNameCache.Tracer.TraceDebug(0L, "PopulateForDag replaced the cache"); try { this.m_rwLock.EnterWriteLock(); this.m_cache = dictionary; } finally { try { this.m_rwLock.ExitWriteLock(); } catch (SynchronizationLockException) { } } } }
// Token: 0x060013B9 RID: 5049 RVA: 0x000502BC File Offset: 0x0004E4BC public void Initialize() { if (Interlocked.CompareExchange(ref this.m_fInitialized, 1, 0) == 1) { return; } this.ADConfig = MonitoringADConfig.GetConfig(new AmServerName(this.m_serverName, true), Dependencies.ReplayAdObjectLookup, Dependencies.ReplayAdObjectLookupPartiallyConsistent, ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true), ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true), null); ActiveManager noncachingActiveManagerInstance = ActiveManager.GetNoncachingActiveManagerInstance(); AmMultiNodeCopyStatusFetcher amMultiNodeCopyStatusFetcher = new AmMultiNodeCopyStatusFetcher(this.ADConfig.AmServerNames, this.ADConfig.DatabaseMap, RpcGetDatabaseCopyStatusFlags2.None, noncachingActiveManagerInstance, false); Dictionary <Guid, Dictionary <AmServerName, CopyStatusClientCachedEntry> > status = amMultiNodeCopyStatusFetcher.GetStatus(); CopyStatusClientLookupTable copyStatusClientLookupTable = new CopyStatusClientLookupTable(); copyStatusClientLookupTable.UpdateCopyStatusCachedEntries(status); this.CopyStatusLookup = new CopyStatusClientLookup(copyStatusClientLookupTable, null, noncachingActiveManagerInstance); }
// Token: 0x06000058 RID: 88 RVA: 0x00002D55 File Offset: 0x00000F55 internal AmStartupAutoMounter() { this.m_adSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true); this.m_reasonCode = AmDbActionReason.Startup; }