// Token: 0x06000C41 RID: 3137 RVA: 0x00036478 File Offset: 0x00034678
        public static bool IsServerRcrSource(IADDatabase db, IADServer server, out DatabaseLocationInfo activeLocation)
        {
            ActiveManager noncachingActiveManagerInstance = ActiveManager.GetNoncachingActiveManagerInstance();

            activeLocation = noncachingActiveManagerInstance.GetServerForDatabase(db.Guid, GetServerForDatabaseFlags.BasicQuery);
            return(Cluster.StringIEquals(activeLocation.ServerFqdn, server.Fqdn));
        }
        private AmServerName GetCurrentActiveServer(Guid dbGuid)
        {
            ActiveManager        noncachingActiveManagerInstance = ActiveManager.GetNoncachingActiveManagerInstance();
            DatabaseLocationInfo serverForDatabase = noncachingActiveManagerInstance.GetServerForDatabase(dbGuid);

            return(new AmServerName(serverForDatabase.ServerFqdn));
        }
Exemple #3
0
        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);
                        }
                    }
                }
            }
        }
Exemple #4
0
        public static ReplayConfiguration GetLocalReplayConfiguration(Guid dbGuid, IADConfig adConfig, ActiveManager activeManager, out Exception ex)
        {
            ex = null;
            if (activeManager == null)
            {
                activeManager = ActiveManager.GetNoncachingActiveManagerInstance();
            }
            IADServer localServer = adConfig.GetLocalServer();

            if (localServer == null)
            {
                ex = new FailedToFindServerException("localmachine");
                ExTraceGlobals.ReplayManagerTracer.TraceError <Guid, Exception>(0L, "GetReplayConfiguration ({0}): didn't find any server object for the local machine: {1}", dbGuid, ex);
                return(null);
            }
            IADDatabase database = adConfig.GetDatabase(dbGuid);

            if (database == null)
            {
                ex = new FailedToFindDatabaseException(dbGuid.ToString());
                ExTraceGlobals.ReplayManagerTracer.TraceError <Guid>(0L, "GetReplayConfiguration ({0}): Didn't find any mailbox database object from AD.", dbGuid);
                return(null);
            }
            bool flag;
            ReplayConfiguration replayConfiguration = ReplayConfiguration.GetReplayConfiguration(adConfig.GetLocalDag(), database, localServer, activeManager, out flag, out ex);

            if (ex != null)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceError <Guid, Exception>(0L, "GetReplayConfiguration ({0}): Error occurred constructing the ReplayConfiguration. Error: {1}", dbGuid, ex);
                return(null);
            }
            return(replayConfiguration);
        }
        public static void ConstructAllLocalConfigurations(IADConfig adConfig, ActiveManager activeManager, out List <ReplayConfiguration> currentSourceConfigurations, out List <ReplayConfiguration> currentRemoteTargetConfigurations, out List <KeyValuePair <IADDatabase, Exception> > failedConfigurations)
        {
            currentSourceConfigurations       = new List <ReplayConfiguration>(20);
            currentRemoteTargetConfigurations = new List <ReplayConfiguration>(48);
            failedConfigurations = new List <KeyValuePair <IADDatabase, Exception> >();
            if (activeManager == null)
            {
                activeManager = ActiveManager.GetNoncachingActiveManagerInstance();
            }
            IADServer localServer = adConfig.GetLocalServer();

            if (localServer == null)
            {
                ReplayConfiguration.Tracer.TraceError(0L, "ConstructAllLocalConfigurations: didn't find local server");
                return;
            }
            IEnumerable <IADDatabase> databasesOnLocalServer = adConfig.GetDatabasesOnLocalServer();

            if (databasesOnLocalServer == null)
            {
                ReplayConfiguration.Tracer.TraceError(0L, "There are no mailbox dbs on this server");
                return;
            }
            IADDatabaseAvailabilityGroup localDag = adConfig.GetLocalDag();

            foreach (IADDatabase iaddatabase in databasesOnLocalServer)
            {
                Exception           ex = null;
                bool                flag;
                ReplayConfiguration replayConfiguration = ReplayConfiguration.GetReplayConfiguration(localDag, iaddatabase, localServer, activeManager, out flag, out ex);
                if (replayConfiguration != null)
                {
                    if (flag)
                    {
                        currentSourceConfigurations.Add(replayConfiguration);
                    }
                    else
                    {
                        currentRemoteTargetConfigurations.Add(replayConfiguration);
                    }
                }
                else if (ex != null)
                {
                    ReplayConfiguration.Tracer.TraceError <Guid, string>(0L, "ReplayConfiguration for database '{0}' was not created due to an Exception. The configuration will not be added to the list of possible instances to run. Exception: {1}", iaddatabase.Guid, ex.ToString());
                    failedConfigurations.Add(new KeyValuePair <IADDatabase, Exception>(iaddatabase, ex));
                }
                else
                {
                    ReplayConfiguration.Tracer.TraceError <string>(0L, "ConstructAllLocalConfigurations() did not find a ReplayConfiguration for database '{0}' and no error occurred.", iaddatabase.Name);
                }
            }
        }
