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));
}
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);
}
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()));
}
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;
}
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;
}
Aggregations