Search in sources :

Example 1 with GridIterator

use of org.apache.ignite.internal.util.lang.GridIterator in project ignite by apache.

the class IgnitePdsPartitionPreloadTest method preloadPartition.

/**
 * @param execNodeFactory Test node factory.
 * @param preloadMode Preload mode.
 */
private void preloadPartition(Supplier<Ignite> execNodeFactory, PreloadMode preloadMode) throws Exception {
    Ignite crd = startGridsMultiThreaded(GRIDS_CNT);
    Ignite testNode = grid(1);
    Object consistentId = testNode.cluster().localNode().consistentId();
    assertEquals(PRIMARY_NODE, testNode.cluster().localNode().consistentId());
    boolean locCacheMode = testNode.cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode() == LOCAL;
    Integer key = primaryKey(testNode.cache(DEFAULT_CACHE_NAME));
    int preloadPart = crd.affinity(DEFAULT_CACHE_NAME).partition(key);
    int cnt = 0;
    try (IgniteDataStreamer<Integer, Integer> streamer = testNode.dataStreamer(DEFAULT_CACHE_NAME)) {
        int k = 0;
        while (cnt < ENTRY_CNT) {
            if (testNode.affinity(DEFAULT_CACHE_NAME).partition(k) == preloadPart) {
                streamer.addData(k, k);
                cnt++;
            }
            k++;
        }
    }
    forceCheckpoint();
    stopAllGrids();
    startGridsMultiThreaded(GRIDS_CNT);
    testNode = G.allGrids().stream().filter(ignite -> PRIMARY_NODE.equals(ignite.cluster().localNode().consistentId())).findFirst().get();
    if (!locCacheMode)
        assertEquals(testNode, primaryNode(key, DEFAULT_CACHE_NAME));
    Ignite execNode = execNodeFactory.get();
    switch(preloadMode) {
        case SYNC:
            execNode.cache(DEFAULT_CACHE_NAME).preloadPartition(preloadPart);
            if (locCacheMode) {
                testNode = G.allGrids().stream().filter(ignite -> ignite.cluster().localNode().consistentId().equals(consistentId)).findFirst().get();
            }
            break;
        case ASYNC:
            execNode.cache(DEFAULT_CACHE_NAME).preloadPartitionAsync(preloadPart).get();
            if (locCacheMode) {
                testNode = G.allGrids().stream().filter(ignite -> ignite.cluster().localNode().consistentId().equals(consistentId)).findFirst().get();
            }
            break;
        case LOCAL:
            assertTrue(execNode.cache(DEFAULT_CACHE_NAME).localPreloadPartition(preloadPart));
            // For local preloading testNode == execNode
            testNode = execNode;
            break;
    }
    long c0 = testNode.dataRegionMetrics(DEFAULT_REGION).getPagesRead();
    // After partition preloading no pages should be read from store.
    GridIterator<CacheDataRow> cursor = ((IgniteEx) testNode).cachex(DEFAULT_CACHE_NAME).context().offheap().cachePartitionIterator(CU.UNDEFINED_CACHE_ID, preloadPart, null, false);
    int realSize = 0;
    while (cursor.hasNext()) {
        realSize++;
        cursor.next();
    }
    assertEquals("Partition has missed some entries", ENTRY_CNT, realSize);
    assertEquals("Read pages count must be same", c0, testNode.dataRegionMetrics(DEFAULT_REGION).getPagesRead());
}
Also used : CacheAtomicityMode(org.apache.ignite.cache.CacheAtomicityMode) TRANSACTIONAL_SNAPSHOT(org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT) IgniteEx(org.apache.ignite.internal.IgniteEx) Supplier(java.util.function.Supplier) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) ClusterNode(org.apache.ignite.cluster.ClusterNode) IgnitePredicate(org.apache.ignite.lang.IgnitePredicate) CacheWriteSynchronizationMode(org.apache.ignite.cache.CacheWriteSynchronizationMode) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) G(org.apache.ignite.internal.util.typedef.G) WALMode(org.apache.ignite.configuration.WALMode) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) LOCAL(org.apache.ignite.cache.CacheMode.LOCAL) Predicate(java.util.function.Predicate) Test(org.junit.Test) Ignite(org.apache.ignite.Ignite) CacheDataRow(org.apache.ignite.internal.processors.cache.persistence.CacheDataRow) TRANSACTIONAL(org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL) GridIterator(org.apache.ignite.internal.util.lang.GridIterator) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) Ignore(org.junit.Ignore) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) CU(org.apache.ignite.internal.util.typedef.internal.CU) IgniteDataStreamer(org.apache.ignite.IgniteDataStreamer) ATOMIC(org.apache.ignite.cache.CacheAtomicityMode.ATOMIC) Collections(java.util.Collections) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) CacheDataRow(org.apache.ignite.internal.processors.cache.persistence.CacheDataRow) Ignite(org.apache.ignite.Ignite)