Exemple #6
0
        // 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);
        }
 private void PopulateDatabaseCache()
 {
     if (this.m_databaseTable == null || this.m_databaseTable.Count == 0)
     {
         Database[] databases = this.m_sourceServer.GetDatabases();
         Dictionary <Guid, DatabaseLocationInfo> dbInfoTable = new Dictionary <Guid, DatabaseLocationInfo>(databases.Length);
         ActiveManager noncachingActiveManagerInstance       = ActiveManager.GetNoncachingActiveManagerInstance();
         foreach (Database database in databases)
         {
             DatabaseLocationInfo serverForDatabase = noncachingActiveManagerInstance.GetServerForDatabase(database.Guid);
             dbInfoTable[database.Guid] = serverForDatabase;
         }
         IEnumerable <Database> source = from db in databases
                                         where this.IsDatabaseActiveOnSourceServer(db, dbInfoTable)
                                         select db;
         this.m_databaseTable = source.ToDictionary((Database db) => db.Guid);
     }
 }
Exemple #8
0
        private ExRpcAdmin GetExRpcAdminForDatabase(DirectoryDatabase database)
        {
            ActiveManager        activeManager     = LoadBalanceADSettings.Instance.Value.UseCachingActiveManager ? ActiveManager.GetCachingActiveManagerInstance() : ActiveManager.GetNoncachingActiveManagerInstance();
            DatabaseLocationInfo serverForDatabase = activeManager.GetServerForDatabase(database.Guid, true);

            return(ExRpcAdmin.Create("Client=MSExchangeMailboxLoadBalance", serverForDatabase.ServerFqdn, null, null, null));
        }
Exemple #9
0
        private bool AcquireADObjectsForPrivateMdb()
        {
            if (MdbSystemMailboxPinger.OnTestPing != null)
            {
                return(true);
            }
            bool flag = false;

            try
            {
                if (this.principal != null)
                {
                    if (!this.VerifyLocalBoxCall(this.principal.MailboxInfo.Location.ServerFqdn))
                    {
                        return(false);
                    }
                    flag = true;
                    return(true);
                }
                else
                {
                    if ((this.pingerState == MdbSystemMailboxPinger.PingerState.NeedReinitialization || this.pingerState == MdbSystemMailboxPinger.PingerState.NotInitialized) && TimeProvider.UtcNow - this.lastSessionAttemptUtc < MdbSystemMailboxPinger.OpenSessionAttemptInterval)
                    {
                        ExTraceGlobals.DatabasePingerTracer.TraceDebug((long)this.GetHashCode(), "Need to acquire principal, but not enough time has passed between attempts.");
                        return(false);
                    }
                    this.lastSessionAttemptUtc = TimeProvider.UtcNow;
                    ActiveManager        noncachingActiveManagerInstance = ActiveManager.GetNoncachingActiveManagerInstance();
                    DatabaseLocationInfo serverForDatabase = noncachingActiveManagerInstance.GetServerForDatabase(this.databaseGuid, true);
                    if (!this.VerifyLocalBoxCall(serverForDatabase.ServerFqdn))
                    {
                        return(false);
                    }
                    ADSessionSettings adsessionSettings = ADSessionSettings.FromRootOrgScopeSet();
                    ADSystemMailbox   adSystemMailbox   = this.FindSystemMailbox(adsessionSettings);
                    Server            server            = this.FindMdbServer(adsessionSettings, serverForDatabase.ServerFqdn);
                    if (server == null)
                    {
                        ExTraceGlobals.DatabasePingerTracer.TraceError <string>((long)this.GetHashCode(), "[MdbSystemMailboxPinger.AcquireADObjectsForPrivateMdb] Failed to find server with FQDN: '{0}'", serverForDatabase.ServerFqdn);
                        return(false);
                    }
                    this.principal  = ExchangePrincipal.FromADSystemMailbox(adsessionSettings, adSystemMailbox, server);
                    this.accessInfo = new MailboxAccessInfo(new WindowsPrincipal(WindowsIdentity.GetCurrent()));
                    flag            = true;
                }
            }
            catch (StoragePermanentException arg)
            {
                ExTraceGlobals.DatabasePingerTracer.TraceError <StoragePermanentException>((long)this.GetHashCode(), "Encountered StoragePermanentException obtaining ExchangePrincipal.  Exception: {0}", arg);
            }
            catch (StorageTransientException arg2)
            {
                ExTraceGlobals.DatabasePingerTracer.TraceError <StorageTransientException>((long)this.GetHashCode(), "Encountered StorageTransientException obtaining ExchangePrincipal.  Exception: {0}", arg2);
            }
            catch (DataSourceOperationException arg3)
            {
                ExTraceGlobals.DatabasePingerTracer.TraceError <DataSourceOperationException>((long)this.GetHashCode(), "EncounteredDataSourceOperationException obtaining ExchangePrincipal.  Exception :{0}", arg3);
            }
            catch (DataSourceTransientException arg4)
            {
                ExTraceGlobals.DatabasePingerTracer.TraceError <DataSourceTransientException>((long)this.GetHashCode(), "Encountered DataSourceTransientException obtaining ExchangePrincipal.  Exception :{0}", arg4);
            }
            finally
            {
                if (!flag)
                {
                    this.principal = null;
                    this.DisposeAccessInfo();
                }
            }
            return(flag);
        }