Search in sources :

Example 1 with FilePageStore

use of org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore in project ignite by apache.

the class IdleVerifyUtility method checkPartitionsPageCrcSum.

/**
 * Checks CRC sum of pages with {@code pageType} page type stored in partition with {@code partId} id
 * and associated with cache group.
 *
 * @param pageStoreSup Page store supplier.
 * @param partId Partition id.
 * @param pageType Page type. Possible types {@link PageIdAllocator#FLAG_DATA}, {@link PageIdAllocator#FLAG_IDX}
 *      and {@link PageIdAllocator#FLAG_AUX}.
 */
public static void checkPartitionsPageCrcSum(IgniteThrowableSupplier<FilePageStore> pageStoreSup, int partId, byte pageType) {
    assert pageType == FLAG_DATA || pageType == FLAG_IDX || pageType == FLAG_AUX : pageType;
    FilePageStore pageStore = null;
    try {
        pageStore = pageStoreSup.get();
        long pageId = PageIdUtils.pageId(partId, (byte) 0, 0);
        ByteBuffer buf = ByteBuffer.allocateDirect(pageStore.getPageSize()).order(ByteOrder.nativeOrder());
        for (int pageNo = 0; pageNo < pageStore.pages(); pageId++, pageNo++) {
            buf.clear();
            pageStore.read(pageId, buf, true, true);
        }
    } catch (Throwable e) {
        String msg0 = "CRC check of partition failed [partId=" + partId + ", grpName=" + (pageStore == null ? "" : cacheGroupName(new File(pageStore.getFileAbsolutePath()).getParentFile())) + ", part=" + (pageStore == null ? "" : pageStore.getFileAbsolutePath()) + ']';
        throw new IgniteException(msg0, e);
    }
}
Also used : IgniteException(org.apache.ignite.IgniteException) FilePageStore(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore) ByteBuffer(java.nio.ByteBuffer) File(java.io.File)

Example 2 with FilePageStore

use of org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore in project ignite by apache.

the class IgniteIndexReader method traverseTree.

/**
 * Traverse single index tree from root to leafs.
 *
 * @param rootPageId Root page id.
 * @param treeName Tree name.
 * @param innerCb Inner pages callback.
 * @param leafCb Leaf pages callback.
 * @param itemCb Items callback.
 * @param itemStorage Items storage.
 * @return Tree traversal info.
 */
