Search in sources :

Example 1 with WalStateManager

use of org.apache.ignite.internal.processors.cache.WalStateManager in project ignite by apache.

the class IgniteWalIteratorSwitchSegmentTest method initiate.

/**
 * Initiate WAL manager.
 *
 * @param serVer WAL serializer version.
 * @param workDir Work directory path.
 * @return Tuple of WAL manager and WAL record serializer.
 * @throws IgniteCheckedException If some think failed.
 */
private T2<IgniteWriteAheadLogManager, RecordSerializer> initiate(int serVer, String workDir) throws IgniteCheckedException {
    GridKernalContext kctx = new StandaloneGridKernalContext(log, null, null) {

        @Override
        protected IgniteConfiguration prepareIgniteConfiguration() {
            IgniteConfiguration cfg = super.prepareIgniteConfiguration();
            cfg.setDataStorageConfiguration(new DataStorageConfiguration().setWalSegmentSize(SEGMENT_SIZE).setWalRecordIteratorBufferSize(SEGMENT_SIZE / 2).setWalMode(WALMode.FSYNC).setWalPath(workDir + WORK_SUB_DIR).setWalArchivePath(workDir + ARCHIVE_SUB_DIR).setFileIOFactory(new RandomAccessFileIOFactory()));
            cfg.setEventStorageSpi(new NoopEventStorageSpi());
            return cfg;
        }

        @Override
        public GridInternalSubscriptionProcessor internalSubscriptionProcessor() {
            return new GridInternalSubscriptionProcessor(this);
        }

        @Override
        public GridEventStorageManager event() {
            return new GridEventStorageManager(this);
        }
    };
    IgniteWriteAheadLogManager walMgr = new FileWriteAheadLogManager(kctx);
    GridTestUtils.setFieldValue(walMgr, "serializerVer", serVer);
    GridCacheSharedContext<?, ?> ctx = new GridCacheSharedContext<>(kctx, null, null, null, null, walMgr, new WalStateManager(kctx), new GridCacheDatabaseSharedManager(kctx), null, null, null, null, null, new GridCacheIoManager(), null, null, null, null, null, null, null);
    walMgr.start(ctx);
    walMgr.onActivate(kctx);
    walMgr.resumeLogging(null);
    RecordSerializer recordSerializer = new RecordSerializerFactoryImpl(ctx).createSerializer(walMgr.serializerVersion());
    return new T2<>(walMgr, recordSerializer);
}
Also used : GridEventStorageManager(org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager) IgniteWriteAheadLogManager(org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager) GridInternalSubscriptionProcessor(org.apache.ignite.internal.processors.subscription.GridInternalSubscriptionProcessor) GridCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager) GridKernalContext(org.apache.ignite.internal.GridKernalContext) StandaloneGridKernalContext(org.apache.ignite.internal.processors.cache.persistence.wal.reader.StandaloneGridKernalContext) GridCacheSharedContext(org.apache.ignite.internal.processors.cache.GridCacheSharedContext) NoopEventStorageSpi(org.apache.ignite.spi.eventstorage.NoopEventStorageSpi) StandaloneGridKernalContext(org.apache.ignite.internal.processors.cache.persistence.wal.reader.StandaloneGridKernalContext) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) RecordSerializerFactoryImpl(org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializerFactoryImpl) WalStateManager(org.apache.ignite.internal.processors.cache.WalStateManager) FileWriteAheadLogManager(org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager) GridCacheIoManager(org.apache.ignite.internal.processors.cache.GridCacheIoManager) RecordSerializer(org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializer) T2(org.apache.ignite.internal.util.typedef.T2) RandomAccessFileIOFactory(org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory)

Aggregations

DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 GridKernalContext (org.apache.ignite.internal.GridKernalContext)1 GridEventStorageManager (org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager)1 IgniteWriteAheadLogManager (org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager)1 GridCacheIoManager (org.apache.ignite.internal.processors.cache.GridCacheIoManager)1 GridCacheSharedContext (org.apache.ignite.internal.processors.cache.GridCacheSharedContext)1 WalStateManager (org.apache.ignite.internal.processors.cache.WalStateManager)1 GridCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager)1 RandomAccessFileIOFactory (org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory)1 FileWriteAheadLogManager (org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager)1 StandaloneGridKernalContext (org.apache.ignite.internal.processors.cache.persistence.wal.reader.StandaloneGridKernalContext)1 RecordSerializer (org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializer)1 RecordSerializerFactoryImpl (org.apache.ignite.internal.processors.cache.persistence.wal.serializer.RecordSerializerFactoryImpl)1 GridInternalSubscriptionProcessor (org.apache.ignite.internal.processors.subscription.GridInternalSubscriptionProcessor)1 T2 (org.apache.ignite.internal.util.typedef.T2)1 NoopEventStorageSpi (org.apache.ignite.spi.eventstorage.NoopEventStorageSpi)1