use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class MemoryPolicyInitializationTest method testCustomConfigNoDefault.
/**
* Verifies that expected memory policies are allocated when used provides MemoryPolicyConfiguration
* with non-default custom MemoryPolicy.
*/
public void testCustomConfigNoDefault() throws Exception {
prepareCustomNoDefaultConfig();
IgniteEx ignite = startGrid(0);
Collection<DataRegion> allMemPlcs = ignite.context().cache().context().database().dataRegions();
assertTrue(allMemPlcs.size() == 3);
verifyDefaultAndSystemMemoryPolicies(allMemPlcs);
assertTrue("Custom non-default memory policy is not presented", isMemoryPolicyPresented(allMemPlcs, CUSTOM_NON_DEFAULT_MEM_PLC_NAME));
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class IgnitePdsPageEvictionDuringPartitionClearTest method testPageEvictionOnNodeStart.
/**
* @throws Exception if failed.
*/
public void testPageEvictionOnNodeStart() throws Exception {
for (int r = 0; r < 3; r++) {
cleanPersistenceDir();
startGrids(2);
try {
Ignite ig = ignite(0);
ig.active(true);
IgniteDataStreamer<Object, Object> streamer = ig.dataStreamer(CACHE_NAME);
for (int i = 0; i < 300_000; i++) {
streamer.addData(i, new TestValue(i));
if (i > 0 && i % 10_000 == 0)
info("Done: " + i);
}
streamer.flush();
IgniteInternalFuture<Object> fut = GridTestUtils.runAsync(new Callable<Object>() {
@Override
public Object call() throws Exception {
IgniteEx ig = startGrid(2);
info(">>>>>>>>>>>");
info(">>>>>>>>>>>");
info(">>>>>>>>>>>");
return ig;
}
});
for (int i = 500_000; i < 1_000_000; i++) {
streamer.addData(i, new TestValue(i));
if (i > 0 && i % 10_000 == 0) {
info("Done: " + i);
U.sleep(1000);
}
}
streamer.close();
fut.get();
} finally {
stopAllGrids();
cleanPersistenceDir();
}
}
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class IgnitePdsPageEvictionTest method testPageEvictionSql.
/**
* @throws Exception if failed.
*/
public void testPageEvictionSql() throws Exception {
IgniteEx ig = grid(0);
ig.active(true);
try (IgniteDataStreamer<DbKey, DbValue> streamer = ig.dataStreamer(CACHE_NAME)) {
for (int i = 0; i < ENTRY_CNT; i++) {
streamer.addData(new DbKey(i), new DbValue(i, "value-" + i, Long.MAX_VALUE - i));
if (i > 0 && i % 10_000 == 0)
info("Done put: " + i);
}
}
IgniteCache<DbKey, DbValue> cache = ignite(0).cache(CACHE_NAME);
for (int i = 0; i < ENTRY_CNT; i++) {
assertEquals(Long.MAX_VALUE - i, cache.get(new DbKey(i)).lVal);
if (i > 0 && i % 10_000 == 0)
info("Done get: " + i);
}
for (int i = 0; i < ENTRY_CNT; i++) {
List<List<?>> rows = cache.query(new SqlFieldsQuery("select lVal from DbValue where iVal=?").setArgs(i)).getAll();
assertEquals(1, rows.size());
assertEquals(Long.MAX_VALUE - i, rows.get(0).get(0));
if (i > 0 && i % 10_000 == 0)
info("Done SQL query: " + i);
}
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class IgniteMassLoadSandboxTest method testPutRemoveMultithreaded.
/**
* Runs multithreaded put-remove scenario (no data streamer). Load is generated to WAL log mostly.
* Most of entries generated will be removed before first checkpoint.
*
* @throws Exception if failed.
*/
public void testPutRemoveMultithreaded() throws Exception {
setWalArchAndWorkToSameVal = false;
customWalMode = WALMode.LOG_ONLY;
try {
final IgniteEx ignite = startGrid(1);
ignite.active(true);
checkpointFrequency = 20 * 1000;
final IgniteCache<Object, HugeIndexedObject> cache = ignite.cache(CACHE_NAME);
int totalRecs = 400_000;
final int threads = 10;
final int recsPerThread = totalRecs / threads;
final Collection<Callable<?>> tasks = new ArrayList<>();
final ProgressWatchdog watchdog = new ProgressWatchdog(ignite, "put", PUT_THREAD);
for (int j = 0; j < threads; j++) {
final int finalJ = j;
tasks.add(new Callable<Void>() {
@Override
public Void call() throws Exception {
final Collection<Integer> toRmvLaterList = new ArrayList<>();
for (int id = finalJ * recsPerThread; id < ((finalJ + 1) * recsPerThread); id++) {
HugeIndexedObject v = new HugeIndexedObject(id);
cache.put(id, v);
toRmvLaterList.add(id);
watchdog.reportProgress(1);
if (toRmvLaterList.size() > 100) {
for (Integer toRemoveId : toRmvLaterList) {
if (keepInDb(toRemoveId))
continue;
boolean rmv = cache.remove(toRemoveId);
assert rmv : "Expected to remove object from cache " + toRemoveId;
}
toRmvLaterList.clear();
}
}
return null;
}
});
}
watchdog.start();
GridTestUtils.runMultiThreaded(tasks, PUT_THREAD);
watchdog.stop();
stopGrid(1);
final Ignite restartedIgnite = startGrid(1);
restartedIgnite.active(true);
final IgniteCache<Object, HugeIndexedObject> restartedCache = restartedIgnite.cache(CACHE_NAME);
for (int i = 0; i < recsPerThread * threads; i++) {
if (keepInDb(i)) {
final HugeIndexedObject obj = restartedCache.get(i);
TestCase.assertNotNull(obj);
TestCase.assertEquals(i, obj.iVal);
}
if (i % 1000 == 0)
X.print(" V: " + i);
}
} finally {
stopAllGrids();
}
}
use of org.apache.ignite.internal.IgniteEx in project ignite by apache.
the class IgnitePdsCacheIntegrationTest method testPutGetSimple.
/**
* @throws Exception if failed.
*/
public void testPutGetSimple() throws Exception {
startGrids(GRID_CNT);
try {
IgniteEx ig = grid(0);
ig.active(true);
checkPutGetSql(ig, true);
} finally {
stopAllGrids();
}
info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
startGrids(GRID_CNT);
try {
IgniteEx ig = grid(0);
ig.active(true);
checkPutGetSql(ig, false);
} finally {
stopAllGrids();
}
}
Aggregations