Search in sources :

Example 11 with RecordSerializer

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);
}
Also used : WALRecord(org.apache.ignite.internal.pagemem.wal.record.WALRecord) IgniteWriteAheadLogManager(org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager) IgniteEx(org.apache.ignite.internal.IgniteEx) WALPointer(org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer) RecordSerializer(org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializer)

Aggregations

RecordSerializer (org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializer)11 RecordSerializerFactoryImpl (org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializerFactoryImpl)7 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6 IOException (java.io.IOException)5 IgniteWriteAheadLogManager (org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager)5 WALPointer (org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer)5 File (java.io.File)4 SwitchSegmentRecord (org.apache.ignite.internal.pagemem.wal.record.SwitchSegmentRecord)4 FileIO (org.apache.ignite.internal.processors.cache.persistence.file.FileIO)4 EOFException (java.io.EOFException)3 WALRecord (org.apache.ignite.internal.pagemem.wal.record.WALRecord)3 StorageException (org.apache.ignite.internal.processors.cache.persistence.StorageException)3 GridKernalContext (org.apache.ignite.internal.GridKernalContext)2 IgniteEx (org.apache.ignite.internal.IgniteEx)2 WALIterator (org.apache.ignite.internal.pagemem.wal.WALIterator)2 MetastoreDataRecord (org.apache.ignite.internal.pagemem.wal.record.MetastoreDataRecord)2 GridCacheSharedContext (org.apache.ignite.internal.processors.cache.GridCacheSharedContext)2 RandomAccessFileIOFactory (org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory)2 SegmentAware (org.apache.ignite.internal.processors.cache.persistence.wal.aware.SegmentAware)2 StandaloneGridKernalContext (org.apache.ignite.internal.processors.cache.persistence.wal.reader.StandaloneGridKernalContext)2