use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class PagesPossibleCorruptionDiagnosticTest method testDiagnosticCollectedOnCorruptedPageList.
/**
* Tests page list pages are collected in {@link CorruptedFreeListException}.
*/
@Test
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_PAGES_LIST_DISABLE_ONHEAP_CACHING, value = "true")
public void testDiagnosticCollectedOnCorruptedPageList() throws Exception {
IgniteEx ignite = startGrid(0);
ignite.cluster().state(ClusterState.ACTIVE);
IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(new CacheConfiguration<Integer, Integer>(DEFAULT_CACHE_NAME).setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL).setAffinity(new RendezvousAffinityFunction(false, 1)));
cache.put(1, 1);
cache.remove(1);
int grpId = cacheGroupId(DEFAULT_CACHE_NAME, null);
IgniteCacheOffheapManager.CacheDataStore dataStore = ignite.context().cache().cacheGroup(grpId).offheap().cacheDataStores().iterator().next();
GridCacheOffheapManager.GridCacheDataStore store = (GridCacheOffheapManager.GridCacheDataStore) dataStore;
AbstractFreeList freeList = store.getCacheStoreFreeList();
ReuseBag bag = new LongListReuseBag();
bag.addFreePage(pageId(0, FLAG_DATA, 10));
bag.addFreePage(pageId(0, FLAG_DATA, 11));
long[] pages = null;
try {
freeList.addForRecycle(bag);
} catch (CorruptedFreeListException e) {
pages = e.pageIds();
}
assertNotNull(pages);
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class IgnitePdsBinarySortObjectFieldsTest method testGivenCacheWithPojoValueAndPds_WhenPut_ThenNoHangup.
/**
* @throws Exception if failed.
*/
@Test
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_BINARY_SORT_OBJECT_FIELDS, value = "true")
public void testGivenCacheWithPojoValueAndPds_WhenPut_ThenNoHangup() throws Exception {
IgniteEx ignite = startGrid(0);
ignite.cluster().active(true);
final IgniteCache<Long, Value> cache = ignite.getOrCreateCache(new CacheConfiguration<Long, Value>(CACHE_NAME).setAffinity(new RendezvousAffinityFunction().setPartitions(32)));
GridTestUtils.assertTimeout(5, TimeUnit.SECONDS, () -> cache.put(1L, new Value(1L)));
assertEquals(1, cache.size());
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class FailureProcessorThreadDumpThrottlingTest method testThrottlingPerFailureType.
/**
* Tests that thread dumps will be throttled per failure type and will be generated again after timeout exceeded.
*/
@Test
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE, value = "true")
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE_THROTTLING_TIMEOUT, value = "3000")
public void testThrottlingPerFailureType() throws Exception {
LogListener dumpLsnr = LogListener.matches(THREAD_DUMP_MSG).times(4).build();
LogListener throttledLsnr = LogListener.matches("Thread dump is hidden").times(4).build();
testLog.registerListener(dumpLsnr);
testLog.registerListener(throttledLsnr);
IgniteEx ignite = ignite(0);
FailureContext workerBlockedFailureCtx = new FailureContext(SYSTEM_WORKER_BLOCKED, new Throwable("Failure context error"));
FailureContext opTimeoutFailureCtx = new FailureContext(SYSTEM_CRITICAL_OPERATION_TIMEOUT, new Throwable("Failure context error"));
for (int i = 0; i < 2; i++) {
ignite.context().failure().process(workerBlockedFailureCtx);
ignite.context().failure().process(opTimeoutFailureCtx);
}
U.sleep(3000);
for (int i = 0; i < 2; i++) {
ignite.context().failure().process(workerBlockedFailureCtx);
ignite.context().failure().process(opTimeoutFailureCtx);
}
assertTrue(dumpLsnr.check());
assertTrue(throttledLsnr.check());
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class FailureProcessorThreadDumpThrottlingTest method testNoThreadDumps.
/**
* Tests that thread dumps will not get if {@code IGNITE_DUMP_THREADS_ON_FAILURE == false}.
*/
@Test
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE, value = "false")
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE_THROTTLING_TIMEOUT, value = "0")
public void testNoThreadDumps() throws Exception {
LogListener lsnr = LogListener.matches(THREAD_DUMP_MSG).times(0).build();
testLog.registerListener(lsnr);
IgniteEx ignite = ignite(0);
FailureContext failureCtx = new FailureContext(SYSTEM_WORKER_BLOCKED, new Throwable("Failure context error"));
for (int i = 0; i < 2; i++) ignite.context().failure().process(failureCtx);
assertTrue(lsnr.check());
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class AffinityHistoryCleanupTest method testAffinityHistoryCleanup.
/**
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = IGNITE_AFFINITY_HISTORY_SIZE, value = "5")
public void testAffinityHistoryCleanup() throws Exception {
Ignite ignite = startGrid(0);
// fullHistSize = 1
checkHistory(ignite, F.asList(topVer(1, 0)), 1);
startGrid(1);
checkHistory(ignite, F.asList(// FullHistSize = 1.
topVer(1, 0), // FullHistSize = 2.
topVer(2, 0), // FullHistSize = 3.
topVer(2, 1)), 3);
startGrid(2);
checkHistory(ignite, F.asList(// FullHistSize = 1.
topVer(1, 0), // FullHistSize = 2.
topVer(2, 0), // FullHistSize = 3.
topVer(2, 1), // FullHistSize = 4.
topVer(3, 0), // FullHistSize = 5.
topVer(3, 1)), 5);
startGrid(3);
checkHistory(ignite, F.asList(// FullHistSize = 3.
topVer(2, 1), // FullHistSize = 4.
topVer(3, 0), // FullHistSize = 5.
topVer(3, 1), // FullHistSize = 6 - 1 = 5.
topVer(4, 0), // FullHistSize = 6 - 1 = 5.
topVer(4, 1)), 5);
startClientGrid(4);
stopGrid(4);
checkHistory(ignite, F.asList(// FullHistSize = 3.
topVer(2, 1), // FullHistSize = 4.
topVer(3, 0), // FullHistSize = 5.
topVer(3, 1), // FullHistSize = 6 - 1 = 5.
topVer(4, 0), // FullHistSize = 6 - 1 = 5.
topVer(4, 1), // Client event -> FullHistSize = 5.
topVer(5, 0), // Client event -> FullHistSize = 5.
topVer(6, 0)), 5);
startClientGrid(4);
stopGrid(4);
checkHistory(ignite, F.asList(// FullHistSize = 3.
topVer(2, 1), // FullHistSize = 4.
topVer(3, 0), // FullHistSize = 5.
topVer(3, 1), // FullHistSize = 6 - 1 = 5.
topVer(4, 0), // FullHistSize = 6 - 1 = 5.
topVer(4, 1), // Client event -> FullHistSize = 5.
topVer(5, 0), // Client event -> FullHistSize = 5.
topVer(6, 0), // Client event -> FullHistSize = 5.
topVer(7, 0), // Client event -> FullHistSize = 5.
topVer(8, 0)), 5);
startClientGrid(4);
stopGrid(4);
checkHistory(ignite, F.asList(// FullHistSize = 3.
topVer(2, 1), // FullHistSize = 4.
topVer(3, 0), // FullHistSize = 5.
topVer(3, 1), // FullHistSize = 6 - 1 = 5.
topVer(4, 0), // FullHistSize = 6 - 1 = 5.
topVer(4, 1), // Client event -> FullHistSize = 5.
topVer(5, 0), // Client event -> FullHistSize = 5.
topVer(6, 0), // Client event -> FullHistSize = 5.
topVer(7, 0), // Client event -> FullHistSize = 5.
topVer(8, 0), // Client event -> FullHistSize = 5.
topVer(9, 0), // Client event -> FullHistSize = 5.
topVer(10, 0)), 5);
startGrid(4);
checkHistory(ignite, F.asList(// FullHistSize = 5.
topVer(3, 1), // FullHistSize = 6 - 1 = 5.
topVer(4, 0), // FullHistSize = 6 - 1 = 5.
topVer(4, 1), // Client event -> FullHistSize = 5.
topVer(5, 0), // Client event -> FullHistSize = 5.
topVer(6, 0), // Client event -> FullHistSize = 5.
topVer(7, 0), // Client event -> FullHistSize = 5.
topVer(8, 0), // Client event -> FullHistSize = 5.
topVer(9, 0), // Client event -> FullHistSize = 5.
topVer(10, 0), // FullHistSize = 6 - 1 = 5.
topVer(11, 0), // FullHistSize = 6 - 1 = 5.
topVer(11, 1)), 5);
stopGrid(4);
startGrid(4);
checkHistory(ignite, F.asList(// FullHistSize = 5.
topVer(11, 0), // FullHistSize = 5.
topVer(11, 1), // FullHistSize = 6 - 1 = 5.
topVer(12, 0), // FullHistSize = 5.
topVer(13, 0), // FullHistSize = 6 - 1 = 5.
topVer(13, 1)), 5);
}
Aggregations