Search in sources :

Example 1 with PageStoreWriter

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

the class IgnitePageMemReplaceDelayedWriteUnitTest method testBackwardCompatibilityMode.

/**
 * Test delayed eviction causes locking in page reads
 * @throws IgniteCheckedException if failed.
 */
@Test
public void testBackwardCompatibilityMode() throws IgniteCheckedException {
    IgniteConfiguration cfg = getConfiguration(16 * MB);
    AtomicInteger totalEvicted = new AtomicInteger();
    PageStoreWriter pageWriter = (FullPageId fullPageId, ByteBuffer byteBuf, int tag) -> {
        log.info("Evicting " + fullPageId);
        assert getSegment(fullPageId).writeLock().isHeldByCurrentThread();
        totalEvicted.incrementAndGet();
    };
    System.setProperty(IgniteSystemProperties.IGNITE_DELAYED_REPLACED_PAGE_WRITE, "false");
    int pageSize = 4096;
    PageMemoryImpl memory;
    try {
        memory = createPageMemory(cfg, pageWriter, pageSize);
    } finally {
        System.clearProperty(IgniteSystemProperties.IGNITE_DELAYED_REPLACED_PAGE_WRITE);
    }
    this.pageMemory = memory;
    long pagesTotal = cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration().getMaxSize() / pageSize;
    long markDirty = pagesTotal * 2 / 3;
    for (int i = 0; i < markDirty; i++) {
        long pageId = memory.allocatePage(1, 1, PageIdAllocator.FLAG_DATA);
        long ptr = memory.acquirePage(1, pageId);
        memory.releasePage(1, pageId, ptr);
    }
    GridMultiCollectionWrapper<FullPageId> ids = memory.beginCheckpoint(new GridFinishedFuture());
    int cpPages = ids.size();
    log.info("Started CP with [" + cpPages + "] pages in it, created [" + markDirty + "] pages");
    for (int i = 0; i < cpPages; i++) {
        long pageId = memory.allocatePage(1, 1, PageIdAllocator.FLAG_DATA);
        long ptr = memory.acquirePage(1, pageId);
        memory.releasePage(1, pageId, ptr);
    }
    assert totalEvicted.get() > 0;
    memory.stop(true);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ByteBuffer(java.nio.ByteBuffer) PageStoreWriter(org.apache.ignite.internal.processors.cache.persistence.PageStoreWriter) FullPageId(org.apache.ignite.internal.pagemem.FullPageId) GridFinishedFuture(org.apache.ignite.internal.util.future.GridFinishedFuture) Test(org.junit.Test)

Example 2 with PageStoreWriter

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

the class CheckpointPagesWriter method writePages.

/**
 * @param writePageIds Collections of pages to write.
 * @return pagesToRetry Pages which should be retried.
 */
private GridConcurrentMultiPairQueue<PageMemoryEx, FullPageId> writePages(GridConcurrentMultiPairQueue<PageMemoryEx, FullPageId> writePageIds) throws IgniteCheckedException {
    Map<PageMemoryEx, List<FullPageId>> pagesToRetry = new HashMap<>();
    CheckpointMetricsTracker tracker = persStoreMetrics.metricsEnabled() ? this.tracker : null;
    Map<PageMemoryEx, PageStoreWriter> pageStoreWriters = new HashMap<>();
    ByteBuffer tmpWriteBuf = threadBuf.get();
    boolean throttlingEnabled = throttlingPolicy != PageMemoryImpl.ThrottlingPolicy.DISABLED;
    GridConcurrentMultiPairQueue.Result<PageMemoryEx, FullPageId> res = new GridConcurrentMultiPairQueue.Result<>();
    while (writePageIds.next(res)) {
        if (shutdownNow.getAsBoolean())
            break;
        beforePageWrite.run();
        FullPageId fullId = res.getValue();
        PageMemoryEx pageMem = res.getKey();
        snapshotMgr.beforePageWrite(fullId);
        tmpWriteBuf.rewind();
        PageStoreWriter pageStoreWriter = pageStoreWriters.computeIfAbsent(pageMem, pageMemEx -> createPageStoreWriter(pageMemEx, pagesToRetry));
        pageMem.checkpointWritePage(fullId, tmpWriteBuf, pageStoreWriter, tracker);
        if (throttlingEnabled) {
            while (pageMem.isCpBufferOverflowThresholdExceeded()) {
                FullPageId cpPageId = pageMem.pullPageFromCpBuffer();
                if (cpPageId.equals(FullPageId.NULL_PAGE))
                    break;
                snapshotMgr.beforePageWrite(cpPageId);
                tmpWriteBuf.rewind();
                pageMem.checkpointWritePage(cpPageId, tmpWriteBuf, pageStoreWriter, tracker);
            }
        }
    }
    return pagesToRetry.isEmpty() ? GridConcurrentMultiPairQueue.EMPTY : new GridConcurrentMultiPairQueue<>(pagesToRetry);
}
Also used : HashMap(java.util.HashMap) ConcurrentLinkedHashMap(org.jsr166.ConcurrentLinkedHashMap) ByteBuffer(java.nio.ByteBuffer) PageStoreWriter(org.apache.ignite.internal.processors.cache.persistence.PageStoreWriter) PageMemoryEx(org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx) ArrayList(java.util.ArrayList) List(java.util.List) GridConcurrentMultiPairQueue(org.apache.ignite.internal.util.GridConcurrentMultiPairQueue) CheckpointMetricsTracker(org.apache.ignite.internal.processors.cache.persistence.pagemem.CheckpointMetricsTracker) FullPageId(org.apache.ignite.internal.pagemem.FullPageId)

Example 3 with PageStoreWriter

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

the class CheckpointPagesWriter method createPageStoreWriter.

/**
 * Factory method for create {@link PageStoreWriter}.
 *
 * @param pageMemEx
 * @param pagesToRetry List pages for retry.
 * @return Checkpoint page write context.
 */
private PageStoreWriter createPageStoreWriter(PageMemoryEx pageMemEx, Map<PageMemoryEx, List<FullPageId>> pagesToRetry) {
    return new PageStoreWriter() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void writePage(FullPageId fullPageId, ByteBuffer buf, int tag) throws IgniteCheckedException {
            if (tag == PageMemoryImpl.TRY_AGAIN_TAG) {
                pagesToRetry.computeIfAbsent(pageMemEx, k -> new ArrayList<>()).add(fullPageId);
                return;
            }
            int groupId = fullPageId.groupId();
            long pageId = fullPageId.pageId();
            assert getType(buf) != 0 : "Invalid state. Type is 0! pageId = " + hexLong(pageId);
            assert getVersion(buf) != 0 : "Invalid state. Version is 0! pageId = " + hexLong(pageId);
            if (persStoreMetrics.metricsEnabled()) {
                int pageType = getType(buf);
                if (PageIO.isDataPageType(pageType))
                    tracker.onDataPageWritten();
            }
            curCpProgress.updateWrittenPages(1);
            PageStore store = pageWriter.write(pageMemEx, fullPageId, buf, tag);
            updStores.computeIfAbsent(store, k -> new LongAdder()).increment();
        }
    };
}
Also used : LongAdder(java.util.concurrent.atomic.LongAdder) PageStore(org.apache.ignite.internal.pagemem.store.PageStore) FullPageId(org.apache.ignite.internal.pagemem.FullPageId) DataStorageMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataStorageMetricsImpl) CheckpointMetricsTracker(org.apache.ignite.internal.processors.cache.persistence.pagemem.CheckpointMetricsTracker) IgniteUtils.hexLong(org.apache.ignite.internal.util.IgniteUtils.hexLong) HashMap(java.util.HashMap) IgniteLogger(org.apache.ignite.IgniteLogger) ByteBuffer(java.nio.ByteBuffer) ArrayList(java.util.ArrayList) BooleanSupplier(java.util.function.BooleanSupplier) ConcurrentLinkedHashMap(org.jsr166.ConcurrentLinkedHashMap) PageIO.getVersion(org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO.getVersion) Map(java.util.Map) PageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO) IgniteThrowableFunction(org.apache.ignite.internal.util.lang.IgniteThrowableFunction) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) CountDownFuture(org.apache.ignite.internal.util.future.CountDownFuture) PageIO.getType(org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO.getType) PageMemoryImpl(org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl) List(java.util.List) PageMemoryEx(org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx) PageStoreWriter(org.apache.ignite.internal.processors.cache.persistence.PageStoreWriter) IgniteCacheSnapshotManager(org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteCacheSnapshotManager) GridConcurrentMultiPairQueue(org.apache.ignite.internal.util.GridConcurrentMultiPairQueue) LongAdder(java.util.concurrent.atomic.LongAdder) ArrayList(java.util.ArrayList) PageStore(org.apache.ignite.internal.pagemem.store.PageStore) ByteBuffer(java.nio.ByteBuffer) PageStoreWriter(org.apache.ignite.internal.processors.cache.persistence.PageStoreWriter) FullPageId(org.apache.ignite.internal.pagemem.FullPageId)

