Search in sources :

Example 6 with IntersectionResult

use of com.ms.silverking.cloud.ring.IntersectionResult in project SilverKing by Morgan-Stanley.

the class ConvergenceController2 method requestRemoteChecksumTreesForPrimary.

/*
    private void requestRemoteChecksumTreesForPrimary(ConvergencePoint targetCP, ConvergencePoint curCP, RingEntry targetEntry) {
        Set<IPAndPort>  sourceOwners;
        
        sourceOwners = ringMaster.getReplicas(targetEntry.getRegion(), OwnerQueryMode.Primary);
        //sourceOwners = ImmutableUtil.remove(sourceMap.getOwners(targetEntry.getRegion(), OwnerQueryMode.Primary), 
        //                                    mgBase._getIPAndPort());
        if (!sourceOwners.isEmpty()) {
            if (true) {
                System.out.printf("target %s\towners %s\n", targetEntry.getRegion(), CollectionUtil.toString(sourceOwners));
            }
            requestRemoteChecksumTree(targetCP, curCP, targetEntry, sourceOwners);
        } else {
            Log.warning("Primary convergence. No previous non-local owners for entry: ", targetEntry);
        }
    }
    */
private void requestRemoteChecksumTreesForPrimary(RingEntry targetEntry) {
    List<RingEntry> sourceEntries;
    sourceEntries = getEntries(targetEntry.getRegion());
    if (!sourceEntries.isEmpty()) {
        Log.warningf("%x target %s\towners %s\n", ns, targetEntry.getRegion(), CollectionUtil.toString(sourceEntries));
        for (RingEntry sourceEntry : sourceEntries) {
            List<IPAndPort> nonLocalOwners;
            List<IPAndPort> _nonLocalOwners;
            // ExclusionSet    curExclusionSet;
            nonLocalOwners = new ArrayList<>(sourceEntry.getOwnersIPList(OwnerQueryMode.Primary));
            nonLocalOwners.remove(mgBase._getIPAndPort());
            // curExclusionSet = ringMaster.getCurrentExclusionSet();
            // Log.warning("Filtering exclusion set: ", curExclusionSet);
            // nonLocalOwners = curExclusionSet.filterByIP(nonLocalOwners);
            Log.info("Filtering exclusion set: ", exclusionSet);
            _nonLocalOwners = exclusionSet.filterByIP(nonLocalOwners);
            if (_nonLocalOwners.size() != nonLocalOwners.size()) {
                Log.warning("Raw nonLocalOwners:      ", nonLocalOwners);
                Log.warning("Filtered nonLocalOwners: ", _nonLocalOwners);
            }
            if (_nonLocalOwners.size() == 0) {
                Log.warningf("%x All nonLocalOwners excluded. Ignoring exclusions for this entry.", ns);
            } else {
                nonLocalOwners = _nonLocalOwners;
            }
            IntersectionResult iResult;
            // We don't want to request the entire source region.
            // We're only interested in the portion(s) of the source region that cover(s) the target region.
            iResult = RingRegion.intersect(sourceEntry.getRegion(), targetEntry.getRegion());
            for (RingRegion commonSubRegion : iResult.getOverlapping()) {
                requestRemoteChecksumTree(targetCP, curCP, commonSubRegion, nonLocalOwners);
            }
        }
    } else {
        // FIXME - this should actually never occur as the getEntries() call above
        // has no notion of local/non-local. It just returns the owners, and there
        // should always be owners.
        Log.warningf("Primary convergence %x. No previous non-local owners for entry: ", ns, targetEntry);
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) RingRegion(com.ms.silverking.cloud.ring.RingRegion) IntersectionResult(com.ms.silverking.cloud.ring.IntersectionResult) RingEntry(com.ms.silverking.cloud.toporing.RingEntry)

Aggregations

IntersectionResult (com.ms.silverking.cloud.ring.IntersectionResult)6 RingRegion (com.ms.silverking.cloud.ring.RingRegion)5 RingEntry (com.ms.silverking.cloud.toporing.RingEntry)2 IPAndPort (com.ms.silverking.net.IPAndPort)2 KeyAndVersionChecksum (com.ms.silverking.cloud.dht.daemon.storage.KeyAndVersionChecksum)1