Search in sources :

Example 76 with DataRegionConfiguration

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

the class CacheStartOnJoinTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    TcpDiscoverySpi testSpi = new TcpDiscoverySpi() {

        /**
         */
        private boolean delay = true;

        @Override
        protected void writeToSocket(Socket sock, OutputStream out, TcpDiscoveryAbstractMessage msg, long timeout) throws IOException, IgniteCheckedException {
            super.writeToSocket(sock, out, msg, timeout);
        }

        @Override
        protected void startMessageProcess(TcpDiscoveryAbstractMessage msg) {
            if (getTestIgniteInstanceName(0).equals(ignite.name())) {
                if (msg instanceof TcpDiscoveryJoinRequestMessage) {
                    TcpDiscoveryJoinRequestMessage msg0 = (TcpDiscoveryJoinRequestMessage) msg;
                    if (msg0.client() && delay) {
                        log.info("Delay join processing: " + msg0);
                        delay = false;
                        doSleep(5000);
                    }
                }
            }
            super.startMessageProcess(msg);
        }
    };
    testSpi.setIpFinder(ipFinder);
    testSpi.setJoinTimeout(60_000);
    cfg.setDiscoverySpi(testSpi);
    DataStorageConfiguration memCfg = new DataStorageConfiguration();
    memCfg.setPageSize(1024);
    memCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(50 * 1024 * 1024));
    cfg.setDataStorageConfiguration(memCfg);
    cfg.setClientMode(client);
    return cfg;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryAbstractMessage(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage) OutputStream(java.io.OutputStream) Socket(java.net.Socket) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) TcpDiscoveryJoinRequestMessage(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryJoinRequestMessage)

Example 77 with DataRegionConfiguration

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

the class GridCacheUtils method isPersistenceEnabled.

/**
 * @return {@code true} if persistence is enabled for at least one data region, {@code false} if not.
 */
public static boolean isPersistenceEnabled(DataStorageConfiguration cfg) {
    if (cfg == null)
        return false;
    DataRegionConfiguration dfltReg = cfg.getDefaultDataRegionConfiguration();
    if (dfltReg == null)
        return false;
    if (dfltReg.isPersistenceEnabled())
        return true;
    DataRegionConfiguration[] regCfgs = cfg.getDataRegionConfigurations();
    if (regCfgs == null)
        return false;
    for (DataRegionConfiguration regCfg : regCfgs) {
        if (regCfg.isPersistenceEnabled())
            return true;
    }
    return false;
}
Also used : DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration)

Example 78 with DataRegionConfiguration

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

the class GridCacheDatabaseSharedManager method readMetastore.

/**
 */
private void readMetastore() throws IgniteCheckedException {
    try {
        DataStorageConfiguration memCfg = cctx.kernalContext().config().getDataStorageConfiguration();
        DataRegionConfiguration plcCfg = createDataRegionConfiguration(memCfg);
        File allocPath = buildAllocPath(plcCfg);
        DirectMemoryProvider memProvider = allocPath == null ? new UnsafeMemoryProvider(log) : new MappedFileMemoryProvider(log, allocPath);
        DataRegionMetricsImpl memMetrics = new DataRegionMetricsImpl(plcCfg);
        PageMemoryEx storePageMem = (PageMemoryEx) createPageMemory(memProvider, memCfg, plcCfg, memMetrics, false);
        DataRegion regCfg = new DataRegion(storePageMem, plcCfg, memMetrics, createPageEvictionTracker(plcCfg, storePageMem));
        CheckpointStatus status = readCheckpointStatus();
        cctx.pageStore().initializeForMetastorage();
        storePageMem.start();
        checkpointReadLock();
        try {
            restoreMemory(status, true, storePageMem);
            metaStorage = new MetaStorage(cctx, regCfg, memMetrics, true);
            metaStorage.init(this);
            applyLastUpdates(status, true);
            initiallyWalDisabledGrps = walDisabledGroups();
            notifyMetastorageReadyForRead();
        } finally {
            checkpointReadUnlock();
        }
        metaStorage = null;
        storePageMem.stop();
    } catch (StorageException e) {
        throw new IgniteCheckedException(e);
    }
}
Also used : MappedFileMemoryProvider(org.apache.ignite.internal.mem.file.MappedFileMemoryProvider) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) DirectMemoryProvider(org.apache.ignite.internal.mem.DirectMemoryProvider) MetaStorage(org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage) PageMemoryEx(org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx) RandomAccessFile(java.io.RandomAccessFile) File(java.io.File) StorageException(org.apache.ignite.internal.pagemem.wal.StorageException) UnsafeMemoryProvider(org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider)

Example 79 with DataRegionConfiguration

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

the class GridCacheDatabaseSharedManager method createDataRegionConfiguration.

/**
 * @param storageCfg Data storage configuration.
 * @return Data region configuration.
 */
private DataRegionConfiguration createDataRegionConfiguration(DataStorageConfiguration storageCfg) {
    DataRegionConfiguration cfg = new DataRegionConfiguration();
    cfg.setName(METASTORE_DATA_REGION_NAME);
    cfg.setInitialSize(storageCfg.getSystemRegionInitialSize());
    cfg.setMaxSize(storageCfg.getSystemRegionMaxSize());
    cfg.setPersistenceEnabled(true);
    return cfg;
}
Also used : DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration)

Example 80 with DataRegionConfiguration

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

the class PageMemoryImpl method getDataRegionConfiguration.

/**
 * @return Data region configuration.
 */
private DataRegionConfiguration getDataRegionConfiguration() {
    DataStorageConfiguration memCfg = ctx.kernalContext().config().getDataStorageConfiguration();
    assert memCfg != null;
    String dataRegionName = memMetrics.getName();
    if (memCfg.getDefaultDataRegionConfiguration().getName().equals(dataRegionName))
        return memCfg.getDefaultDataRegionConfiguration();
    DataRegionConfiguration[] dataRegions = memCfg.getDataRegionConfigurations();
    if (dataRegions != null) {
        for (DataRegionConfiguration reg : dataRegions) {
            if (reg != null && reg.getName().equals(dataRegionName))
                return reg;
        }
    }
    return null;
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration)

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