use of org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager in project ignite by apache.
the class WalRecoveryTxLogicalRecordsTest method testRecoveryRandomPutRemove.
/**
* @throws Exception If failed.
*/
public void testRecoveryRandomPutRemove() throws Exception {
try {
pageSize = 1024;
extraCcfg = new CacheConfiguration(CACHE2_NAME);
extraCcfg.setAffinity(new RendezvousAffinityFunction(false, PARTS));
Ignite ignite = startGrid(0);
ignite.cluster().active(true);
GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager) ((IgniteEx) ignite).context().cache().context().database();
dbMgr.enableCheckpoints(false).get();
IgniteCache<Integer, IndexedValue> cache1 = ignite.cache(CACHE_NAME);
IgniteCache<Object, Object> cache2 = ignite.cache(CACHE2_NAME);
final int KEYS1 = 100;
for (int i = 0; i < KEYS1; i++) cache1.put(i, new IndexedValue(i));
for (int i = 0; i < KEYS1; i++) {
if (i % 2 == 0)
cache1.remove(i);
}
ThreadLocalRandom rnd = ThreadLocalRandom.current();
for (int i = 0; i < KEYS1; i++) {
cache2.put(i, new byte[rnd.nextInt(512)]);
if (rnd.nextBoolean())
cache2.put(i, new byte[rnd.nextInt(512)]);
if (rnd.nextBoolean())
cache2.remove(i);
}
ignite.close();
ignite = startGrid(0);
ignite.cluster().active(true);
ignite.cache(CACHE_NAME).put(1, new IndexedValue(0));
} finally {
stopAllGrids();
}
}
use of org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager in project ignite by apache.
the class IgniteDbSingleNodeWithIndexingWalRestoreTest method testRegularClassesRestored.
/**
* Test for regular objects stored in cache with compactFooter=true setting
* (no metainformation to deserialize values is stored with values themselves).
*/
public void testRegularClassesRestored() throws Exception {
IgniteEx ig = startGrid(0);
ig.active(true);
GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager) ig.context().cache().context().database();
dbMgr.enableCheckpoints(false).get();
IgniteCache<Object, Object> cache = ig.cache("indexedCache");
for (int i = 0; i < ENTRIES_COUNT; i++) cache.put(i, new RegularPerson("RegularPeter" + i));
stopGrid(0, true);
ig = startGrid(0);
ig.active(true);
cache = ig.cache("indexedCache");
for (int i = 0; i < ENTRIES_COUNT; i++) assertEquals("RegularPeter" + i, ((RegularPerson) cache.get(i)).regName);
}
use of org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager in project ignite by apache.
the class IgnitePersistentStoreSchemaLoadTest method checkpointLatch.
/**
* @param node Node whose checkpoint to wait for.
* @return Latch released when checkpoint happens.
*/
private CountDownLatch checkpointLatch(IgniteEx node) {
final CountDownLatch cnt = new CountDownLatch(1);
GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager) node.context().cache().context().database();
db.addCheckpointListener(new DbCheckpointListener() {
@Override
public void onCheckpointBegin(Context ctx) {
cnt.countDown();
}
});
return cnt;
}
Aggregations