use of org.apache.ignite.internal.processors.cache.persistence.wal.SegmentRouter in project ignite by apache.
the class IgniteDataStorageMetricsSelfTest method checkWalArchiveAndTotalSize.
/**
* Check the state of wal archive, and whether the total size of
* wal (and possibly wal archive) match what is expected.
*
* @param igniteEx Node.
* @param hasWalArchive Whether wal archiving is enabled.
* @throws Exception If failed.
*/
private void checkWalArchiveAndTotalSize(IgniteEx igniteEx, boolean hasWalArchive) throws Exception {
FileWriteAheadLogManager walMgr = walMgr(igniteEx);
SegmentRouter router = walMgr.getSegmentRouter();
assertEquals(router.hasArchive(), hasWalArchive);
// Wait to avoid race condition where new segments(and corresponding .tmp files) are created after totalSize has been calculated.
if (router.hasArchive()) {
int expWalWorkSegements = igniteEx.configuration().getDataStorageConfiguration().getWalSegments();
assertTrue(waitForCondition(() -> walFiles(router.getWalWorkDir()).length == expWalWorkSegements, 3000l));
assertTrue(waitForCondition(() -> walMgr.lastArchivedSegment() == walMgr.currentSegment() - 1, 3000l));
}
long totalSize = walMgr.totalSize(walFiles(router.getWalWorkDir()));
if (router.hasArchive())
totalSize += walMgr.totalSize(walFiles(router.getWalArchiveDir()));
assertEquals(totalSize, dbMgr(igniteEx).persistentStoreMetrics().getWalTotalSize());
assertEquals(totalSize, dsMetricsMXBean(igniteEx).getWalTotalSize());
assertEquals(totalSize, ((LongGauge) dsMetricRegistry(igniteEx).findMetric("WalTotalSize")).value());
}
use of org.apache.ignite.internal.processors.cache.persistence.wal.SegmentRouter in project ignite by apache.
the class DiagnosticProcessorTest method expWalDirs.
/**
* Getting expected WAL directories.
*
* @param n Node.
* @return WAL directories.
*/
@Nullable
private File[] expWalDirs(IgniteEx n) {
FileWriteAheadLogManager walMgr = walMgr(n);
if (walMgr != null) {
SegmentRouter sr = walMgr.getSegmentRouter();
assertNotNull(sr);
File workDir = sr.getWalWorkDir();
return sr.hasArchive() ? F.asArray(workDir, sr.getWalArchiveDir()) : F.asArray(workDir);
}
return null;
}
Aggregations