use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.
the class MemoryPolicyInitializationTest method prepareCustomConfigWithOverridingDefault.
/**
*
*/
private void prepareCustomConfigWithOverridingDefault() {
memCfg = new MemoryConfiguration();
memCfg.setMemoryPolicies(new MemoryPolicyConfiguration().setName(DFLT_MEM_PLC_DEFAULT_NAME).setInitialSize(USER_CUSTOM_MEM_PLC_SIZE).setMaxSize(USER_DEFAULT_MEM_PLC_SIZE));
}
use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.
the class MetadataStorageSelfTest method memory.
/**
* @param clean Clean flag. If {@code true}, will clean previous memory state and allocate
* new empty page memory.
* @return Page memory instance.
*/
protected PageMemory memory(boolean clean) throws Exception {
DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), allocationPath);
MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(30 * 1024 * 1024).setInitialSize(30 * 1024 * 1024);
return new PageMemoryNoStoreImpl(log, provider, null, PAGE_SIZE, plcCfg, new MemoryMetricsImpl(plcCfg), true);
}
use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.
the class IgniteCacheDatabaseSharedManager method validateConfiguration.
/**
* @param memCfg configuration to validate.
*/
private void validateConfiguration(MemoryConfiguration memCfg) throws IgniteCheckedException {
MemoryPolicyConfiguration[] plcCfgs = memCfg.getMemoryPolicies();
Set<String> plcNames = (plcCfgs != null) ? U.<String>newHashSet(plcCfgs.length) : new HashSet<String>(0);
checkSystemMemoryPolicySizeConfiguration(memCfg.getSystemCacheInitialSize(), memCfg.getSystemCacheMaxSize());
if (plcCfgs != null) {
for (MemoryPolicyConfiguration plcCfg : plcCfgs) {
assert plcCfg != null;
checkPolicyName(plcCfg.getName(), plcNames);
checkPolicySize(plcCfg);
checkMetricsProperties(plcCfg);
checkPolicyEvictionProperties(plcCfg, memCfg);
}
}
checkDefaultPolicyConfiguration(memCfg.getDefaultMemoryPolicyName(), memCfg.getDefaultMemoryPolicySize(), plcNames);
}
use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.
the class IgniteCacheDatabaseSharedManager method createSystemMemoryPolicy.
/**
* @param sysCacheInitSize Initial size of PageMemory to be created for system cache.
* @param sysCacheMaxSize Maximum size of PageMemory to be created for system cache.
*
* @return {@link MemoryPolicyConfiguration configuration} of MemoryPolicy for system cache.
*/
private MemoryPolicyConfiguration createSystemMemoryPolicy(long sysCacheInitSize, long sysCacheMaxSize) {
MemoryPolicyConfiguration res = new MemoryPolicyConfiguration();
res.setName(SYSTEM_MEMORY_POLICY_NAME);
res.setInitialSize(sysCacheInitSize);
res.setMaxSize(sysCacheMaxSize);
return res;
}
use of org.apache.ignite.configuration.MemoryPolicyConfiguration in project ignite by apache.
the class IgniteCacheDatabaseSharedManager method initPageMemoryDataStructures.
/**
* @param dbCfg Database config.
*/
protected void initPageMemoryDataStructures(MemoryConfiguration dbCfg) throws IgniteCheckedException {
freeListMap = U.newHashMap(memPlcMap.size());
String dfltMemPlcName = dbCfg.getDefaultMemoryPolicyName();
for (MemoryPolicy memPlc : memPlcMap.values()) {
MemoryPolicyConfiguration memPlcCfg = memPlc.config();
MemoryMetricsImpl memMetrics = (MemoryMetricsImpl) memMetricsMap.get(memPlcCfg.getName());
FreeListImpl freeList = new FreeListImpl(0, cctx.igniteInstanceName(), memMetrics, memPlc, null, cctx.wal(), 0L, true);
memMetrics.freeList(freeList);
freeListMap.put(memPlcCfg.getName(), freeList);
}
dfltFreeList = freeListMap.get(dfltMemPlcName);
}
Aggregations