Search in sources :

Example 1 with MemoryConfiguration

use of org.apache.ignite.configuration.MemoryConfiguration 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 MemoryConfiguration

use of org.apache.ignite.configuration.MemoryConfiguration in project ignite by apache.

the class FoldersReuseCompatibilityTest method configPersistence.

/**
 * Setup persistence for compatible and current version node.
 *
 * @param cfg ignite config to setup.
 */
private static void configPersistence(IgniteConfiguration cfg) {
    final PersistentStoreConfiguration psCfg = new PersistentStoreConfiguration();
    cfg.setPersistentStoreConfiguration(psCfg);
    final MemoryConfiguration memCfg = new MemoryConfiguration();
    final MemoryPolicyConfiguration memPolCfg = new MemoryPolicyConfiguration();
    // we don't need much memory for this test
    memPolCfg.setMaxSize(32L * 1024 * 1024);
    memCfg.setMemoryPolicies(memPolCfg);
    cfg.setMemoryConfiguration(memCfg);
}
Also used : PersistentStoreConfiguration(org.apache.ignite.configuration.PersistentStoreConfiguration) MemoryConfiguration(org.apache.ignite.configuration.MemoryConfiguration) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration)

Example 3 with MemoryConfiguration

use of org.apache.ignite.configuration.MemoryConfiguration in project ignite by apache.

the class IgniteKernal method addDataStorageConfigurationAttributes.

/**
 * @throws IgniteCheckedException If duplicated SPI name found.
 */
private void addDataStorageConfigurationAttributes() throws IgniteCheckedException {
    MemoryConfiguration memCfg = cfg.getMemoryConfiguration();
    // Save legacy memory configuration if it's present.
    if (memCfg != null) {
        // Page size initialization is suspended, see IgniteCacheDatabaseSharedManager#checkPageSize.
        // We should copy initialized value from new configuration.
        memCfg.setPageSize(cfg.getDataStorageConfiguration().getPageSize());
        add(ATTR_MEMORY_CONFIG, memCfg);
    }
    // Save data storage configuration.
    add(ATTR_DATA_STORAGE_CONFIG, new JdkMarshaller().marshal(cfg.getDataStorageConfiguration()));
}
Also used : JdkMarshaller(org.apache.ignite.marshaller.jdk.JdkMarshaller) MemoryConfiguration(org.apache.ignite.configuration.MemoryConfiguration)

Example 4 with MemoryConfiguration

use of org.apache.ignite.configuration.MemoryConfiguration in project ignite by apache.

the class MemoryPolicyConfigValidationTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    MemoryConfiguration memCfg = new MemoryConfiguration();
    MemoryPolicyConfiguration[] plcs = null;
    switch(violationType) {
        case NAMES_CONFLICT:
            plcs = createPlcsWithNamesConflictCfg();
            break;
        case SYSTEM_MEMORY_POLICY_NAME_MISUSE:
            plcs = createPlcWithReservedNameMisuseCfg();
            break;
        case TOO_SMALL_MEMORY_SIZE:
            plcs = createTooSmallMemoryCfg();
            break;
        case NULL_NAME_ON_USER_DEFINED_POLICY:
            plcs = createPlcWithNullName();
            break;
        case MISSING_USER_DEFINED_DEFAULT:
            plcs = createMissingUserDefinedDefault();
            memCfg.setDefaultMemoryPolicyName(MISSING_DEFAULT_MEM_PLC_NAME);
            break;
        case TOO_SMALL_USER_DEFINED_DFLT_MEM_PLC_SIZE:
            memCfg.setDefaultMemoryPolicySize(1);
            break;
        case DEFAULT_SIZE_IS_DEFINED_TWICE:
            plcs = createValidUserDefault();
            memCfg.setDefaultMemoryPolicyName(VALID_DEFAULT_MEM_PLC_NAME);
            memCfg.setDefaultMemoryPolicySize(10L * 1014 * 1024);
            break;
        case MAX_SIZE_IS_SMALLER_THAN_INITIAL_SIZE:
            plcs = createMaxSizeSmallerThanInitialSize();
            break;
        case LTE_ZERO_RATE_TIME_INTERVAL:
            plcs = createRateTimeIntervalIsNegative();
            break;
        case LTE_ZERO_SUB_INTERVALS:
            plcs = createSubIntervalsIsNegative();
            break;
        default:
            fail("Violation type was not configured: " + violationType);
    }
    memCfg.setMemoryPolicies(plcs);
    cfg.setMemoryConfiguration(memCfg);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) MemoryConfiguration(org.apache.ignite.configuration.MemoryConfiguration) MemoryPolicyConfiguration(org.apache.ignite.configuration.MemoryPolicyConfiguration)

Example 5 with MemoryConfiguration

use of org.apache.ignite.configuration.MemoryConfiguration in project ignite by apache.

the class IgniteTopologyValidatorGridSplitCacheTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    int idx = getTestIgniteInstanceIndex(gridName);
    Map<String, Object> userAttrs = new HashMap<>(4);
    int segment = idx % 2;
    userAttrs.put(DC_NODE_ATTR, segment);
    TcpDiscoverySpi disco = (TcpDiscoverySpi) cfg.getDiscoverySpi();
    disco.setLocalPort(getDiscoPort(idx));
    disco.setIpFinder(new TcpDiscoveryVmIpFinder().setAddresses(segmented() ? (segment == 0 ? SEG_FINDER_0 : SEG_FINDER_1) : SEG_FINDER_ALL));
    if (idx != CONFIGLESS_GRID_IDX) {
        if (idx == RESOLVER_GRID_IDX) {
            userAttrs.put(ACTIVATOR_NODE_ATTR, "true");
        } else
            cfg.setActiveOnStart(false);
    }
    cfg.setUserAttributes(userAttrs);
    cfg.setMemoryConfiguration(new MemoryConfiguration().setDefaultMemoryPolicySize((50L << 20) + (100L << 20) * CACHES_CNT / GRID_CNT));
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) HashMap(java.util.HashMap) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) MemoryConfiguration(org.apache.ignite.configuration.MemoryConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

MemoryConfiguration (org.apache.ignite.configuration.MemoryConfiguration)19 MemoryPolicyConfiguration (org.apache.ignite.configuration.MemoryPolicyConfiguration)14 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)5 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)3 JdkMarshaller (org.apache.ignite.marshaller.jdk.JdkMarshaller)3 ClusterNode (org.apache.ignite.cluster.ClusterNode)2 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 HashMap (java.util.HashMap)1 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)1 SystemDataRegionConfiguration (org.apache.ignite.configuration.SystemDataRegionConfiguration)1 DetachedClusterNode (org.apache.ignite.internal.cluster.DetachedClusterNode)1 GridTimeoutObject (org.apache.ignite.internal.processors.timeout.GridTimeoutObject)1 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)1 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)1