Example 2 with GridIterator

use of org.apache.ignite.internal.util.lang.GridIterator in project ignite by apache.

the class VisorFindAndDeleteGarbageInPersistenceClosure method processPartition.

/**
 * @param grpCtx Group context.
 * @param part Local partition.
 */
private Map<Integer, Map<Integer, Long>> processPartition(CacheGroupContext grpCtx, GridDhtLocalPartition part) {
    if (!part.reserve())
        return Collections.emptyMap();
    Map<Integer, Map<Integer, Long>> stoppedCachesForGrpId = new HashMap<>();
    try {
        if (part.state() != GridDhtPartitionState.OWNING)
            return Collections.emptyMap();
        GridIterator<CacheDataRow> it = grpCtx.offheap().partitionIterator(part.id());
        while (it.hasNextX()) {
            CacheDataRow row = it.nextX();
            if (row.cacheId() == 0)
                break;
            int cacheId = row.cacheId();
            GridCacheContext cacheCtx = grpCtx.shared().cacheContext(row.cacheId());
            if (cacheCtx == null)
                stoppedCachesForGrpId.computeIfAbsent(grpCtx.groupId(), (x) -> new HashMap<>()).compute(cacheId, (x, y) -> y == null ? 1 : y + 1);
        }
    } catch (IgniteCheckedException e) {
        U.error(log, "Failed to process partition [grpId=" + grpCtx.groupId() + ", partId=" + part.id() + "]", e);
        return Collections.emptyMap();
    } finally {
        part.release();
    }
    processedPartitions.incrementAndGet();
    printProgressIfNeeded();
    return stoppedCachesForGrpId;
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) CacheDataRow(org.apache.ignite.internal.processors.cache.persistence.CacheDataRow) U(org.apache.ignite.internal.util.typedef.internal.U) HashMap(java.util.HashMap) Callable(java.util.concurrent.Callable) IgniteLogger(org.apache.ignite.IgniteLogger) IgniteEx(org.apache.ignite.internal.IgniteEx) CacheGroupContext(org.apache.ignite.internal.processors.cache.CacheGroupContext) ArrayList(java.util.ArrayList) IgniteCallable(org.apache.ignite.lang.IgniteCallable) HashSet(java.util.HashSet) Future(java.util.concurrent.Future) GridCacheOffheapManager(org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) IgniteInterruptedException(org.apache.ignite.IgniteInterruptedException) GridDhtPartitionState(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState) LoggerResource(org.apache.ignite.resources.LoggerResource) ExecutorService(java.util.concurrent.ExecutorService) F(org.apache.ignite.internal.util.typedef.F) Collection(java.util.Collection) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) Set(java.util.Set) IgniteInstanceResource(org.apache.ignite.resources.IgniteInstanceResource) CacheDataRow(org.apache.ignite.internal.processors.cache.persistence.CacheDataRow) Executors(java.util.concurrent.Executors) GridIterator(org.apache.ignite.internal.util.lang.GridIterator) T2(org.apache.ignite.internal.util.typedef.T2) ExecutionException(java.util.concurrent.ExecutionException) AtomicLong(java.util.concurrent.atomic.AtomicLong) GridDhtLocalPartition(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition) List(java.util.List) CU(org.apache.ignite.internal.util.typedef.internal.CU) GridCacheContext(org.apache.ignite.internal.processors.cache.GridCacheContext) Collections(java.util.Collections) GridCacheContext(org.apache.ignite.internal.processors.cache.GridCacheContext) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with GridIterator