TreeTraversalInfo traverseTree(long rootPageId, String treeName, @Nullable PageCallback innerCb, @Nullable PageCallback leafCb, @Nullable ItemCallback itemCb, ItemStorage itemStorage) {
    FilePageStore store = filePageStore(partId(rootPageId));
    Map<Class, Long> ioStat = new HashMap<>();
    Map<Long, List<Throwable>> errors = new HashMap<>();
    Set<Long> innerPageIds = new HashSet<>();
    PageCallback innerCb0 = (content, pageId) -> {
        if (innerCb != null)
            innerCb.cb(content, pageId);
        innerPageIds.add(normalizePageId(pageId));
    };
    ItemCallback itemCb0 = (currPageId, item, link) -> {
        if (itemCb != null)
            itemCb.cb(currPageId, item, link);
        itemStorage.add(item);
    };
    getTreeNode(rootPageId, new TreeTraverseContext(treeName, store, ioStat, errors, innerCb0, leafCb, itemCb0));
    return new TreeTraversalInfo(ioStat, errors, innerPageIds, rootPageId, itemStorage);
}
Also used : Arrays(java.util.Arrays) PAGE_SIZE(org.apache.ignite.internal.commandline.indexreader.IgniteIndexReader.Args.PAGE_SIZE) PART_CNT(org.apache.ignite.internal.commandline.indexreader.IgniteIndexReader.Args.PART_CNT) IgnitePair(org.apache.ignite.internal.util.lang.IgnitePair) MvccInnerIO(org.apache.ignite.internal.cache.query.index.sorted.inline.io.MvccInnerIO) Collections.singletonList(java.util.Collections.singletonList) Matcher(java.util.regex.Matcher) PagePartitionMetaIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.PagePartitionMetaIO) Arrays.asList(java.util.Arrays.asList) PageIdUtils.itemId(org.apache.ignite.internal.pagemem.PageIdUtils.itemId) Map(java.util.Map) PageUtils(org.apache.ignite.internal.pagemem.PageUtils) Objects.isNull(java.util.Objects.isNull) GridStringBuilder(org.apache.ignite.internal.util.GridStringBuilder) IgniteDataIntegrityViolationException(org.apache.ignite.internal.processors.cache.persistence.wal.crc.IgniteDataIntegrityViolationException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) Set(java.util.Set) CLIArgument.optionalArg(org.apache.ignite.internal.commandline.argument.parser.CLIArgument.optionalArg) StringBuilderOutputStream(org.apache.ignite.internal.commandline.StringBuilderOutputStream) Collectors.joining(java.util.stream.Collectors.joining) PageIO.getType(org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO.getType) INDEX_PARTITION(org.apache.ignite.internal.pagemem.PageIdAllocator.INDEX_PARTITION) GridUnsafe.allocateBuffer(org.apache.ignite.internal.util.GridUnsafe.allocateBuffer) CLIArgument.mandatoryArg(org.apache.ignite.internal.commandline.argument.parser.CLIArgument.mandatoryArg) PageIdUtils(org.apache.ignite.internal.pagemem.PageIdUtils) PageIdUtils.pageIndex(org.apache.ignite.internal.pagemem.PageIdUtils.pageIndex) Supplier(java.util.function.Supplier) PagesListNodeIO(org.apache.ignite.internal.processors.cache.persistence.freelist.io.PagesListNodeIO) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) PageIO.getVersion(org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO.getVersion) PagesListMetaIO(org.apache.ignite.internal.processors.cache.persistence.freelist.io.PagesListMetaIO) AbstractInlineInnerIO(org.apache.ignite.internal.cache.query.index.sorted.inline.io.AbstractInlineInnerIO) PageIdUtils.partId(org.apache.ignite.internal.pagemem.PageIdUtils.partId) LongStream(java.util.stream.LongStream) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) InnerIO(org.apache.ignite.internal.cache.query.index.sorted.inline.io.InnerIO) File(java.io.File) BPlusMetaIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusMetaIO) AtomicLong(java.util.concurrent.atomic.AtomicLong) PageIdUtils.flag(org.apache.ignite.internal.pagemem.PageIdUtils.flag) PageIdUtils.pageId(org.apache.ignite.internal.pagemem.PageIdUtils.pageId) StorageException(org.apache.ignite.internal.processors.cache.persistence.StorageException) FLAG_DATA(org.apache.ignite.internal.pagemem.PageIdAllocator.FLAG_DATA) MvccLeafIO(org.apache.ignite.internal.cache.query.index.sorted.inline.io.MvccLeafIO) ByteBuffer(java.nio.ByteBuffer) GridLongList(org.apache.ignite.internal.util.GridLongList) PAGE_STORE_VER(org.apache.ignite.internal.commandline.indexreader.IgniteIndexReader.Args.PAGE_STORE_VER) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) MvccDataLeafIO(org.apache.ignite.internal.processors.cache.tree.mvcc.data.MvccDataLeafIO) INDEXES(org.apache.ignite.internal.commandline.indexreader.IgniteIndexReader.Args.INDEXES) PendingRowIO(org.apache.ignite.internal.processors.cache.tree.PendingRowIO) FilePageStore(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore) BPlusLeafIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusLeafIO) Predicate(java.util.function.Predicate) IgniteException(org.apache.ignite.IgniteException) FilePageStoreManager(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager) CacheObject(org.apache.ignite.internal.processors.cache.CacheObject) DEST_FILE(org.apache.ignite.internal.commandline.indexreader.IgniteIndexReader.Args.DEST_FILE) String.format(java.lang.String.format) IgniteBiTuple(org.apache.ignite.lang.IgniteBiTuple) Objects(java.util.Objects) GridUnsafe.freeBuffer(org.apache.ignite.internal.util.GridUnsafe.freeBuffer) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) Pattern(java.util.regex.Pattern) AbstractInlineLeafIO(org.apache.ignite.internal.cache.query.index.sorted.inline.io.AbstractInlineLeafIO) CLIArgumentParser(org.apache.ignite.internal.commandline.argument.parser.CLIArgumentParser) Objects.nonNull(java.util.Objects.nonNull) InlineIO(org.apache.ignite.internal.cache.query.index.sorted.inline.io.InlineIO) FLAG_IDX(org.apache.ignite.internal.pagemem.PageIdAllocator.FLAG_IDX) IntStream(java.util.stream.IntStream) ProgressPrinter(org.apache.ignite.internal.commandline.ProgressPrinter) DataPagePayload(org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPagePayload) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) AtomicReference(java.util.concurrent.atomic.AtomicReference) HashSet(java.util.HashSet) PageMetaIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.PageMetaIO) IndexStorageImpl(org.apache.ignite.internal.processors.cache.persistence.IndexStorageImpl) GridUnsafe.bufferAddress(org.apache.ignite.internal.util.GridUnsafe.bufferAddress) PageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO) DIR(org.apache.ignite.internal.commandline.indexreader.IgniteIndexReader.Args.DIR) LinkedList(java.util.LinkedList) AbstractDataLeafIO(org.apache.ignite.internal.processors.cache.tree.AbstractDataLeafIO) OutputStream(java.io.OutputStream) PrintStream(java.io.PrintStream) RowLinkIO(org.apache.ignite.internal.processors.cache.tree.RowLinkIO) F(org.apache.ignite.internal.util.typedef.F) BPlusIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusIO) GridClosure3(org.apache.ignite.internal.util.lang.GridClosure3) Integer.parseInt(java.lang.Integer.parseInt) AbstractDataPageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.AbstractDataPageIO) BPlusInnerIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusInnerIO) LeafIO(org.apache.ignite.internal.cache.query.index.sorted.inline.io.LeafIO) CLIArgument(org.apache.ignite.internal.commandline.argument.parser.CLIArgument) Collectors.toList(java.util.stream.Collectors.toList) INDEX_FILE_NAME(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.INDEX_FILE_NAME) FileChannel(java.nio.channels.FileChannel) Collections(java.util.Collections) CHECK_PARTS(org.apache.ignite.internal.commandline.indexreader.IgniteIndexReader.Args.CHECK_PARTS) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) FilePageStore(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore) AtomicLong(java.util.concurrent.atomic.AtomicLong) Collections.singletonList(java.util.Collections.singletonList) Arrays.asList(java.util.Arrays.asList) ArrayList(java.util.ArrayList) GridLongList(org.apache.ignite.internal.util.GridLongList) List(java.util.List) LinkedList(java.util.LinkedList) Collectors.toList(java.util.stream.Collectors.toList) HashSet(java.util.HashSet)

