// Token: 0x06000C40 RID: 3136 RVA: 0x0003643C File Offset: 0x0003463C
        public static RemoteReplayConfiguration TaskGetReplayConfig(IADDatabaseAvailabilityGroup dag, IADDatabase db, IADServer server)
        {
            DatabaseLocationInfo databaseLocationInfo;
            bool flag = RemoteReplayConfiguration.IsServerRcrSource(db, server, out databaseLocationInfo);

            if (flag)
            {
                return(new RemoteReplayConfiguration(dag, db, server, server.Fqdn, LockType.Remote, ReplayConfigType.RemoteCopySource));
            }
            return(new RemoteReplayConfiguration(dag, db, server, databaseLocationInfo.ServerFqdn, LockType.Remote, ReplayConfigType.RemoteCopyTarget));
        }
Пример #2
0
        internal static bool IsDbPendingLcrRcrTarget(Guid guid, out ReplayConfiguration replayConfig, out bool fSource)
        {
            replayConfig = null;
            fSource      = false;
            IADDatabaseAvailabilityGroup dag;
            IADDatabase db;
            IADServer   server;
            bool        flag = SeedHelper.IsDbPendingLcrRcrTarget(guid, out dag, out db, out server);

            if (flag)
            {
                replayConfig = RemoteReplayConfiguration.TaskGetReplayConfig(dag, db, server);
                fSource      = (replayConfig.Type == ReplayConfigType.RemoteCopySource);
            }
            return(flag);
        }
Пример #3
0
        public static ReplayConfiguration GetReplayConfiguration(IADDatabaseAvailabilityGroup dag, IADDatabase mdb, IADServer hostServer, ActiveManager activeManager, out bool fSource, out Exception ex)
        {
            ReplayConfiguration result = null;

            fSource = false;
            ex      = null;
            try
            {
                DatabaseLocationInfo serverForDatabase = activeManager.GetServerForDatabase(mdb.Guid, GetServerForDatabaseFlags.BasicQuery);
                if (string.IsNullOrEmpty(serverForDatabase.ServerFqdn))
                {
                    ReplayConfiguration.Tracer.TraceDebug <string>(0L, "GetReplayConfiguration({0}) Performing a BasicQuery was insufficient. Calling again with AD access.", mdb.Name);
                    serverForDatabase = activeManager.GetServerForDatabase(mdb.Guid);
                }
                else
                {
                    ReplayConfiguration.Tracer.TraceDebug <string>(0L, "GetReplayConfiguration({0}) Performing a BasicQuery was sufficient. AD calls were avoided!", mdb.Name);
                }
                AmServerName amServerName  = new AmServerName(serverForDatabase.ServerFqdn);
                AmServerName amServerName2 = new AmServerName(hostServer.Fqdn);
                ReplayConfiguration.Tracer.TraceDebug <string, string, string>(0L, "GetReplayConfiguration({0}): GSFD returned active server of: {1}, hostServerFqdn is: {2}", mdb.Name, amServerName.Fqdn, amServerName2.Fqdn);
                if (AmServerName.IsEqual(amServerName, amServerName2))
                {
                    fSource = true;
                }
                if (fSource)
                {
                    if (mdb.ReplicationType == ReplicationType.None)
                    {
                        result = new SingleCopyReplayConfiguration(dag, mdb, hostServer, LockType.ReplayService);
                    }
                    else
                    {
                        result = RemoteReplayConfiguration.ServiceGetReplayConfig(dag, mdb, hostServer, serverForDatabase.ServerFqdn, ReplayConfigType.RemoteCopySource);
                    }
                }
                else
                {
                    if (mdb.ReplicationType != ReplicationType.Remote)
                    {
                        throw new ReplayConfigNotFoundException(mdb.Name, hostServer.Name);
                    }
                    result = RemoteReplayConfiguration.ServiceGetReplayConfig(dag, mdb, hostServer, serverForDatabase.ServerFqdn, ReplayConfigType.RemoteCopyTarget);
                }
            }
            catch (DatabaseNotFoundException ex2)
            {
                ex = ex2;
            }
            catch (ServerForDatabaseNotFoundException ex3)
            {
                ex = ex3;
            }
            catch (ObjectNotFoundException ex4)
            {
                ex = ex4;
            }
            catch (TransientException ex5)
            {
                ex = ex5;
            }
            return(result);
        }