Example 4 with PageStoreWriter

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

the class PageMemoryImplTest method doCheckpoint.

/**
 * @param cpPages Checkpoint pages acuiqred by {@code beginCheckpoint()}.
 * @param memory Page memory.
 * @param pageStoreMgr Test page store manager.
 * @throws Exception If failed.
 */
private void doCheckpoint(GridMultiCollectionWrapper<FullPageId> cpPages, PageMemoryImpl memory, TestPageStoreManager pageStoreMgr) throws Exception {
    PageStoreWriter pageStoreWriter = (fullPageId, buf, tag) -> {
        assertNotNull(tag);
        pageStoreMgr.write(fullPageId.groupId(), fullPageId.pageId(), buf, 1, false);
    };
    for (FullPageId cpPage : cpPages) {
        byte[] data = new byte[PAGE_SIZE];
        ByteBuffer buf = ByteBuffer.wrap(data);
        memory.checkpointWritePage(cpPage, buf, pageStoreWriter, null);
        while (memory.isCpBufferOverflowThresholdExceeded()) {
            FullPageId cpPageId = memory.pullPageFromCpBuffer();
            if (cpPageId.equals(FullPageId.NULL_PAGE))
                break;
            ByteBuffer tmpWriteBuf = ByteBuffer.allocateDirect(memory.pageSize());
            tmpWriteBuf.order(ByteOrder.nativeOrder());
            tmpWriteBuf.rewind();
            memory.checkpointWritePage(cpPageId, tmpWriteBuf, pageStoreWriter, null);
        }
    }
    memory.finishCheckpoint();
}
Also used : PageStore(org.apache.ignite.internal.pagemem.store.PageStore) GridFinishedFuture(org.apache.ignite.internal.util.future.GridFinishedFuture) ByteBuffer(java.nio.ByteBuffer) NoopMetricExporterSpi(org.apache.ignite.spi.metric.noop.NoopMetricExporterSpi) GridSystemViewManager(org.apache.ignite.internal.managers.systemview.GridSystemViewManager) UnsafeMemoryProvider(org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider) IgnitePluginProcessor(org.apache.ignite.internal.processors.plugin.IgnitePluginProcessor) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) LongAdderMetric(org.apache.ignite.internal.processors.metric.impl.LongAdderMetric) Map(java.util.Map) PageUtils(org.apache.ignite.internal.pagemem.PageUtils) GridTestLog4jLogger(org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger) FailureProcessor(org.apache.ignite.internal.processors.failure.FailureProcessor) CheckpointProgressImpl(org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointProgressImpl) IgniteInClosure(org.apache.ignite.lang.IgniteInClosure) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) IgniteOutClosure(org.apache.ignite.lang.IgniteOutClosure) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) DirectMemoryProvider(org.apache.ignite.internal.mem.DirectMemoryProvider) GridInternalSubscriptionProcessor(org.apache.ignite.internal.processors.subscription.GridInternalSubscriptionProcessor) GridTestUtils(org.apache.ignite.testframework.GridTestUtils) INDEX_PARTITION(org.apache.ignite.internal.pagemem.PageIdAllocator.INDEX_PARTITION) ByteOrder(java.nio.ByteOrder) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) IgnitePageStoreManager(org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager) PerformanceStatisticsProcessor(org.apache.ignite.internal.processors.performancestatistics.PerformanceStatisticsProcessor) IgniteFutureTimeoutCheckedException(org.apache.ignite.internal.IgniteFutureTimeoutCheckedException) IgniteOutOfMemoryException(org.apache.ignite.internal.mem.IgniteOutOfMemoryException) JmxSystemViewExporterSpi(org.apache.ignite.internal.managers.systemview.JmxSystemViewExporterSpi) FLAG_IDX(org.apache.ignite.internal.pagemem.PageIdAllocator.FLAG_IDX) CHECKPOINT_POOL_OVERFLOW_ERROR_MSG(org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl.CHECKPOINT_POOL_OVERFLOW_ERROR_MSG) FullPageId(org.apache.ignite.internal.pagemem.FullPageId) DataRegionMetricsImpl(org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl) GridMultiCollectionWrapper(org.apache.ignite.internal.util.GridMultiCollectionWrapper) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) CheckpointProgress(org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointProgress) U(org.apache.ignite.internal.util.typedef.internal.U) HashMap(java.util.HashMap) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) NoopEventStorageSpi(org.apache.ignite.spi.eventstorage.NoopEventStorageSpi) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) PageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO) GridEncryptionManager(org.apache.ignite.internal.managers.encryption.GridEncryptionManager) NoOpFailureHandler(org.apache.ignite.failure.NoOpFailureHandler) NoopEncryptionSpi(org.apache.ignite.spi.encryption.noop.NoopEncryptionSpi) Test(org.junit.Test) IgniteCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager) GridTestKernalContext(org.apache.ignite.testframework.junits.GridTestKernalContext) Mockito(org.mockito.Mockito) GridCacheSharedContext(org.apache.ignite.internal.processors.cache.GridCacheSharedContext) PluginProvider(org.apache.ignite.plugin.PluginProvider) DummyPageIO(org.apache.ignite.internal.processors.cache.persistence.DummyPageIO) PageStoreWriter(org.apache.ignite.internal.processors.cache.persistence.PageStoreWriter) GridMetricManager(org.apache.ignite.internal.processors.metric.GridMetricManager) GridInClosure3X(org.apache.ignite.internal.util.lang.GridInClosure3X) GridEventStorageManager(org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager) Collections(java.util.Collections) ByteBuffer(java.nio.ByteBuffer) PageStoreWriter(org.apache.ignite.internal.processors.cache.persistence.PageStoreWriter) FullPageId(org.apache.ignite.internal.pagemem.FullPageId)