Example 3 with FilePageStore

use of org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore in project ignite by apache.

the class IgniteIndexReaderFilePageStoreFactoryImpl method headerBuffer.

/**
 * {@inheritDoc}
 */
@Override
public ByteBuffer headerBuffer(byte type) throws IgniteCheckedException {
    int ver = storeFactory.latestVersion();
    FilePageStore store = (FilePageStore) storeFactory.createPageStore(type, (IgniteOutClosure<Path>) null, allocationTracker::add);
    return store.header(type, storeFactory.headerSize(ver));
}
Also used : FilePageStore(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore) IgniteOutClosure(org.apache.ignite.lang.IgniteOutClosure)

Example 4 with FilePageStore

use of org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore in project ignite by apache.

the class SnapshotPartitionsVerifyHandler method invoke.

/**
 * {@inheritDoc}
 */
@Override
public Map<PartitionKeyV2, PartitionHashRecordV2> invoke(SnapshotHandlerContext opCtx) throws IgniteCheckedException {
    SnapshotMetadata meta = opCtx.metadata();
    Set<Integer> grps = F.isEmpty(opCtx.groups()) ? new HashSet<>(meta.partitions().keySet()) : opCtx.groups().stream().map(CU::cacheId).collect(Collectors.toSet());
    Set<File> partFiles = new HashSet<>();
    IgniteSnapshotManager snpMgr = cctx.snapshotMgr();
    for (File dir : snpMgr.snapshotCacheDirectories(meta.snapshotName(), meta.folderName())) {
        int grpId = CU.cacheId(cacheGroupName(dir));
        if (!grps.remove(grpId))
            continue;
        Set<Integer> parts = meta.partitions().get(grpId) == null ? Collections.emptySet() : new HashSet<>(meta.partitions().get(grpId));
        for (File part : cachePartitionFiles(dir)) {
            int partId = partId(part.getName());
            if (!parts.remove(partId))
                continue;
            partFiles.add(part);
        }
        if (!parts.isEmpty()) {
            throw new IgniteException("Snapshot data doesn't contain required cache group partition " + "[grpId=" + grpId + ", snpName=" + meta.snapshotName() + ", consId=" + meta.consistentId() + ", missed=" + parts + ", meta=" + meta + ']');
        }
    }
    if (!grps.isEmpty()) {
        throw new IgniteException("Snapshot data doesn't contain required cache groups " + "[grps=" + grps + ", snpName=" + meta.snapshotName() + ", consId=" + meta.consistentId() + ", meta=" + meta + ']');
    }
    Map<PartitionKeyV2, PartitionHashRecordV2> res = new ConcurrentHashMap<>();
    ThreadLocal<ByteBuffer> buff = ThreadLocal.withInitial(() -> ByteBuffer.allocateDirect(meta.pageSize()).order(ByteOrder.nativeOrder()));
    GridKernalContext snpCtx = snpMgr.createStandaloneKernalContext(meta.snapshotName(), meta.folderName());
    for (GridComponent comp : snpCtx) comp.start();
    try {
        U.doInParallel(snpMgr.snapshotExecutorService(), partFiles, part -> {
            String grpName = cacheGroupName(part.getParentFile());
            int grpId = CU.cacheId(grpName);
            int partId = partId(part.getName());
            FilePageStoreManager storeMgr = (FilePageStoreManager) cctx.pageStore();
            try (FilePageStore pageStore = (FilePageStore) storeMgr.getPageStoreFactory(grpId, false).createPageStore(getTypeByPartId(partId), part::toPath, val -> {
            })) {
                if (partId == INDEX_PARTITION) {
                    checkPartitionsPageCrcSum(() -> pageStore, INDEX_PARTITION, FLAG_IDX);
                    return null;
                }
                if (grpId == MetaStorage.METASTORAGE_CACHE_ID) {
                    checkPartitionsPageCrcSum(() -> pageStore, partId, FLAG_DATA);
                    return null;
                }
                ByteBuffer pageBuff = buff.get();
                pageBuff.clear();
                pageStore.read(0, pageBuff, true);
                long pageAddr = GridUnsafe.bufferAddress(pageBuff);
                PagePartitionMetaIO io = PageIO.getPageIO(pageBuff);
                GridDhtPartitionState partState = fromOrdinal(io.getPartitionState(pageAddr));
                if (partState != OWNING) {
                    throw new IgniteCheckedException("Snapshot partitions must be in the OWNING " + "state only: " + partState);
                }
                long updateCntr = io.getUpdateCounter(pageAddr);
                long size = io.getSize(pageAddr);
                if (log.isDebugEnabled()) {
                    log.debug("Partition [grpId=" + grpId + ", id=" + partId + ", counter=" + updateCntr + ", size=" + size + "]");
                }
                // Snapshot partitions must always be in OWNING state.
                // There is no `primary` partitions for snapshot.
                PartitionKeyV2 key = new PartitionKeyV2(grpId, partId, grpName);
                PartitionHashRecordV2 hash = calculatePartitionHash(key, updateCntr, meta.consistentId(), GridDhtPartitionState.OWNING, false, size, snpMgr.partitionRowIterator(snpCtx, grpName, partId, pageStore));
                assert hash != null : "OWNING must have hash: " + key;
                res.put(key, hash);
            } catch (IOException e) {
                throw new IgniteCheckedException(e);
            }
            return null;
        });
    } catch (Throwable t) {
        log.error("Error executing handler: ", t);
        throw t;
    } finally {
        for (GridComponent comp : snpCtx) comp.stop(true);
    }
    return res;
}
Also used : FLAG_DATA(org.apache.ignite.internal.pagemem.PageIdAllocator.FLAG_DATA) PartitionHashRecordV2(org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2) IdleVerifyUtility.calculatePartitionHash(org.apache.ignite.internal.processors.cache.verify.IdleVerifyUtility.calculatePartitionHash) U(org.apache.ignite.internal.util.typedef.internal.U) HashMap(java.util.HashMap) IgniteLogger(org.apache.ignite.IgniteLogger) ByteBuffer(java.nio.ByteBuffer) IdleVerifyUtility.checkPartitionsPageCrcSum(org.apache.ignite.internal.processors.cache.verify.IdleVerifyUtility.checkPartitionsPageCrcSum) ArrayList(java.util.ArrayList) GridKernalContext(org.apache.ignite.internal.GridKernalContext) HashSet(java.util.HashSet) ClusterNode(org.apache.ignite.cluster.ClusterNode) PagePartitionMetaIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.PagePartitionMetaIO) GridDhtPartitionState.fromOrdinal(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.fromOrdinal) Map(java.util.Map) PageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO) FilePageStoreManager.cachePartitionFiles(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.cachePartitionFiles) GridDhtPartitionState(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState) FilePageStore(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore) GridStringBuilder(org.apache.ignite.internal.util.GridStringBuilder) F(org.apache.ignite.internal.util.typedef.F) FilePageStoreManager.cacheGroupName(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.cacheGroupName) Collection(java.util.Collection) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) GridComponent(org.apache.ignite.internal.GridComponent) Set(java.util.Set) GridUnsafe(org.apache.ignite.internal.util.GridUnsafe) IOException(java.io.IOException) FilePageStoreManager(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager) MetaStorage(org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage) OWNING(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.OWNING) Collectors(java.util.stream.Collectors) File(java.io.File) FilePageStoreManager.partId(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.partId) INDEX_PARTITION(org.apache.ignite.internal.pagemem.PageIdAllocator.INDEX_PARTITION) ByteOrder(java.nio.ByteOrder) List(java.util.List) GridCacheSharedContext(org.apache.ignite.internal.processors.cache.GridCacheSharedContext) PartitionKeyV2(org.apache.ignite.internal.processors.cache.verify.PartitionKeyV2) CU(org.apache.ignite.internal.util.typedef.internal.CU) GroupPartitionId.getTypeByPartId(org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId.getTypeByPartId) Collections(java.util.Collections) IdleVerifyResultV2(org.apache.ignite.internal.processors.cache.verify.IdleVerifyResultV2) FLAG_IDX(org.apache.ignite.internal.pagemem.PageIdAllocator.FLAG_IDX) GridKernalContext(org.apache.ignite.internal.GridKernalContext) GridComponent(org.apache.ignite.internal.GridComponent) FilePageStoreManager(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager) FilePageStore(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) PartitionKeyV2(org.apache.ignite.internal.processors.cache.verify.PartitionKeyV2) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashSet(java.util.HashSet) IOException(java.io.IOException) ByteBuffer(java.nio.ByteBuffer) CU(org.apache.ignite.internal.util.typedef.internal.CU) PartitionHashRecordV2(org.apache.ignite.internal.processors.cache.verify.PartitionHashRecordV2) GridDhtPartitionState(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState) PagePartitionMetaIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.PagePartitionMetaIO) File(java.io.File)

