use of org.apache.ignite.internal.pagemem.wal.record.PageSnapshot in project ignite by apache.
the class IgniteWalConverterTest method testPages.
/**
* Check that when using the "pages" argument we will see WalRecord with this pages in the utility output.
*
* @throws Exception If failed.
*/
@Test
public void testPages() throws Exception {
List<T2<PageSnapshot, String>> walRecords = new ArrayList<>();
String nodeDir = createWal(new ArrayList<>(), n -> {
try (WALIterator walIter = n.context().cache().context().wal().replay(new WALPointer(0, 0, 0))) {
while (walIter.hasNextX()) {
WALRecord walRecord = walIter.nextX().get2();
if (walRecord instanceof PageSnapshot)
walRecords.add(new T2<>((PageSnapshot) walRecord, walRecord.toString()));
}
}
});
assertFalse(walRecords.isEmpty());
File walDir = U.resolveWorkDirectory(U.defaultWorkDirectory(), DFLT_WAL_PATH, false);
assertTrue(U.fileCount(walDir.toPath()) > 0);
File walNodeDir = new File(walDir, nodeDir);
assertTrue(U.fileCount(walNodeDir.toPath()) > 0);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
T2<PageSnapshot, String> expRec = walRecords.get(0);
IgniteWalConverterArguments args = parse(ps, "walDir=" + walDir.getAbsolutePath(), "pages=" + expRec.get1().fullPageId().groupId() + ':' + expRec.get1().fullPageId().pageId(), "skipCrc=" + true);
baos.reset();
convert(ps, args);
assertContains(log, baos.toString(), expRec.get2());
}
Aggregations