use of org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager 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);
}
use of org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager in project ignite by apache.
the class ServiceReassignmentFunctionSelfTest method mockServiceProcessor.
/**
* Mocks IgniteServiceProcessor to test method {@link IgniteServiceProcessor#reassign(IgniteUuid,
* ServiceConfiguration, AffinityTopologyVersion, TreeMap)} AffinityTopologyVersion, Map)} )}.
*/
private IgniteServiceProcessor mockServiceProcessor() {
GridTestKernalContext spyCtx = spy(new GridTestKernalContext(new GridTestLog4jLogger()));
GridEventStorageManager mockEvt = mock(GridEventStorageManager.class);
GridIoManager mockIo = mock(GridIoManager.class);
GridSystemViewManager sysViewMgr = mock(GridSystemViewManager.class);
when(spyCtx.event()).thenReturn(mockEvt);
when(spyCtx.io()).thenReturn(mockIo);
when(spyCtx.systemView()).thenReturn(sysViewMgr);
GridDiscoveryManager mockDisco = mock(GridDiscoveryManager.class);
when(mockDisco.nodes(any(AffinityTopologyVersion.class))).thenReturn(new ArrayList<>(nodes));
spyCtx.add(mockDisco);
return new IgniteServiceProcessor(spyCtx);
}
use of org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager in project ignite by apache.
the class IgnitePageMemReplaceDelayedWriteUnitTest method createPageMemory.
/**
* @param cfg configuration
* @param pageWriter writer for page replacement.
* @param pageSize page size
* @return implementation for test
*/
@NotNull
private PageMemoryImpl createPageMemory(IgniteConfiguration cfg, PageStoreWriter pageWriter, int pageSize) {
IgniteCacheDatabaseSharedManager db = mock(GridCacheDatabaseSharedManager.class);
when(db.checkpointLockIsHeldByThread()).thenReturn(true);
GridCacheSharedContext sctx = Mockito.mock(GridCacheSharedContext.class);
when(sctx.gridConfig()).thenReturn(cfg);
when(sctx.pageStore()).thenReturn(new NoOpPageStoreManager());
when(sctx.wal()).thenReturn(new NoOpWALManager());
when(sctx.database()).thenReturn(db);
when(sctx.logger(any(Class.class))).thenReturn(log);
GridKernalContext kernalCtx = mock(GridKernalContext.class);
when(kernalCtx.config()).thenReturn(cfg);
when(kernalCtx.log(any(Class.class))).thenReturn(log);
when(kernalCtx.internalSubscriptionProcessor()).thenAnswer(mock -> new GridInternalSubscriptionProcessor(kernalCtx));
when(kernalCtx.encryption()).thenAnswer(mock -> new GridEncryptionManager(kernalCtx));
when(kernalCtx.metric()).thenAnswer(mock -> new GridMetricManager(kernalCtx));
when(kernalCtx.performanceStatistics()).thenAnswer(mock -> new PerformanceStatisticsProcessor(kernalCtx));
when(sctx.kernalContext()).thenReturn(kernalCtx);
when(sctx.gridEvents()).thenAnswer(invocationOnMock -> new GridEventStorageManager(kernalCtx));
DataRegionConfiguration regCfg = cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration();
DataRegionMetricsImpl memMetrics = new DataRegionMetricsImpl(regCfg, kernalCtx);
long[] sizes = prepareSegmentSizes(regCfg.getMaxSize());
DirectMemoryProvider provider = new UnsafeMemoryProvider(log);
IgniteOutClosure<CheckpointProgress> clo = () -> Mockito.mock(CheckpointProgressImpl.class);
PageMemoryImpl memory = new PageMemoryImpl(provider, sizes, sctx, sctx.pageStore(), pageSize, pageWriter, null, () -> true, memMetrics, PageMemoryImpl.ThrottlingPolicy.DISABLED, clo);
memory.start();
return memory;
}
Aggregations