Example 5 with FilePageStore

use of org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore in project ignite by apache.

the class IgnitePdsDataRegionMetricsTest method checkMetricsConsistency.

/**
 */
private void checkMetricsConsistency(final IgniteEx node, String cacheName) throws Exception {
    FilePageStoreManager pageStoreMgr = (FilePageStoreManager) node.context().cache().context().pageStore();
    assert pageStoreMgr != null : "Persistence is not enabled";
    boolean metaStore = METASTORAGE_CACHE_NAME.equals(cacheName);
    boolean txLog = TX_LOG_CACHE_NAME.equals(cacheName);
    File cacheWorkDir = metaStore ? new File(pageStoreMgr.workDir(), METASTORAGE_DIR_NAME) : txLog ? new File(pageStoreMgr.workDir(), TX_LOG_CACHE_NAME) : pageStoreMgr.cacheWorkDir(node.cachex(cacheName).configuration());
    long totalPersistenceSize = 0;
    try (DirectoryStream<Path> files = newDirectoryStream(cacheWorkDir.toPath(), entry -> entry.toFile().getName().endsWith(".bin"))) {
        for (Path path : files) {
            File file = path.toFile();
            FilePageStore store = (FilePageStore) pageStoreMgr.getStore(metaStore ? METASTORAGE_CACHE_ID : CU.cacheId(cacheName), partId(file.getName()));
            int pageSize = store.getPageSize();
            long storeSize = path.toFile().length() - store.headerSize();
            if (storeSize % pageSize != 0)
                // Adjust for possible page compression.
                storeSize = (storeSize / pageSize + 1) * pageSize;
            totalPersistenceSize += storeSize;
        }
    }
    GridCacheSharedContext cctx = node.context().cache().context();
    String regionName = metaStore ? GridCacheDatabaseSharedManager.METASTORE_DATA_REGION_NAME : txLog ? TX_LOG_CACHE_NAME : cctx.cacheContext(CU.cacheId(cacheName)).group().dataRegion().config().getName();
    long totalAllocatedPagesFromMetrics = cctx.database().memoryMetrics(regionName).getTotalAllocatedPages();
    assertEquals("Number of allocated pages is different than in metrics for [node=" + node.name() + ", cache=" + cacheName + "]", totalPersistenceSize / pageStoreMgr.pageSize(), totalAllocatedPagesFromMetrics);
}
Also used : Path(java.nio.file.Path) FilePageStoreManager(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager) FilePageStore(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore) GridCacheSharedContext(org.apache.ignite.internal.processors.cache.GridCacheSharedContext) File(java.io.File)

Aggregations

FilePageStore (org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore)16 File (java.io.File)11 ByteBuffer (java.nio.ByteBuffer)11 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)10 ArrayList (java.util.ArrayList)9 IgniteException (org.apache.ignite.IgniteException)8 FilePageStoreManager (org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager)8 IOException (java.io.IOException)7 HashMap (java.util.HashMap)7 List (java.util.List)7 Map (java.util.Map)7 PageIO (org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO)7 Collections (java.util.Collections)6 HashSet (java.util.HashSet)6 Set (java.util.Set)6 IgniteEx (org.apache.ignite.internal.IgniteEx)6 PagePartitionMetaIO (org.apache.ignite.internal.processors.cache.persistence.tree.io.PagePartitionMetaIO)6 F (org.apache.ignite.internal.util.typedef.F)6 Path (java.nio.file.Path)5 Arrays (java.util.Arrays)5