Search in sources :

Example 1 with IgniteRebalanceIteratorImpl

use of org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteRebalanceIteratorImpl in project ignite by apache.

the class IgniteCacheOffheapManagerImpl method rebalanceIterator.

/**
 * {@inheritDoc}
 */
@Override
public IgniteRebalanceIterator rebalanceIterator(IgniteDhtDemandedPartitionsMap parts, AffinityTopologyVersion topVer) throws IgniteCheckedException {
    TreeMap<Integer, GridCloseableIterator<CacheDataRow>> iterators = new TreeMap<>();
    Set<Integer> missing = new HashSet<>();
    for (Integer p : parts.fullSet()) {
        GridCloseableIterator<CacheDataRow> partIter = reservedIterator(p, topVer);
        if (partIter == null) {
            missing.add(p);
            continue;
        }
        iterators.put(p, partIter);
    }
    IgniteHistoricalIterator historicalIterator = historicalIterator(parts.historicalMap(), missing);
    IgniteRebalanceIterator iter = new IgniteRebalanceIteratorImpl(iterators, historicalIterator);
    for (Integer p : missing) iter.setPartitionMissing(p);
    return iter;
}
Also used : CacheDataRow(org.apache.ignite.internal.processors.cache.persistence.CacheDataRow) GridCloseableIterator(org.apache.ignite.internal.util.lang.GridCloseableIterator) IgniteHistoricalIterator(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteHistoricalIterator) IgniteRebalanceIteratorImpl(org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteRebalanceIteratorImpl) TreeMap(java.util.TreeMap) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 TreeMap (java.util.TreeMap)1 IgniteHistoricalIterator (org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteHistoricalIterator)1 IgniteRebalanceIteratorImpl (org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteRebalanceIteratorImpl)1 CacheDataRow (org.apache.ignite.internal.processors.cache.persistence.CacheDataRow)1 GridCloseableIterator (org.apache.ignite.internal.util.lang.GridCloseableIterator)1