Search in sources :

Example 1 with RecordV2Serializer

use of org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordV2Serializer in project ignite by apache.

the class IgniteWalSerializerVersionTest method testCheckDifferentSerializerVersions.

/**
 * @throws Exception If failed.
 */
public void testCheckDifferentSerializerVersions() throws Exception {
    System.setProperty(IGNITE_WAL_SERIALIZER_VERSION, "1");
    IgniteEx ig0 = (IgniteEx) startGrid();
    IgniteWriteAheadLogManager wal0 = ig0.context().cache().context().wal();
    RecordSerializer ser0 = U.field(wal0, "serializer");
    assertTrue(ser0 instanceof RecordV1Serializer);
    stopGrid();
    System.setProperty(IGNITE_WAL_SERIALIZER_VERSION, "2");
    IgniteEx ig1 = (IgniteEx) startGrid();
    IgniteWriteAheadLogManager wal1 = ig1.context().cache().context().wal();
    RecordSerializer ser1 = U.field(wal1, "serializer");
    assertTrue(ser1 instanceof RecordV2Serializer);
    stopGrid();
    System.setProperty(IGNITE_WAL_SERIALIZER_VERSION, "3");
    GridTestUtils.assertThrowsAnyCause(log, new GPC<Void>() {

        @Override
        public Void call() throws Exception {
            startGrid();
            return null;
        }
    }, IgniteCheckedException.class, "Failed to create a serializer with the given version");
    System.setProperty(IGNITE_WAL_SERIALIZER_VERSION, "1");
    IgniteEx ig2 = (IgniteEx) startGrid();
    IgniteWriteAheadLogManager wal2 = ig2.context().cache().context().wal();
    RecordSerializer ser2 = U.field(wal2, "serializer");
    assertTrue(ser2 instanceof RecordV1Serializer);
    stopGrid();
}
Also used : RecordV1Serializer(org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordV1Serializer) IgniteWriteAheadLogManager(org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager) IgniteEx(org.apache.ignite.internal.IgniteEx) RecordV2Serializer(org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordV2Serializer) RecordSerializer(org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializer) IgniteCheckedException(org.apache.ignite.IgniteCheckedException)

Aggregations

IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 IgniteWriteAheadLogManager (org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager)1 RecordSerializer (org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializer)1 RecordV1Serializer (org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordV1Serializer)1 RecordV2Serializer (org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordV2Serializer)1