use of org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializer in project ignite by apache.
the class IgniteWalSerializerVersionTest method check.
/**
* @throws Exception If failed.
*/
private void check(Checker checker) throws Exception {
System.setProperty(IGNITE_WAL_SERIALIZER_VERSION, Integer.toString(checker.serializerVersion()));
IgniteEx ig0 = (IgniteEx) startGrid();
ig0.cluster().active(true);
IgniteWriteAheadLogManager wal = ig0.context().cache().context().wal();
RecordSerializer ser0 = U.field(wal, "serializer");
assertTrue(ser0.getClass().getName().equals(checker.serializer().getName()));
List<WALRecord> recs = checker.recordsToWrite();
assertTrue(!recs.isEmpty());
WALPointer p = null;
for (WALRecord rec : recs) {
WALPointer p0 = wal.log(rec);
if (p == null)
p = p0;
}
wal.flush(null, false);
Iterator<Long> itToCheck = checker.getTimeStamps().iterator();
try (TimestampRecordIterator it = new TimestampRecordIterator(wal.replay(p))) {
while (it.hasNext()) {
IgniteBiTuple<WALPointer, WALRecord> tup0 = it.next();
checker.assertRecords(itToCheck.next(), tup0.get2());
}
}
stopGrid();
System.clearProperty(IGNITE_WAL_SERIALIZER_VERSION);
}
Aggregations