Ejemplo n.º 1
0
        internal override Guid SelectDomainController(PartitionId partitionId)
        {
            ExTraceGlobals.ActiveDirectoryTracer.TraceDebug <Guid>((long)base.TenantExternalDirectoryId.GetHashCode(), "Selecting a DC for Merge operation of {0}. Will examine all DCs in the local site AND domain", base.TenantExternalDirectoryId);
            if (base.InvocationId != Guid.Empty)
            {
                ExTraceGlobals.ActiveDirectoryTracer.TraceError <Guid>((long)base.TenantExternalDirectoryId.GetHashCode(), "MergePageToken.SelectDomainController this.InvocationId {0} is not Guid.Empty", base.InvocationId);
                throw new InvalidOperationException("InvocationId");
            }
            ITopologyConfigurationSession session        = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromAccountPartitionRootOrgScopeSet(partitionId), 390, "SelectDomainController", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\Sync\\BackSync\\MergePageToken.cs");
            IList <ADServerInfo>          serversForRole = TopologyProvider.GetInstance().GetServersForRole(partitionId.ForestFQDN, new List <string>(0), ADServerRole.DomainController, int.MaxValue, false);

            ExTraceGlobals.ActiveDirectoryTracer.TraceDebug((long)base.TenantExternalDirectoryId.GetHashCode(), "MergePageToken.SelectDomainController searching dcs in preferred site");
            foreach (ADServerInfo adserverInfo in serversForRole)
            {
                Guid result;
                if (this.TrySelectDomainController(session, adserverInfo.Fqdn, partitionId, false, out result))
                {
                    return(result);
                }
            }
            ReadOnlyCollection <ADServer> readOnlyCollection = ADForest.GetForest(partitionId).FindRootDomain().FindAllDomainControllers();

            ExTraceGlobals.ActiveDirectoryTracer.TraceDebug((long)base.TenantExternalDirectoryId.GetHashCode(), "MergePageToken.SelectDomainController searching dcs in other sites");
            foreach (ADServer adserver in readOnlyCollection)
            {
                Guid result2;
                if (!ConnectionPoolManager.IsServerInPreferredSite(partitionId.ForestFQDN, adserver) && this.TrySelectDomainController(session, adserver.DnsHostName, partitionId, true, out result2))
                {
                    return(result2);
                }
            }
            ExTraceGlobals.ActiveDirectoryTracer.TraceError <Guid, string>((long)base.TenantExternalDirectoryId.GetHashCode(), "Could not find any DC that has all changes reported by the Tenant Full Sync Watermarks for {0}. \r\nFull sync watermarks: \r\n{1}", base.TenantExternalDirectoryId, base.Watermarks.SerializeToString());
            throw new BackSyncDataSourceUnavailableException();
        }
 public override void CheckIfConnectionAllowed()
 {
     ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "CheckIfConnectionAllowed entering");
     if (!string.IsNullOrEmpty(base.RecipientSession.DomainController))
     {
         ExTraceGlobals.BackSyncTracer.TraceDebug <string>((long)SyncConfiguration.TraceId, "this.RecipientSession.DomainController {0}", base.RecipientSession.DomainController);
         ADServer    adserver    = base.RootOrgConfigurationSession.FindDCByFqdn(base.RecipientSession.DomainController);
         PartitionId partitionId = base.RootOrgConfigurationSession.SessionSettings.PartitionId;
         if (adserver == null || !ConnectionPoolManager.IsServerInPreferredSite(partitionId.ForestFQDN, adserver))
         {
             ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "DC site {0} not in preferred site list.", (adserver != null) ? adserver.Site.DistinguishedName : "<null>");
             throw new BackSyncDataSourceNotInPreferredSiteException((adserver != null) ? adserver.DistinguishedName : "<null>");
         }
     }
 }