Example 5 with PageStoreWriter

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

the class IgnitePdsCheckpointSimulationWithRealCpDisabledTest method runCheckpointing.

/**
 * @param mem Memory to use.
 * @param storeMgr Store manager.
 * @param cacheId Cache ID.
 * @return Result map of random operations.
 * @throws Exception If failure occurred.
 */
private IgniteBiTuple<Map<FullPageId, Integer>, WALPointer> runCheckpointing(final IgniteEx ig, final PageMemoryImpl mem, final IgnitePageStoreManager storeMgr, final IgniteWriteAheadLogManager wal, final int cacheId) throws Exception {
    final ConcurrentMap<FullPageId, Integer> resMap = new ConcurrentHashMap<>();
    final FullPageId[] pages = new FullPageId[TOTAL_PAGES];
    Set<FullPageId> allocated = new HashSet<>();
    IgniteCacheDatabaseSharedManager db = ig.context().cache().context().database();
    PageIO pageIO = new DummyPageIO();
    for (int i = 0; i < TOTAL_PAGES; i++) {
        FullPageId fullId;
        db.checkpointReadLock();
        try {
            fullId = new FullPageId(mem.allocatePage(cacheId, 0, PageIdAllocator.FLAG_DATA), cacheId);
            initPage(mem, pageIO, fullId);
        } finally {
            db.checkpointReadUnlock();
        }
        resMap.put(fullId, -1);
        pages[i] = fullId;
        allocated.add(fullId);
    }
    final AtomicBoolean run = new AtomicBoolean(true);
    // Simulate transaction lock.
    final ReadWriteLock updLock = new ReentrantReadWriteLock();
    // Mark the start position.
    CheckpointRecord cpRec = new CheckpointRecord(null);
    WALPointer start = wal.log(cpRec);
    wal.flush(start, false);
    IgniteInternalFuture<Long> updFut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {

        @Override
        public Object call() throws Exception {
            while (true) {
                FullPageId fullId = pages[ThreadLocalRandom.current().nextInt(TOTAL_PAGES)];
                updLock.readLock().lock();
                try {
                    if (!run.get())
                        return null;
                    ig.context().cache().context().database().checkpointReadLock();
                    try {
                        long page = mem.acquirePage(fullId.groupId(), fullId.pageId());
                        try {
                            long pageAddr = mem.writeLock(fullId.groupId(), fullId.pageId(), page);
                            PageIO.setPageId(pageAddr, fullId.pageId());
                            try {
                                int state = resMap.get(fullId);
                                if (state != -1) {
                                    if (VERBOSE)
                                        info("Verify page [fullId=" + fullId + ", state=" + state + ", buf=" + pageAddr + ", bhc=" + U.hexLong(System.identityHashCode(pageAddr)) + ", page=" + U.hexLong(System.identityHashCode(page)) + ']');
                                    for (int i = PageIO.COMMON_HEADER_END; i < mem.realPageSize(fullId.groupId()); i++) {
                                        assertEquals("Verify page failed [fullId=" + fullId + ", i=" + i + ", state=" + state + ", buf=" + pageAddr + ", bhc=" + U.hexLong(System.identityHashCode(pageAddr)) + ", page=" + U.hexLong(System.identityHashCode(page)) + ']', state & 0xFF, PageUtils.getByte(pageAddr, i) & 0xFF);
                                    }
                                }
                                state = (state + 1) & 0xFF;
                                if (VERBOSE)
                                    info("Write page [fullId=" + fullId + ", state=" + state + ", buf=" + pageAddr + ", bhc=" + U.hexLong(System.identityHashCode(pageAddr)) + ", page=" + U.hexLong(System.identityHashCode(page)) + ']');
                                for (int i = PageIO.COMMON_HEADER_END; i < mem.realPageSize(fullId.groupId()); i++) PageUtils.putByte(pageAddr, i, (byte) state);
                                resMap.put(fullId, state);
                            } finally {
                                mem.writeUnlock(fullId.groupId(), fullId.pageId(), page, null, true);
                            }
                        } finally {
                            mem.releasePage(fullId.groupId(), fullId.pageId(), page);
                        }
                    } finally {
                        ig.context().cache().context().database().checkpointReadUnlock();
                    }
                } finally {
                    updLock.readLock().unlock();
                }
            }
        }
    }, 8, "update-thread");
    int checkpoints = 20;
    while (checkpoints > 0) {
        Map<FullPageId, Integer> snapshot = null;
        Collection<FullPageId> pageIds;
        updLock.writeLock().lock();
        try {
            snapshot = new HashMap<>(resMap);
            pageIds = mem.beginCheckpoint(new GridFinishedFuture());
            checkpoints--;
            if (checkpoints == 0)
                // No more writes should be done at this point.
                run.set(false);
            info("Acquired pages for checkpoint: " + pageIds.size());
        } finally {
            updLock.writeLock().unlock();
        }
        boolean ok = false;
        try {
            ByteBuffer tmpBuf = ByteBuffer.allocate(mem.pageSize());
            tmpBuf.order(ByteOrder.nativeOrder());
            long begin = System.currentTimeMillis();
            long cp = 0;
            long write = 0;
            for (FullPageId fullId : pageIds) {
                long cpStart = System.nanoTime();
                Integer tag;
                AtomicReference<Integer> tag0 = new AtomicReference<>();
                PageStoreWriter pageStoreWriter = (fullPageId, buf, tagx) -> {
                    tag0.set(tagx);
                };
                while (true) {
                    mem.checkpointWritePage(fullId, tmpBuf, pageStoreWriter, null);
                    tag = tag0.get();
                    if (tag != null && tag == PageMemoryImpl.TRY_AGAIN_TAG)
                        continue;
                    break;
                }
                if (tag == null)
                    continue;
                long cpEnd = System.nanoTime();
                cp += cpEnd - cpStart;
                Integer state = snapshot.get(fullId);
                if (allocated.contains(fullId) && state != -1) {
                    tmpBuf.rewind();
                    Integer first = null;
                    for (int i = PageIO.COMMON_HEADER_END; i < mem.realPageSize(fullId.groupId()); i++) {
                        int val = tmpBuf.get(i) & 0xFF;
                        if (first == null)
                            first = val;
                        // Avoid string concat.
                        if (first != val)
                            assertEquals("Corrupted buffer at position [pageId=" + fullId + ", pos=" + i + ']', (int) first, val);
                        // Avoid string concat.
                        if (state != val)
                            assertEquals("Invalid value at position [pageId=" + fullId + ", pos=" + i + ']', (int) state, val);
                    }
                }
                tmpBuf.rewind();
                long writeStart = System.nanoTime();
                storeMgr.write(cacheId, fullId.pageId(), tmpBuf, tag, true);
                long writeEnd = System.nanoTime();
                write += writeEnd - writeStart;
                tmpBuf.rewind();
            }
            long syncStart = System.currentTimeMillis();
            storeMgr.sync(cacheId, 0);
            long end = System.currentTimeMillis();
            info("Written pages in " + (end - begin) + "ms, copy took " + (cp / 1_000_000) + "ms, " + "write took " + (write / 1_000_000) + "ms, sync took " + (end - syncStart) + "ms");
            ok = true;
        } finally {
            info("Finishing checkpoint...");
            mem.finishCheckpoint();
            info("Finished checkpoint");
            if (!ok) {
                info("Cancelling updates...");
                run.set(false);
                updFut.get();
            }
        }
        if (checkpoints != 0)
            Thread.sleep(2_000);
    }
    info("checkpoints=" + checkpoints + ", done=" + updFut.isDone());
    updFut.get();
    assertEquals(0, mem.activePagesCount());
    for (FullPageId fullId : pages) {
        long page = mem.acquirePage(fullId.groupId(), fullId.pageId());
        try {
            assertFalse("Page has a temp heap copy after the last checkpoint: [cacheId=" + fullId.groupId() + ", pageId=" + fullId.pageId() + "]", mem.hasTempCopy(page));
            assertFalse("Page is dirty after the last checkpoint: [cacheId=" + fullId.groupId() + ", pageId=" + fullId.pageId() + "]", mem.isDirty(fullId.groupId(), fullId.pageId(), page));
        } finally {
            mem.releasePage(fullId.groupId(), fullId.pageId(), page);
        }
    }
    return F.t((Map<FullPageId, Integer>) resMap, start);
}
Also used : CacheAtomicityMode(org.apache.ignite.cache.CacheAtomicityMode) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) GridFinishedFuture(org.apache.ignite.internal.util.future.GridFinishedFuture) IgniteEx(org.apache.ignite.internal.IgniteEx) CacheRebalanceMode(org.apache.ignite.cache.CacheRebalanceMode) WALPointer(org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer) ByteBuffer(java.nio.ByteBuffer) Map(java.util.Map) PageUtils(org.apache.ignite.internal.pagemem.PageUtils) ReadWriteLock(java.util.concurrent.locks.ReadWriteLock) WALMode(org.apache.ignite.configuration.WALMode) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) PageIdAllocator(org.apache.ignite.internal.pagemem.PageIdAllocator) Collection(java.util.Collection) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) WALRecord(org.apache.ignite.internal.pagemem.wal.record.WALRecord) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) UUID(java.util.UUID) CacheObject(org.apache.ignite.internal.processors.cache.CacheObject) DataRecord(org.apache.ignite.internal.pagemem.wal.record.DataRecord) DataEntry(org.apache.ignite.internal.pagemem.wal.record.DataEntry) GridCacheOperation(org.apache.ignite.internal.processors.cache.GridCacheOperation) IgniteBiTuple(org.apache.ignite.lang.IgniteBiTuple) GridTestUtils(org.apache.ignite.testframework.GridTestUtils) ByteOrder(java.nio.ByteOrder) List(java.util.List) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) IgnitePageStoreManager(org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager) IgniteWriteAheadLogManager(org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager) GridCacheContext(org.apache.ignite.internal.processors.cache.GridCacheContext) KeyCacheObject(org.apache.ignite.internal.processors.cache.KeyCacheObject) PageSnapshot(org.apache.ignite.internal.pagemem.wal.record.PageSnapshot) FullPageId(org.apache.ignite.internal.pagemem.FullPageId) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) U(org.apache.ignite.internal.util.typedef.internal.U) HashMap(java.util.HashMap) Callable(java.util.concurrent.Callable) PageMemory(org.apache.ignite.internal.pagemem.PageMemory) ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) ConcurrentMap(java.util.concurrent.ConcurrentMap) GridKernalContext(org.apache.ignite.internal.GridKernalContext) HashSet(java.util.HashSet) GridCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager) MvccDataRecord(org.apache.ignite.internal.pagemem.wal.record.MvccDataRecord) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) PageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO) MvccDataEntry(org.apache.ignite.internal.pagemem.wal.record.MvccDataEntry) F(org.apache.ignite.internal.util.typedef.F) Test(org.junit.Test) CheckpointRecord(org.apache.ignite.internal.pagemem.wal.record.CheckpointRecord) GridCloseableIterator(org.apache.ignite.internal.util.lang.GridCloseableIterator) PageMemoryImpl(org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl) PartitionMetaStateRecord(org.apache.ignite.internal.pagemem.wal.record.delta.PartitionMetaStateRecord) IgniteCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager) GridCacheSharedContext(org.apache.ignite.internal.processors.cache.GridCacheSharedContext) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) DummyPageIO(org.apache.ignite.internal.processors.cache.persistence.DummyPageIO) MvccVersionImpl(org.apache.ignite.internal.processors.cache.mvcc.MvccVersionImpl) PageMemoryEx(org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx) DataPageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO) PageStoreWriter(org.apache.ignite.internal.processors.cache.persistence.PageStoreWriter) GridFilteredClosableIterator(org.apache.ignite.internal.util.lang.GridFilteredClosableIterator) CacheObjectContext(org.apache.ignite.internal.processors.cache.CacheObjectContext) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) TrackingPageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.TrackingPageIO) ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) GridFinishedFuture(org.apache.ignite.internal.util.future.GridFinishedFuture) PageStoreWriter(org.apache.ignite.internal.processors.cache.persistence.PageStoreWriter) ReadWriteLock(java.util.concurrent.locks.ReadWriteLock) ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) WALPointer(org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer) FullPageId(org.apache.ignite.internal.pagemem.FullPageId) HashSet(java.util.HashSet) PageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO) DummyPageIO(org.apache.ignite.internal.processors.cache.persistence.DummyPageIO) DataPageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO) TrackingPageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.TrackingPageIO) CheckpointRecord(org.apache.ignite.internal.pagemem.wal.record.CheckpointRecord) AtomicReference(java.util.concurrent.atomic.AtomicReference) DummyPageIO(org.apache.ignite.internal.processors.cache.persistence.DummyPageIO) ByteBuffer(java.nio.ByteBuffer) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) CacheObject(org.apache.ignite.internal.processors.cache.CacheObject) KeyCacheObject(org.apache.ignite.internal.processors.cache.KeyCacheObject) IgniteCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager)

Aggregations

ByteBuffer (java.nio.ByteBuffer)6 FullPageId (org.apache.ignite.internal.pagemem.FullPageId)6 PageStoreWriter (org.apache.ignite.internal.processors.cache.persistence.PageStoreWriter)6 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 List (java.util.List)4 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)4 GridFinishedFuture (org.apache.ignite.internal.util.future.GridFinishedFuture)4 Test (org.junit.Test)4 Map (java.util.Map)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)3 PageMemoryEx (org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx)3 PageIO (org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO)3 ByteOrder (java.nio.ByteOrder)2 Collection (java.util.Collection)2 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)2