use of org.apache.ignite.internal.util.lang.GridIterator in project ignite by apache.

the class ValidateIndexesClosure method calcCacheSize.

/**
 * Calculation of caches size with divided by tables.
 *
 * @param grpCtx Cache group context.
 * @param locPart Local partition.
 * @return Cache size representation object.
 */
private CacheSize calcCacheSize(CacheGroupContext grpCtx, GridDhtLocalPartition locPart) {
    try {
        if (validateCtx.isCancelled())
            return new CacheSize(null, emptyMap());
        @Nullable PartitionUpdateCounter updCntr = locPart.dataStore().partUpdateCounter();
        PartitionUpdateCounter updateCntrBefore = updCntr == null ? updCntr : updCntr.copy();
        int grpId = grpCtx.groupId();
        if (failCalcCacheSizeGrpIds.contains(grpId))
            return new CacheSize(null, null);
        boolean reserve = false;
        int partId = locPart.id();
        try {
            if (!(reserve = locPart.reserve()))
                throw new IgniteException("Can't reserve partition");
            if (locPart.state() != OWNING)
                throw new IgniteException("Partition not in state " + OWNING);
            Map<Integer, Map<String, AtomicLong>> cacheSizeByTbl = new HashMap<>();
            GridIterator<CacheDataRow> partIter = grpCtx.offheap().partitionIterator(partId);
            GridQueryProcessor qryProcessor = ignite.context().query();
            IgniteH2Indexing h2Indexing = (IgniteH2Indexing) qryProcessor.getIndexing();
            while (partIter.hasNextX() && !failCalcCacheSizeGrpIds.contains(grpId)) {
                CacheDataRow cacheDataRow = partIter.nextX();
                int cacheId = cacheDataRow.cacheId();
                GridCacheContext cacheCtx = cacheId == 0 ? grpCtx.singleCacheContext() : grpCtx.shared().cacheContext(cacheId);
                if (cacheCtx == null)
                    throw new IgniteException("Unknown cacheId of CacheDataRow: " + cacheId);
                if (cacheDataRow.link() == 0L)
                    throw new IgniteException("Contains invalid partition row, possibly deleted");
                String cacheName = cacheCtx.name();
                QueryTypeDescriptorImpl qryTypeDesc = qryProcessor.typeByValue(cacheName, cacheCtx.cacheObjectContext(), cacheDataRow.key(), cacheDataRow.value(), true);
                if (isNull(qryTypeDesc))
                    // Tolerate - (k, v) is just not indexed.
                    continue;
                String tableName = qryTypeDesc.tableName();
                GridH2Table gridH2Tbl = h2Indexing.schemaManager().dataTable(cacheName, tableName);
                if (isNull(gridH2Tbl))
                    // Tolerate - (k, v) is just not indexed.
                    continue;
                cacheSizeByTbl.computeIfAbsent(cacheCtx.cacheId(), i -> new HashMap<>()).computeIfAbsent(tableName, s -> new AtomicLong()).incrementAndGet();
            }
            PartitionUpdateCounter updateCntrAfter = locPart.dataStore().partUpdateCounter();
            if (updateCntrAfter != null && !updateCntrAfter.equals(updateCntrBefore)) {
                throw new GridNotIdleException(GRID_NOT_IDLE_MSG + "[grpName=" + grpCtx.cacheOrGroupName() + ", grpId=" + grpCtx.groupId() + ", partId=" + locPart.id() + "] changed during size " + "calculation [updCntrBefore=" + updateCntrBefore + ", updCntrAfter=" + updateCntrAfter + "]");
            }
            return new CacheSize(null, cacheSizeByTbl);
        } catch (Throwable t) {
            IgniteException cacheSizeErr = new IgniteException("Cache size calculation error [" + cacheGrpInfo(grpCtx) + ", locParId=" + partId + ", err=" + t.getMessage() + "]", t);
            error(log, cacheSizeErr);
            failCalcCacheSizeGrpIds.add(grpId);
            return new CacheSize(cacheSizeErr, null);
        } finally {
            if (reserve)
                locPart.release();
        }
    } finally {
        processedCacheSizePartitions.incrementAndGet();
        printProgressOfIndexValidationIfNeeded();
    }
}
Also used : CacheDataRow(org.apache.ignite.internal.processors.cache.persistence.CacheDataRow) Collections.shuffle(java.util.Collections.shuffle) IgniteEx(org.apache.ignite.internal.IgniteEx) DbException(org.h2.message.DbException) H2Utils(org.apache.ignite.internal.processors.query.h2.H2Utils) Index(org.h2.index.Index) IdleVerifyUtility.checkPartitionsPageCrcSum(org.apache.ignite.internal.processors.cache.verify.IdleVerifyUtility.checkPartitionsPageCrcSum) ConnectionManager(org.apache.ignite.internal.processors.query.h2.ConnectionManager) Future(java.util.concurrent.Future) GridH2Table(org.apache.ignite.internal.processors.query.h2.opt.GridH2Table) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) X(org.apache.ignite.internal.util.typedef.X) BPlusTree(org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree) JdbcConnection(org.h2.jdbc.JdbcConnection) Objects.isNull(java.util.Objects.isNull) LoggerResource(org.apache.ignite.resources.LoggerResource) FilePageStore(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore) GridQueryTypeDescriptor(org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor) IgniteInClosure(org.apache.ignite.lang.IgniteInClosure) GridNotIdleException(org.apache.ignite.internal.processors.cache.verify.GridNotIdleException) Collection(java.util.Collection) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) IgniteInstanceResource(org.apache.ignite.resources.IgniteInstanceResource) FilePageStoreManager(org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager) OWNING(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionState.OWNING) CacheDataRow(org.apache.ignite.internal.processors.cache.persistence.CacheDataRow) Executors(java.util.concurrent.Executors) GRID_NOT_IDLE_MSG(org.apache.ignite.internal.processors.cache.verify.IdleVerifyUtility.GRID_NOT_IDLE_MSG) INDEX_PARTITION(org.apache.ignite.internal.pagemem.PageIdAllocator.INDEX_PARTITION) Cursor(org.h2.index.Cursor) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) Entry(java.util.Map.Entry) GridCacheContext(org.apache.ignite.internal.processors.cache.GridCacheContext) KeyCacheObject(org.apache.ignite.internal.processors.cache.KeyCacheObject) Objects.nonNull(java.util.Objects.nonNull) FLAG_IDX(org.apache.ignite.internal.pagemem.PageIdAllocator.FLAG_IDX) CacheObjectUtils(org.apache.ignite.internal.processors.cache.CacheObjectUtils) PartitionKey(org.apache.ignite.internal.processors.cache.verify.PartitionKey) U(org.apache.ignite.internal.util.typedef.internal.U) HashMap(java.util.HashMap) Callable(java.util.concurrent.Callable) IgniteLogger(org.apache.ignite.IgniteLogger) CorruptedTreeException(org.apache.ignite.internal.processors.cache.persistence.tree.CorruptedTreeException) Supplier(java.util.function.Supplier) CacheGroupContext(org.apache.ignite.internal.processors.cache.CacheGroupContext) ArrayList(java.util.ArrayList) GridKernalContext(org.apache.ignite.internal.GridKernalContext) IgniteCallable(org.apache.ignite.lang.IgniteCallable) HashSet(java.util.HashSet) IdleVerifyUtility.formatUpdateCountersDiff(org.apache.ignite.internal.processors.cache.verify.IdleVerifyUtility.formatUpdateCountersDiff) Session(org.h2.engine.Session) Collections.newSetFromMap(java.util.Collections.newSetFromMap) IdleVerifyUtility.compareUpdateCounters(org.apache.ignite.internal.processors.cache.verify.IdleVerifyUtility.compareUpdateCounters) MvccUtils(org.apache.ignite.internal.processors.cache.mvcc.MvccUtils) IgniteH2Indexing(org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing) IgniteInterruptedException(org.apache.ignite.IgniteInterruptedException) IdleVerifyUtility.getUpdateCountersSnapshot(org.apache.ignite.internal.processors.cache.verify.IdleVerifyUtility.getUpdateCountersSnapshot) GridH2RowDescriptor(org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor) IdleVerifyUtility(org.apache.ignite.internal.processors.cache.verify.IdleVerifyUtility) ExecutorService(java.util.concurrent.ExecutorService) F(org.apache.ignite.internal.util.typedef.F) Collections.emptyMap(java.util.Collections.emptyMap) DynamicCacheDescriptor(org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor) H2TreeIndexBase(org.apache.ignite.internal.processors.query.h2.database.H2TreeIndexBase) PartitionUpdateCounter(org.apache.ignite.internal.processors.cache.PartitionUpdateCounter) QueryTypeDescriptorImpl(org.apache.ignite.internal.processors.query.QueryTypeDescriptorImpl) T3(org.apache.ignite.internal.util.typedef.T3) GridIterator(org.apache.ignite.internal.util.lang.GridIterator) T2(org.apache.ignite.internal.util.typedef.T2) ExecutionException(java.util.concurrent.ExecutionException) AtomicLong(java.util.concurrent.atomic.AtomicLong) GridDhtLocalPartition(org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition) IgniteCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager) GridCacheSharedContext(org.apache.ignite.internal.processors.cache.GridCacheSharedContext) MvccSnapshot(org.apache.ignite.internal.processors.cache.mvcc.MvccSnapshot) H2CacheRow(org.apache.ignite.internal.processors.query.h2.opt.H2CacheRow) Collections(java.util.Collections) MvccQueryTracker(org.apache.ignite.internal.processors.cache.mvcc.MvccQueryTracker) QueryContext(org.apache.ignite.internal.processors.query.h2.opt.QueryContext) IgniteUtils.error(org.apache.ignite.internal.util.IgniteUtils.error) GridQueryProcessor(org.apache.ignite.internal.processors.query.GridQueryProcessor) GridCacheContext(org.apache.ignite.internal.processors.cache.GridCacheContext) QueryTypeDescriptorImpl(org.apache.ignite.internal.processors.query.QueryTypeDescriptorImpl) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) PartitionUpdateCounter(org.apache.ignite.internal.processors.cache.PartitionUpdateCounter) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) GridNotIdleException(org.apache.ignite.internal.processors.cache.verify.GridNotIdleException) AtomicLong(java.util.concurrent.atomic.AtomicLong) IgniteException(org.apache.ignite.IgniteException) GridH2Table(org.apache.ignite.internal.processors.query.h2.opt.GridH2Table) GridQueryProcessor(org.apache.ignite.internal.processors.query.GridQueryProcessor) IgniteH2Indexing(org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Collections.newSetFromMap(java.util.Collections.newSetFromMap) Collections.emptyMap(java.util.Collections.emptyMap) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with GridIterator

use of org.apache.ignite.internal.util.lang.GridIterator in project ignite by apache.

the class IgniteClusterSnapshotCheckTest method testClusterSnapshotCheckFailsOnPartitionDataDiffers.

/**
 * @throws Exception If fails.
 */
@Test
public void testClusterSnapshotCheckFailsOnPartitionDataDiffers() throws Exception {
    CacheConfiguration<Integer, Value> ccfg = txCacheConfig(new CacheConfiguration<Integer, Value>(DEFAULT_CACHE_NAME)).setAffinity(new RendezvousAffinityFunction(false, 1));
    IgniteEx ignite = startGridsWithoutCache(2);
    ignite.getOrCreateCache(ccfg).put(1, new Value(new byte[2000]));
    forceCheckpoint(ignite);
    GridCacheSharedContext<?, ?> cctx = ignite.context().cache().context();
    GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager) cctx.database();
    BinaryContext binCtx = ((CacheObjectBinaryProcessorImpl) ignite.context().cacheObjects()).binaryContext();
    GridCacheAdapter<?, ?> cache = ignite.context().cache().internalCache(dfltCacheCfg.getName());
    long partCtr = cache.context().topology().localPartition(PART_ID, NONE, false).dataStore().updateCounter();
    AtomicBoolean done = new AtomicBoolean();
    db.addCheckpointListener(new CheckpointListener() {

        @Override
        public void onMarkCheckpointBegin(Context ctx) throws IgniteCheckedException {
            // Change the cache value only at on of the cluster node to get hash conflict when the check command ends.
            if (!done.compareAndSet(false, true))
                return;
            GridIterator<CacheDataRow> it = cache.context().offheap().partitionIterator(PART_ID);
            assertTrue(it.hasNext());
            CacheDataRow row0 = it.nextX();
            AffinityTopologyVersion topVer = cctx.exchange().readyAffinityVersion();
            GridCacheEntryEx cached = cache.entryEx(row0.key(), topVer);
            byte[] bytes = new byte[2000];
            new Random().nextBytes(bytes);
            try {
                BinaryObjectImpl newVal = new BinaryObjectImpl(binCtx, binCtx.marshaller().marshal(new Value(bytes)), 0);
                boolean success = cached.initialValue(newVal, new GridCacheVersion(row0.version().topologyVersion(), row0.version().nodeOrder(), row0.version().order() + 1), null, null, TxState.NA, TxState.NA, TTL_ETERNAL, row0.expireTime(), true, topVer, DR_NONE, false, false, null);
                assertTrue(success);
                long newPartCtr = cache.context().topology().localPartition(PART_ID, NONE, false).dataStore().updateCounter();
                assertEquals(newPartCtr, partCtr);
            } catch (Exception e) {
                throw new IgniteCheckedException(e);
            }
        }

        @Override
        public void onCheckpointBegin(Context ctx) throws IgniteCheckedException {
        }

        @Override
        public void beforeCheckpointBegin(Context ctx) throws IgniteCheckedException {
        }
    });
    db.waitForCheckpoint("test-checkpoint");
    ignite.snapshot().createSnapshot(SNAPSHOT_NAME).get();
    Path part0 = U.searchFileRecursively(snp(ignite).snapshotLocalDir(SNAPSHOT_NAME).toPath(), getPartitionFileName(PART_ID));
    assertNotNull(part0);
    assertTrue(part0.toString(), part0.toFile().exists());
    IdleVerifyResultV2 res = snp(ignite).checkSnapshot(SNAPSHOT_NAME).get();
    StringBuilder b = new StringBuilder();
    res.print(b::append, true);
    assertTrue(F.isEmpty(res.exceptions()));
    assertContains(log, b.toString(), "The check procedure has failed, conflict partitions has been found: [counterConflicts=0, hashConflicts=1]");
}
Also used : CacheObjectBinaryProcessorImpl(org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl) GridCacheVersion(org.apache.ignite.internal.processors.cache.version.GridCacheVersion) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) Random(java.util.Random) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) BinaryContext(org.apache.ignite.internal.binary.BinaryContext) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) BinaryContext(org.apache.ignite.internal.binary.BinaryContext) GridCacheSharedContext(org.apache.ignite.internal.processors.cache.GridCacheSharedContext) CacheDataRow(org.apache.ignite.internal.processors.cache.persistence.CacheDataRow) Path(java.nio.file.Path) IgniteSnapshotManager.databaseRelativePath(org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.databaseRelativePath) BinaryObjectImpl(org.apache.ignite.internal.binary.BinaryObjectImpl) GridCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager) CheckpointListener(org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointListener) AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) IgniteDataIntegrityViolationException(org.apache.ignite.internal.processors.cache.persistence.wal.crc.IgniteDataIntegrityViolationException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) IOException(java.io.IOException) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) GridCacheEntryEx(org.apache.ignite.internal.processors.cache.GridCacheEntryEx) IgniteEx(org.apache.ignite.internal.IgniteEx) GridIterator(org.apache.ignite.internal.util.lang.GridIterator) IdleVerifyResultV2(org.apache.ignite.internal.processors.cache.verify.IdleVerifyResultV2) Test(org.junit.Test)

Aggregations

IgniteEx (org.apache.ignite.internal.IgniteEx)4 CacheDataRow (org.apache.ignite.internal.processors.cache.persistence.CacheDataRow)4 GridIterator (org.apache.ignite.internal.util.lang.GridIterator)4 Collections (java.util.Collections)3 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)3 IgniteException (org.apache.ignite.IgniteException)3 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 Callable (java.util.concurrent.Callable)2 ExecutionException (java.util.concurrent.ExecutionException)2 ExecutorService (java.util.concurrent.ExecutorService)2 Executors (java.util.concurrent.Executors)2 Future (java.util.concurrent.Future)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)2