Search in sources :

Example 1 with MemoryPolicyConfiguration

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));
}
Also used : MemoryConfiguration(org.apache.ignite.configuration.MemoryConfiguration) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration)

Example 2 with MemoryPolicyConfiguration

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);
}
Also used : MappedFileMemoryProvider(org.apache.ignite.internal.mem.file.MappedFileMemoryProvider) PageMemoryNoStoreImpl(org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl) DirectMemoryProvider(org.apache.ignite.internal.mem.DirectMemoryProvider) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration) MemoryMetricsImpl(org.apache.ignite.internal.processors.cache.database.MemoryMetricsImpl)

Example 3 with MemoryPolicyConfiguration

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);
}
Also used : MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration)

Example 4 with MemoryPolicyConfiguration

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;
}
Also used : MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration)

Example 5 with MemoryPolicyConfiguration

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);
}
Also used : FreeListImpl(org.apache.ignite.internal.processors.cache.database.freelist.FreeListImpl) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration)

Aggregations

MemoryPolicyConfiguration (org.apache.ignite.configuration.MemoryPolicyConfiguration)25 MemoryConfiguration (org.apache.ignite.configuration.MemoryConfiguration)14 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)3 MemoryMetricsImpl (org.apache.ignite.internal.processors.cache.database.MemoryMetricsImpl)3 FreeListImpl (org.apache.ignite.internal.processors.cache.database.freelist.FreeListImpl)3 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)2 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 PersistentStoreConfiguration (org.apache.ignite.configuration.PersistentStoreConfiguration)2 IgniteEx (org.apache.ignite.internal.IgniteEx)2 IgniteOutOfMemoryException (org.apache.ignite.internal.mem.IgniteOutOfMemoryException)2 ArrayList (java.util.ArrayList)1 MemoryMetrics (org.apache.ignite.MemoryMetrics)1 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)1 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)1 SystemDataRegionConfiguration (org.apache.ignite.configuration.SystemDataRegionConfiguration)1 DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)1 MappedFileMemoryProvider (org.apache.ignite.internal.mem.file.MappedFileMemoryProvider)1 PageMemory (org.apache.ignite.internal.pagemem.PageMemory)1 PageMemoryNoStoreImpl (org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl)1 MemoryPolicy (org.apache.ignite.internal.processors.cache.database.MemoryPolicy)1