Search in sources :

Example 76 with DataStorageConfiguration

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

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

the class GridCacheProcessor method checkMemoryConfiguration.

/**
 * @param rmt Remote node to check.
 * @throws IgniteCheckedException If check failed.
 */
private void checkMemoryConfiguration(ClusterNode rmt) throws IgniteCheckedException {
    ClusterNode locNode = ctx.discovery().localNode();
    if (ctx.config().isClientMode() || locNode.isDaemon() || rmt.isClient() || rmt.isDaemon())
        return;
    DataStorageConfiguration dsCfg = null;
    Object dsCfgBytes = rmt.attribute(IgniteNodeAttributes.ATTR_DATA_STORAGE_CONFIG);
    if (dsCfgBytes instanceof byte[])
        dsCfg = new JdkMarshaller().unmarshal((byte[]) dsCfgBytes, U.resolveClassLoader(ctx.config()));
    if (dsCfg == null) {
        // Try to use legacy memory configuration.
        MemoryConfiguration memCfg = rmt.attribute(IgniteNodeAttributes.ATTR_MEMORY_CONFIG);
        if (memCfg != null) {
            dsCfg = new DataStorageConfiguration();
            // All properties that are used in validation should be converted here.
            dsCfg.setPageSize(memCfg.getPageSize());
        }
    }
    if (dsCfg != null) {
        DataStorageConfiguration locDsCfg = ctx.config().getDataStorageConfiguration();
        if (dsCfg.getPageSize() != locDsCfg.getPageSize()) {
            throw new IgniteCheckedException("Memory configuration mismatch (fix configuration or set -D" + IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK + "=true system property) [rmtNodeId=" + rmt.id() + ", locPageSize = " + locDsCfg.getPageSize() + ", rmtPageSize = " + dsCfg.getPageSize() + "]");
        }
    }
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) JdkMarshaller(org.apache.ignite.marshaller.jdk.JdkMarshaller) MemoryConfiguration(org.apache.ignite.configuration.MemoryConfiguration) GridTimeoutObject(org.apache.ignite.internal.processors.timeout.GridTimeoutObject)

Example 78 with DataStorageConfiguration

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

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

the class PdsConsistentIdProcessor method resolvePersistentStoreBasePath.

/**
 * @return DB storage absolute root path resolved as 'db' folder in Ignite work dir (by default) or using persistent
 * store configuration. Null if persistence is not enabled. Returned folder is created automatically.
 * @throws IgniteCheckedException if I/O failed.
 */
@Nullable
private File resolvePersistentStoreBasePath() throws IgniteCheckedException {
    final DataStorageConfiguration dsCfg = cfg.getDataStorageConfiguration();
    if (dsCfg == null)
        return null;
    final String pstPath = dsCfg.getStoragePath();
    return U.resolveWorkDirectory(cfg.getWorkDirectory(), pstPath != null ? pstPath : DB_DEFAULT_FOLDER, false);
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) Nullable(org.jetbrains.annotations.Nullable)

Example 80 with DataStorageConfiguration

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

DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)143 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)120 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)119 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)55 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)51 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)33 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)17 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7 File (java.io.File)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6 ArrayList (java.util.ArrayList)4 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)4 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)4 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)4 ConnectorConfiguration (org.apache.ignite.configuration.ConnectorConfiguration)3 IgniteOutOfMemoryException (org.apache.ignite.internal.mem.IgniteOutOfMemoryException)3 IOException (java.io.IOException)2 LinkedHashMap (java.util.LinkedHashMap)2 QueryEntity (org.apache.ignite.cache.QueryEntity)2 QueryIndex (org.apache.ignite.cache.QueryIndex)2