use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class IgniteDiagnosticMessagesTest method checkSeveralLongRunningTxs.
/**
* @param atomicityMode Cache atomicity mode.
* @throws Exception If failed.
*/
public void checkSeveralLongRunningTxs(CacheAtomicityMode atomicityMode) throws Exception {
int timeout = 3500;
System.setProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, String.valueOf(timeout));
try {
testSpi = true;
startGrid(0);
GridStringLogger strLog = this.strLog = new GridStringLogger();
strLog.logLength(1024 * 100);
startGrid(1);
awaitPartitionMapExchange();
CacheConfiguration ccfg = cacheConfiguration(atomicityMode);
final Ignite node0 = ignite(0);
final Ignite node1 = ignite(1);
node0.createCache(ccfg);
UUID id0 = node0.cluster().localNode().id();
TestRecordingCommunicationSpi.spi(node0).blockMessages(GridNearLockResponse.class, node1.name());
IgniteCache<Object, Object> cache = node0.cache(DEFAULT_CACHE_NAME);
int txCnt = 4;
final List<Integer> keys = primaryKeys(cache, txCnt, 0);
final AtomicInteger idx = new AtomicInteger();
IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
@Override
public Void call() throws Exception {
IgniteCache<Object, Object> cache = node1.cache(DEFAULT_CACHE_NAME);
try (Transaction tx = node1.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
Integer key = keys.get(idx.getAndIncrement() % keys.size());
cache.putIfAbsent(key, String.valueOf(key));
tx.commit();
}
return null;
}
}, txCnt * 2, "tx");
U.sleep(timeout * 2);
assertFalse(fut.isDone());
TestRecordingCommunicationSpi.spi(node0).stopBlock();
fut.get();
String log = strLog.toString();
assertTrue(log.contains("Cache entries [cacheId=" + CU.cacheId(DEFAULT_CACHE_NAME) + ", cacheName=" + DEFAULT_CACHE_NAME + "]:"));
assertTrue(countTxKeysInASingleBlock(log) == txCnt);
assertTrue(log.contains("General node info [id=" + id0));
} finally {
System.clearProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT);
}
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class IgniteClientFailuresTest method testNoMessagesFromFailureProcessor.
/**
* Test verifies that FailureProcessor doesn't treat tcp-comm-worker thread as blocked when
* the thread handles situation of failed client node and thus doesn't print full thread dump into logs.
*
* @throws Exception If failed.
*/
@Test
public void testNoMessagesFromFailureProcessor() throws Exception {
GridStringLogger strLog = new GridStringLogger(false, new GridTestLog4jLogger());
strLog.logLength(1024 * 1024);
inMemoryLog = strLog;
IgniteEx srv = startGrid(0);
inMemoryLog = null;
IgniteEx client00 = startGrid("client00");
client00.getOrCreateCache(new CacheConfiguration<>("cache0"));
breakClient(client00);
boolean waitRes = GridTestUtils.waitForCondition(() -> {
IgniteClusterEx cl = srv.cluster();
return (cl.topology(cl.topologyVersion()).size() == 1);
}, 30_000);
assertTrue(waitRes);
assertFalse(strLog.toString().contains("name=tcp-comm-worker"));
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class IgniteClientFailuresTest method testExchangeWorkerIsNotTreatedAsBlockedWhenClientNodeFails.
/**
* Test verifies that when some sys thread (on server node) tries to re-establish connection to failed client
* and exchange-worker gets blocked waiting for it (e.g. to send partitions full map)
* it is not treated as {@link FailureType#SYSTEM_WORKER_BLOCKED}
* because this waiting is finite and part of normal operations.
*
* @throws Exception If failed.
*/
@Test
public void testExchangeWorkerIsNotTreatedAsBlockedWhenClientNodeFails() throws Exception {
GridStringLogger strLog = new GridStringLogger(false, new GridTestLog4jLogger());
strLog.logLength(1024 * 1024);
inMemoryLog = strLog;
IgniteEx srv0 = startGrid(0);
inMemoryLog = null;
IgniteEx client00 = startGrid("client00");
client00.getOrCreateCache(new CacheConfiguration<>("cache0"));
startGrid(1);
breakClient(client00);
final IgniteClusterEx cl = srv0.cluster();
assertEquals(3, cl.topology(cl.topologyVersion()).size());
startGrid("client01");
boolean waitRes = GridTestUtils.waitForCondition(() -> (cl.topology(cl.topologyVersion()).size() == 3), 20_000);
assertTrue(waitRes);
String logRes = strLog.toString();
assertFalse(logRes.contains(EXCHANGE_WORKER_BLOCKED_MSG));
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class LongJVMPauseDetectorTest method testJulMessage.
/**
* @throws Exception If failed.
*/
@Test
public void testJulMessage() throws Exception {
this.strLog = new GridStringLogger(true);
strLog.logLength(300000);
startGrid(0);
assertTrue(strLog.toString().contains("LongJVMPauseDetector was successfully started"));
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class IgniteSemaphoreAbstractSelfTest method testSemaphoreClosing.
/**
* @throws Exception If failed.
*/
@Test
public void testSemaphoreClosing() throws Exception {
IgniteConfiguration cfg;
GridStringLogger stringLogger;
stringLogger = new GridStringLogger();
cfg = optimize(getConfiguration("npeGrid"));
cfg.setGridLogger(stringLogger);
try (Ignite ignite = startGrid(cfg.getIgniteInstanceName(), cfg)) {
ignite.semaphore("semaphore", 1, true, true);
}
assertFalse(stringLogger.toString().contains(NullPointerException.class.getName()));
}
Aggregations