Search in sources :

Example 1 with ReuseListImpl

use of org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseListImpl in project ignite by apache.

the class WalRecoveryTxLogicalRecordsTest method getReuseListData.

/**
 * @param ignite Node.
 * @param cacheName Cache name.
 * @return Cache reuse list data.
 */
private T2<long[], Integer> getReuseListData(Ignite ignite, String cacheName) {
    GridCacheContext ctx = ((IgniteEx) ignite).context().cache().cache(cacheName).context();
    ReuseListImpl reuseList = GridTestUtils.getFieldValue(ctx.offheap(), "reuseList");
    PagesList.Stripe[] bucket = GridTestUtils.getFieldValue(reuseList, "bucket");
    long[] ids = null;
    if (bucket != null) {
        ids = new long[bucket.length];
        for (int i = 0; i < bucket.length; i++) ids[i] = bucket[i].tailId;
    }
    return new T2<>(ids, 0);
}
Also used : GridCacheContext(org.apache.ignite.internal.processors.cache.GridCacheContext) ReuseListImpl(org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseListImpl) T2(org.apache.ignite.internal.util.typedef.T2)

Example 2 with ReuseListImpl

use of org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseListImpl in project ignite by apache.

the class GridCacheOffheapManager method initDataStructures.

/**
 * {@inheritDoc}
 */
@Override
protected void initDataStructures() throws IgniteCheckedException {
    Metas metas = getOrAllocateCacheMetas();
    RootPage reuseListRoot = metas.reuseListRoot;
    reuseList = new ReuseListImpl(grp.groupId(), grp.cacheOrGroupName(), grp.dataRegion().pageMemory(), ctx.wal(), reuseListRoot.pageId().pageId(), reuseListRoot.isAllocated());
    RootPage metastoreRoot = metas.treeRoot;
    indexStorage = new IndexStorageImpl(grp.dataRegion().pageMemory(), ctx.wal(), globalRemoveId(), grp.groupId(), PageIdAllocator.INDEX_PARTITION, PageIdAllocator.FLAG_IDX, reuseList, metastoreRoot.pageId().pageId(), metastoreRoot.isAllocated());
    ((GridCacheDatabaseSharedManager) ctx.database()).addCheckpointListener(this);
}
Also used : ReuseListImpl(org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseListImpl)

Aggregations

ReuseListImpl (org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseListImpl)2 GridCacheContext (org.apache.ignite.internal.processors.cache.GridCacheContext)1 T2 (org.apache.ignite.internal.util.typedef.T2)1