Search in sources :

Example 51 with DataRegionConfiguration

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

the class JdbcThinAuthenticateConnectionSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("deprecation")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(disco);
    cfg.setMarshaller(new BinaryMarshaller());
    cfg.setAuthenticationEnabled(true);
    cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)));
    return cfg;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 52 with DataRegionConfiguration

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

the class StandaloneGridKernalContext method prepareIgniteConfiguration.

/**
 * @return Ignite configuration which allows to start requied processors for WAL reader
 */
private IgniteConfiguration prepareIgniteConfiguration() {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setDiscoverySpi(new StandaloneNoopDiscoverySpi());
    cfg.setCommunicationSpi(new StandaloneNoopCommunicationSpi());
    final Marshaller marshaller = new BinaryMarshaller();
    cfg.setMarshaller(marshaller);
    final DataStorageConfiguration pstCfg = new DataStorageConfiguration();
    final DataRegionConfiguration regCfg = new DataRegionConfiguration();
    regCfg.setPersistenceEnabled(true);
    pstCfg.setDefaultDataRegionConfiguration(regCfg);
    cfg.setDataStorageConfiguration(pstCfg);
    marshaller.setContext(marshallerCtx);
    return cfg;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) Marshaller(org.apache.ignite.marshaller.Marshaller) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller)

Example 53 with DataRegionConfiguration

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

the class IgniteCacheDatabaseSharedManager method ensureFreeSpace.

/**
 * See {@link GridCacheMapEntry#ensureFreeSpace()}
 *
 * @param memPlc data region.
 */
public void ensureFreeSpace(DataRegion memPlc) throws IgniteCheckedException {
    if (memPlc == null)
        return;
    DataRegionConfiguration plcCfg = memPlc.config();
    if (plcCfg.getPageEvictionMode() == DataPageEvictionMode.DISABLED || plcCfg.isPersistenceEnabled())
        return;
    long memorySize = plcCfg.getMaxSize();
    PageMemory pageMem = memPlc.pageMemory();
    int sysPageSize = pageMem.systemPageSize();
    CacheFreeListImpl freeListImpl = freeListMap.get(plcCfg.getName());
    for (; ; ) {
        long allocatedPagesCnt = pageMem.loadedPages();
        int emptyDataPagesCnt = freeListImpl.emptyDataPages();
        boolean shouldEvict = allocatedPagesCnt > (memorySize / sysPageSize * plcCfg.getEvictionThreshold()) && emptyDataPagesCnt < plcCfg.getEmptyPagesPoolSize();
        if (shouldEvict) {
            memPlc.evictionTracker().evictDataPage();
            memPlc.memoryMetrics().updateEvictionRate();
        } else
            break;
    }
}
Also used : DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) CacheFreeListImpl(org.apache.ignite.internal.processors.cache.persistence.freelist.CacheFreeListImpl) PageMemory(org.apache.ignite.internal.pagemem.PageMemory)

Example 54 with DataRegionConfiguration

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

the class IgniteCacheDatabaseSharedManager method validateConfiguration.

/**
 * @param memCfg configuration to validate.
 */
private void validateConfiguration(DataStorageConfiguration memCfg) throws IgniteCheckedException {
    checkPageSize(memCfg);
    DataRegionConfiguration[] regCfgs = memCfg.getDataRegionConfigurations();
    Set<String> regNames = (regCfgs != null) ? U.<String>newHashSet(regCfgs.length) : new HashSet<String>(0);
    checkSystemDataRegionSizeConfiguration(memCfg.getSystemRegionInitialSize(), memCfg.getSystemRegionMaxSize());
    if (regCfgs != null) {
        for (DataRegionConfiguration regCfg : regCfgs) checkDataRegionConfiguration(memCfg, regNames, regCfg);
    }
    checkDataRegionConfiguration(memCfg, regNames, memCfg.getDefaultDataRegionConfiguration());
}
Also used : DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration)

Example 55 with DataRegionConfiguration

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

the class IgniteCacheDatabaseSharedManager method registerMetricsMBeans.

/**
 * Registers MBeans for all DataRegionMetrics configured in this instance.
 */
private void registerMetricsMBeans() {
    if (U.IGNITE_MBEANS_DISABLED)
        return;
    IgniteConfiguration cfg = cctx.gridConfig();
    for (DataRegionMetrics memMetrics : memMetricsMap.values()) {
        DataRegionConfiguration memPlcCfg = dataRegionMap.get(memMetrics.getName()).config();
        registerMetricsMBean((DataRegionMetricsImpl) memMetrics, memPlcCfg, cfg);
    }
}
Also used : DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) DataRegionMetrics(org.apache.ignite.DataRegionMetrics)

Aggregations

DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)147 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)119 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)108 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)48 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)45 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)33 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)16 DataRegionMetricsImpl (org.apache.ignite.internal.processors.cache.persistence.DataRegionMetricsImpl)15 UnsafeMemoryProvider (org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider)10 PageMemory (org.apache.ignite.internal.pagemem.PageMemory)9 DirectMemoryProvider (org.apache.ignite.internal.mem.DirectMemoryProvider)8 File (java.io.File)7 PageMemoryNoStoreImpl (org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl)7 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 MappedFileMemoryProvider (org.apache.ignite.internal.mem.file.MappedFileMemoryProvider)5 FullPageId (org.apache.ignite.internal.pagemem.FullPageId)5 GridCacheSharedContext (org.apache.ignite.internal.processors.cache.GridCacheSharedContext)5 IgniteCacheDatabaseSharedManager (org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager)5 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)4