use of org.apache.ignite.IgniteSystemProperties.IGNITE_PERF_STAT_FILE_MAX_SIZE in project ignite by apache.
the class PerformanceStatisticsPropertiesTest method testFileMaxSize.
/**
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = IGNITE_PERF_STAT_FILE_MAX_SIZE, value = "" + TEST_FILE_MAX_SIZE)
public void testFileMaxSize() throws Exception {
long initLen = srv.context().cache().cacheDescriptors().values().stream().mapToInt(desc -> 1 + cacheStartRecordSize(desc.cacheName().getBytes().length, false)).sum();
long expOpsCnt = (TEST_FILE_MAX_SIZE - initLen) / (/*typeOp*/
1 + OperationType.cacheRecordSize());
startCollectStatistics();
for (int i = 0; i < expOpsCnt * 2; i++) srv.cache(DEFAULT_CACHE_NAME).get(i);
AtomicInteger opsCnt = new AtomicInteger();
stopCollectStatisticsAndRead(new TestHandler() {
@Override
public void cacheOperation(UUID nodeId, OperationType type, int cacheId, long startTime, long duration) {
opsCnt.incrementAndGet();
}
});
assertEquals(expOpsCnt, opsCnt.get());
long expLen = initLen + opsCnt.get() * (/*typeOp*/
1 + OperationType.cacheRecordSize());
List<File> files = statisticsFiles();
assertEquals(1, files.size());
long statFileLen = files.get(0).length();
assertEquals(expLen, statFileLen);
assertTrue(statFileLen <= TEST_FILE_MAX_SIZE);
}
Aggregations