Search in sources :

Example 6 with RingEntry

use of com.ms.silverking.cloud.toporing.RingEntry in project SilverKing by Morgan-Stanley.

the class ConvergenceController2 method startSecondaryConvergence.

/*
     * Currently this code only requests checksums for regions where
     * the local node is a secondary replica.
     */
private void startSecondaryConvergence() {
    List<RingEntry> mySecondaryEntries;
    mySecondaryEntries = getCurrentMapReplicaEntries(mgBase._getIPAndPort(), OwnerQueryMode.Secondary);
    if (mySecondaryEntries != null) {
        for (RingEntry entry : mySecondaryEntries) {
            requestRemoteChecksumTreeForSecondary(entry);
        }
    }
}
Also used : RingEntry(com.ms.silverking.cloud.toporing.RingEntry)

Example 7 with RingEntry

use of com.ms.silverking.cloud.toporing.RingEntry 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

RingEntry (com.ms.silverking.cloud.toporing.RingEntry)7 IPAndPort (com.ms.silverking.net.IPAndPort)3 IntersectionResult (com.ms.silverking.cloud.ring.IntersectionResult)2 RingRegion (com.ms.silverking.cloud.ring.RingRegion)2