Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setDataStorageConfiguration()
The following examples show how to use
org.apache.ignite.configuration.IgniteConfiguration#setDataStorageConfiguration() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheIgniteOutOfMemoryExceptionTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(DATA_REGION_SIZE) .setPageEvictionMode(DISABLED) .setPersistenceEnabled(false))); cfg.setFailureHandler(new AbstractFailureHandler() { /** {@inheritDoc} */ @Override protected boolean handle(Ignite ignite, FailureContext failureCtx) { failure.set(true); // Do not invalidate a node context. return false; } }); cfg.setCacheConfiguration(cacheConfiguration(ATOMIC), cacheConfiguration(TRANSACTIONAL)); return cfg; }
Example 2
Source File: CacheDataPageScanQueryTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String instanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(instanceName); cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true) .setMaxSize(DFLT_DATA_REGION_INITIAL_SIZE) )); cfg.setCacheConfiguration( new CacheConfiguration(CACHE) .setAtomicityMode(ATOMIC) .setAffinity( new RendezvousAffinityFunction() .setPartitions(PARTS) ) ); return cfg; }
Example 3
Source File: IgnitePdsRemoveDuringRebalancingTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setCacheConfiguration( new CacheConfiguration(DEFAULT_CACHE_NAME) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setBackups(1) .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC) .setRebalanceMode(CacheRebalanceMode.SYNC) ); DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(100L * 1024 * 1024) .setPersistenceEnabled(true)) .setWalMode(WALMode.LOG_ONLY) .setPageSize(1024) .setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4); cfg.setDataStorageConfiguration(memCfg); return cfg; }
Example 4
Source File: DeadLockOnNodeLeftExchangeTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setConsistentId(igniteInstanceName); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setPersistenceEnabled(true) ) ); cfg.setCommunicationSpi(new TestRecordingCommunicationSpi()); return cfg; }
Example 5
Source File: IoStatisticsSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * Create Ignite configuration. * * @param isPersist {@code true} in case persistence should be enable. * @return Ignite configuration. * @throws Exception In case of failure. */ private IgniteConfiguration getConfiguration(boolean isPersist) throws Exception { IgniteConfiguration cfg = super.getConfiguration(); if (isPersist) { DataStorageConfiguration dsCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(30L * 1024 * 1024) .setPersistenceEnabled(true)) .setWalMode(WALMode.LOG_ONLY); cfg.setDataStorageConfiguration(dsCfg); } return cfg; }
Example 6
Source File: JmxExporterSpiTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true))); JmxMetricExporterSpi jmxSpi = new JmxMetricExporterSpi(); jmxSpi.setExportFilter(mgrp -> !mgrp.name().startsWith(FILTERED_PREFIX)); cfg.setMetricExporterSpi(jmxSpi); return cfg; }
Example 7
Source File: IgnitePdsSpuriousRebalancingOnNodeJoinTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCommunicationSpi(new TestRecordingCommunicationSpi()); cfg.setConsistentId(igniteInstanceName); DataStorageConfiguration dsCfg = new DataStorageConfiguration(); dsCfg.setWalSegmentSize(4 * 1024 * 1024); dsCfg.setPageSize(1024); dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration(). setInitialSize(100L * 1024 * 1024). setMaxSize(200L * 1024 * 1024). setPersistenceEnabled(true)); cfg.setDataStorageConfiguration(dsCfg); cfg.setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME). setAtomicityMode(TRANSACTIONAL). setCacheMode(REPLICATED). setAffinity(new RendezvousAffinityFunction(false, PARTS))); return cfg; }
Example 8
Source File: IgnitePdsExchangeDuringCheckpointTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration().setMaxSize(800L * 1024 * 1024).setPersistenceEnabled(true)) .setWalMode(WALMode.LOG_ONLY) .setCheckpointThreads(1) .setCheckpointFrequency(1); memCfg.setDataRegionConfigurations(new DataRegionConfiguration() .setMaxSize(200L * 1024 * 1024) .setName(NO_PERSISTENCE_REGION) .setPersistenceEnabled(false)); cfg.setDataStorageConfiguration(memCfg); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); CacheConfiguration ccfgNp = new CacheConfiguration("nonPersistentCache"); ccfgNp.setDataRegionName(NO_PERSISTENCE_REGION); ccfgNp.setDiskPageCompression(null); ccfg.setAffinity(new RendezvousAffinityFunction(false, 4096)); cfg.setCacheConfiguration(ccfg, ccfgNp); return cfg; }
Example 9
Source File: MemoryLeaksOnRestartNodeTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration().setName("mem0").setPersistenceEnabled(false)) .setDataRegionConfigurations( new DataRegionConfiguration().setName("disk").setPersistenceEnabled(true), new DataRegionConfiguration().setName("mem2").setPersistenceEnabled(false))); return cfg; }
Example 10
Source File: IgnitePdsBinaryMetadataAsyncWritingTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (igniteInstanceName.contains("client")) { cfg.setClientMode(true); return cfg; } cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(50 * 1024 * 1024) .setPersistenceEnabled(true) ) .setFileIOFactory( specialFileIOFactory != null ? specialFileIOFactory : new RandomAccessFileIOFactory() ) ); cfg.setCacheConfiguration( new CacheConfiguration(DEFAULT_CACHE_NAME) .setBackups(1) .setAffinity(new RendezvousAffinityFunction(false, 16)) ); cfg.setFailureHandler(new StopNodeFailureHandler()); return cfg; }
Example 11
Source File: IgniteWalSerializerVersionTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String name) throws Exception { IgniteConfiguration cfg = super.getConfiguration(name); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setPersistenceEnabled(true) .setMaxSize(100L * 1024 * 1024))); return cfg; }
Example 12
Source File: IgniteAbsentEvictionNodeOutOfBaselineTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setWalSegmentSize(512 * 1024) .setWalSegments(4) .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(256 * 1024 * 1024) .setPersistenceEnabled(true)) .setWalMode(WALMode.LOG_ONLY)); return cfg; }
Example 13
Source File: Authentication1kUsersNodeRestartTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setAuthenticationEnabled(true); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setMaxSize(200L * 1024 * 1024) .setPersistenceEnabled(true))); return cfg; }
Example 14
Source File: IgniteDynamicCacheStartFailWithPersistenceTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder); cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(256L * 1024 * 1024) .setPersistenceEnabled(true)) .setWalMode(WALMode.LOG_ONLY)); return cfg; }
Example 15
Source File: IgniteCacheDistributedPartitionQueryAbstractSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration( new DataRegionConfiguration().setMaxSize(20L * 1024 * 1024)); cfg.setDataStorageConfiguration(memCfg); /** Clients cache */ CacheConfiguration<ClientKey, Client> clientCfg = new CacheConfiguration<>(); clientCfg.setName("cl"); clientCfg.setWriteSynchronizationMode(FULL_SYNC); clientCfg.setAtomicityMode(TRANSACTIONAL); clientCfg.setRebalanceMode(SYNC); clientCfg.setBackups(2); clientCfg.setAffinity(AFFINITY); clientCfg.setIndexedTypes(ClientKey.class, Client.class); /** Deposits cache */ CacheConfiguration<DepositKey, Deposit> depoCfg = new CacheConfiguration<>(); depoCfg.setName("de"); depoCfg.setWriteSynchronizationMode(FULL_SYNC); depoCfg.setAtomicityMode(TRANSACTIONAL); depoCfg.setRebalanceMode(SYNC); depoCfg.setBackups(2); depoCfg.setAffinity(AFFINITY); depoCfg.setIndexedTypes(DepositKey.class, Deposit.class); /** Regions cache. Uses default affinity. */ CacheConfiguration<Integer, Region> regionCfg = new CacheConfiguration<>(); regionCfg.setName("re"); regionCfg.setWriteSynchronizationMode(FULL_SYNC); regionCfg.setAtomicityMode(TRANSACTIONAL); regionCfg.setRebalanceMode(SYNC); regionCfg.setCacheMode(CacheMode.REPLICATED); regionCfg.setIndexedTypes(Integer.class, Region.class); cfg.setCacheConfiguration(clientCfg, depoCfg, regionCfg); if (!"client".equals(gridName)) { Integer reg = regionForGrid(gridName); cfg.setUserAttributes(F.asMap(REGION_ATTR_NAME, reg)); log().info("Assigned region " + reg + " to grid " + gridName); } return cfg; }
Example 16
Source File: IgniteWalReaderTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(CACHE_NAME); ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ccfg.setRebalanceMode(CacheRebalanceMode.SYNC); ccfg.setAffinity(new RendezvousAffinityFunction(false, 32)); ccfg.setIndexedTypes(Integer.class, IndexedObject.class); cfg.setCacheConfiguration(ccfg); cfg.setIncludeEventTypes(EVT_WAL_SEGMENT_ARCHIVED, EVT_WAL_SEGMENT_COMPACTED); DataStorageConfiguration dsCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(1024L * 1024 * 1024) .setPersistenceEnabled(true)) .setWalSegmentSize(1024 * 1024) .setWalSegments(WAL_SEGMENTS) .setWalMode(customWalMode != null ? customWalMode : WALMode.BACKGROUND) .setWalCompactionEnabled(enableWalCompaction); if (archiveIncompleteSegmentAfterInactivityMs > 0) dsCfg.setWalAutoArchiveAfterInactivity(archiveIncompleteSegmentAfterInactivityMs); String workDir = U.defaultWorkDirectory(); File db = U.resolveWorkDirectory(workDir, DFLT_STORE_DIR, false); File wal = new File(db, "wal"); if (setWalAndArchiveToSameVal) { String walAbsPath = wal.getAbsolutePath(); dsCfg.setWalPath(walAbsPath); dsCfg.setWalArchivePath(walAbsPath); } else { dsCfg.setWalPath(wal.getAbsolutePath()); dsCfg.setWalArchivePath(new File(wal, "archive").getAbsolutePath()); } cfg.setDataStorageConfiguration(dsCfg); return cfg; }
Example 17
Source File: RebuildIndexWithHistoricalRebalanceTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setConsistentId(gridName); cfg.setGridLogger(log); QueryEntity qryEntity = new QueryEntity(); qryEntity.setKeyType(UserKey.class.getName()); qryEntity.setValueType(UserValue.class.getName()); qryEntity.setKeyFields(new HashSet<>(Arrays.asList("account"))); LinkedHashMap<String, String> fields = new LinkedHashMap<>(); fields.put("account", "java.lang.Integer"); fields.put("balance", "java.lang.Integer"); qryEntity.setFields(fields); QueryIndex idx1 = new QueryIndex(); idx1.setName("IDX_1"); idx1.setIndexType(QueryIndexType.SORTED); LinkedHashMap<String, Boolean> idxFields = new LinkedHashMap<>(); idxFields.put("account", false); idxFields.put("balance", false); idx1.setFields(idxFields); QueryIndex idx2 = new QueryIndex(); idx2.setName("IDX_2"); idx2.setIndexType(QueryIndexType.SORTED); idxFields = new LinkedHashMap<>(); idxFields.put("balance", false); idx2.setFields(idxFields); qryEntity.setIndexes(Arrays.asList(idx1, idx2)); cfg.setCacheConfiguration(new CacheConfiguration<UserKey, UserValue>() .setName(CACHE_NAME) .setBackups(2) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setCacheMode(REPLICATED) .setWriteSynchronizationMode(FULL_SYNC) .setOnheapCacheEnabled(true) .setEvictionPolicy(new FifoEvictionPolicy(1000)) .setAffinity(new RendezvousAffinityFunction(false, 1)) .setQueryEntities(Collections.singleton(qryEntity))); cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true) .setInitialSize(200L * 1024 * 1024) .setMaxSize(200L * 1024 * 1024) ) ); cfg.setCommunicationSpi(new RebalanceBlockingSPI()); return cfg; }
Example 18
Source File: IgniteTcBotInitNewPageTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration<Integer, Object> ccfg = new CacheConfiguration<>(CACHE); ccfg.setAffinity(new RendezvousAffinityFunction(false, 4)); cfg.setCacheConfiguration(ccfg); DataRegionConfiguration regCfg = new DataRegionConfiguration() .setMaxSize(SF.apply(128) * 1024 * 1024) .setPersistenceEnabled(true); DataStorageConfiguration dsCfg = new DataStorageConfiguration() .setWalMode(WALMode.LOG_ONLY) .setDefaultDataRegionConfiguration(regCfg); cfg.setDataStorageConfiguration(dsCfg); return cfg; }
Example 19
Source File: IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setCacheConfiguration(cacheCfg(CACHE_NAME)); DataStorageConfiguration pCfg = new DataStorageConfiguration(); pCfg.setCheckpointFrequency(1000); cfg.setDataStorageConfiguration(pCfg); return cfg; }
Example 20
Source File: BinaryMetadataConcurrentUpdateWithIndexesTest.java From ignite with Apache License 2.0 | 2 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setIncludeEventTypes(EventType.EVTS_DISCOVERY); BlockTcpDiscoverySpi spi = new BlockTcpDiscoverySpi(); Field rndAddrsField = U.findField(BlockTcpDiscoverySpi.class, "skipAddrsRandomization"); assertNotNull(rndAddrsField); rndAddrsField.set(spi, true); cfg.setDiscoverySpi(spi.setIpFinder(sharedStaticIpFinder)); QueryEntity qryEntity = new QueryEntity("java.lang.Integer", "Value"); LinkedHashMap<String, String> fields = new LinkedHashMap<>(); Collection<QueryIndex> indexes = new ArrayList<>(FIELDS); for (int i = 0; i < FIELDS; i++) { String name = "s" + i; fields.put(name, "java.lang.String"); indexes.add(new QueryIndex(name, QueryIndexType.SORTED)); } qryEntity.setFields(fields); qryEntity.setIndexes(indexes); cfg.setDataStorageConfiguration(new DataStorageConfiguration(). setDefaultDataRegionConfiguration(new DataRegionConfiguration().setMaxSize(50 * MB))); cfg.setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME). setBackups(0). setQueryEntities(Collections.singleton(qryEntity)). setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL). setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC). setCacheMode(CacheMode.PARTITIONED)); return cfg; }