use of org.apache.ignite.configuration.DataStorageConfiguration 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.DataStorageConfiguration in project ignite by apache.
the class GridCacheProcessor method checkMemoryConfiguration.
/**
* @param rmt Remote node to check.
* @throws IgniteCheckedException If check failed.
*/
private void checkMemoryConfiguration(ClusterNode rmt) throws IgniteCheckedException {
ClusterNode locNode = ctx.discovery().localNode();
if (ctx.config().isClientMode() || locNode.isDaemon() || rmt.isClient() || rmt.isDaemon())
return;
DataStorageConfiguration dsCfg = null;
Object dsCfgBytes = rmt.attribute(IgniteNodeAttributes.ATTR_DATA_STORAGE_CONFIG);
if (dsCfgBytes instanceof byte[])
dsCfg = new JdkMarshaller().unmarshal((byte[]) dsCfgBytes, U.resolveClassLoader(ctx.config()));
if (dsCfg == null) {
// Try to use legacy memory configuration.
MemoryConfiguration memCfg = rmt.attribute(IgniteNodeAttributes.ATTR_MEMORY_CONFIG);
if (memCfg != null) {
dsCfg = new DataStorageConfiguration();
// All properties that are used in validation should be converted here.
dsCfg.setPageSize(memCfg.getPageSize());
}
}
if (dsCfg != null) {
DataStorageConfiguration locDsCfg = ctx.config().getDataStorageConfiguration();
if (dsCfg.getPageSize() != locDsCfg.getPageSize()) {
throw new IgniteCheckedException("Memory configuration mismatch (fix configuration or set -D" + IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK + "=true system property) [rmtNodeId=" + rmt.id() + ", locPageSize = " + locDsCfg.getPageSize() + ", rmtPageSize = " + dsCfg.getPageSize() + "]");
}
}
}
use of org.apache.ignite.configuration.DataStorageConfiguration 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.DataStorageConfiguration in project ignite by apache.
the class PdsConsistentIdProcessor method resolvePersistentStoreBasePath.
/**
* @return DB storage absolute root path resolved as 'db' folder in Ignite work dir (by default) or using persistent
* store configuration. Null if persistence is not enabled. Returned folder is created automatically.
* @throws IgniteCheckedException if I/O failed.
*/
@Nullable
private File resolvePersistentStoreBasePath() throws IgniteCheckedException {
final DataStorageConfiguration dsCfg = cfg.getDataStorageConfiguration();
if (dsCfg == null)
return null;
final String pstPath = dsCfg.getStoragePath();
return U.resolveWorkDirectory(cfg.getWorkDirectory(), pstPath != null ? pstPath : DB_DEFAULT_FOLDER, false);
}
use of org.apache.ignite.configuration.DataStorageConfiguration 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