use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.
the class CacheStartOnJoinTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
TcpDiscoverySpi testSpi = new TcpDiscoverySpi() {
/**
*/
private boolean delay = true;
@Override
protected void writeToSocket(Socket sock, OutputStream out, TcpDiscoveryAbstractMessage msg, long timeout) throws IOException, IgniteCheckedException {
super.writeToSocket(sock, out, msg, timeout);
}
@Override
protected void startMessageProcess(TcpDiscoveryAbstractMessage msg) {
if (getTestIgniteInstanceName(0).equals(ignite.name())) {
if (msg instanceof TcpDiscoveryJoinRequestMessage) {
TcpDiscoveryJoinRequestMessage msg0 = (TcpDiscoveryJoinRequestMessage) msg;
if (msg0.client() && delay) {
log.info("Delay join processing: " + msg0);
delay = false;
doSleep(5000);
}
}
}
super.startMessageProcess(msg);
}
};
testSpi.setIpFinder(ipFinder);
testSpi.setJoinTimeout(60_000);
cfg.setDiscoverySpi(testSpi);
DataStorageConfiguration memCfg = new DataStorageConfiguration();
memCfg.setPageSize(1024);
memCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(50 * 1024 * 1024));
cfg.setDataStorageConfiguration(memCfg);
cfg.setClientMode(client);
return cfg;
}
use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.
the class GridCacheUtils method isPersistenceEnabled.
/**
* @return {@code true} if persistence is enabled for at least one data region, {@code false} if not.
*/
public static boolean isPersistenceEnabled(DataStorageConfiguration cfg) {
if (cfg == null)
return false;
DataRegionConfiguration dfltReg = cfg.getDefaultDataRegionConfiguration();
if (dfltReg == null)
return false;
if (dfltReg.isPersistenceEnabled())
return true;
DataRegionConfiguration[] regCfgs = cfg.getDataRegionConfigurations();
if (regCfgs == null)
return false;
for (DataRegionConfiguration regCfg : regCfgs) {
if (regCfg.isPersistenceEnabled())
return true;
}
return false;
}
use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.
the class GridCacheDatabaseSharedManager method readMetastore.
/**
*/
private void readMetastore() throws IgniteCheckedException {
try {
DataStorageConfiguration memCfg = cctx.kernalContext().config().getDataStorageConfiguration();
DataRegionConfiguration plcCfg = createDataRegionConfiguration(memCfg);
File allocPath = buildAllocPath(plcCfg);
DirectMemoryProvider memProvider = allocPath == null ? new UnsafeMemoryProvider(log) : new MappedFileMemoryProvider(log, allocPath);
DataRegionMetricsImpl memMetrics = new DataRegionMetricsImpl(plcCfg);
PageMemoryEx storePageMem = (PageMemoryEx) createPageMemory(memProvider, memCfg, plcCfg, memMetrics, false);
DataRegion regCfg = new DataRegion(storePageMem, plcCfg, memMetrics, createPageEvictionTracker(plcCfg, storePageMem));
CheckpointStatus status = readCheckpointStatus();
cctx.pageStore().initializeForMetastorage();
storePageMem.start();
checkpointReadLock();
try {
restoreMemory(status, true, storePageMem);
metaStorage = new MetaStorage(cctx, regCfg, memMetrics, true);
metaStorage.init(this);
applyLastUpdates(status, true);
initiallyWalDisabledGrps = walDisabledGroups();
notifyMetastorageReadyForRead();
} finally {
checkpointReadUnlock();
}
metaStorage = null;
storePageMem.stop();
} catch (StorageException e) {
throw new IgniteCheckedException(e);
}
}
use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.
the class GridCacheDatabaseSharedManager method createDataRegionConfiguration.
/**
* @param storageCfg Data storage configuration.
* @return Data region configuration.
*/
private DataRegionConfiguration createDataRegionConfiguration(DataStorageConfiguration storageCfg) {
DataRegionConfiguration cfg = new DataRegionConfiguration();
cfg.setName(METASTORE_DATA_REGION_NAME);
cfg.setInitialSize(storageCfg.getSystemRegionInitialSize());
cfg.setMaxSize(storageCfg.getSystemRegionMaxSize());
cfg.setPersistenceEnabled(true);
return cfg;
}
use of org.apache.ignite.configuration.DataRegionConfiguration in project ignite by apache.
the class PageMemoryImpl method getDataRegionConfiguration.
/**
* @return Data region configuration.
*/
private DataRegionConfiguration getDataRegionConfiguration() {
DataStorageConfiguration memCfg = ctx.kernalContext().config().getDataStorageConfiguration();
assert memCfg != null;
String dataRegionName = memMetrics.getName();
if (memCfg.getDefaultDataRegionConfiguration().getName().equals(dataRegionName))
return memCfg.getDefaultDataRegionConfiguration();
DataRegionConfiguration[] dataRegions = memCfg.getDataRegionConfigurations();
if (dataRegions != null) {
for (DataRegionConfiguration reg : dataRegions) {
if (reg != null && reg.getName().equals(dataRegionName))
return reg;
}
}
return null;
}
Aggregations