Java Code Examples for org.apache.ignite.configuration.CacheConfiguration#setRebalanceDelay()
The following examples show how to use
org.apache.ignite.configuration.CacheConfiguration#setRebalanceDelay() .
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: GridCacheNearTxForceKeyTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setAtomicityMode(TRANSACTIONAL); ccfg.setWriteSynchronizationMode(FULL_SYNC); ccfg.setRebalanceMode(ASYNC); ccfg.setRebalanceDelay(5000); ccfg.setBackups(0); ccfg.setNearConfiguration(new NearCacheConfiguration()); cfg.setCacheConfiguration(ccfg); return cfg; }
Example 2
Source File: IgniteDbDynamicCacheSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @throws Exception If failed. */ @Test public void testCreate() throws Exception { int iterations = 200; startGrids(3); Ignite ignite = ignite(0); ignite.active(true); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setName("cache1"); ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg.setAffinity(new RendezvousAffinityFunction(false, 32)); if (MvccFeatureChecker.forcedMvcc()) ccfg.setRebalanceDelay(Long.MAX_VALUE); else ccfg.setRebalanceMode(CacheRebalanceMode.NONE); for (int k = 0; k < iterations; k++) { System.out.println("Iteration: " + k); IgniteCache cache = ignite.createCache(ccfg); awaitPartitionMapExchange(); ignite.destroyCache(ccfg.getName()); awaitPartitionMapExchange(); } }
Example 3
Source File: IgniteCacheP2pUnmarshallingErrorTest.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 (getTestIgniteInstanceName(0).equals(igniteInstanceName)) cfg.setCacheConfiguration(); if (getTestIgniteInstanceName(10).equals(igniteInstanceName)) { CacheConfiguration cc = cfg.getCacheConfiguration()[0]; cc.setRebalanceDelay(-1); } return cfg; }
Example 4
Source File: IgnitePdsPartitionsStateRecoveryTest.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.setConsistentId(igniteInstanceName); DataStorageConfiguration dsCfg = new DataStorageConfiguration() .setWalMode(WALMode.LOG_ONLY) .setWalSegmentSize(16 * 1024 * 1024) .setCheckpointFrequency(20 * 60 * 1000) .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(512 * 1024 * 1024) .setPersistenceEnabled(true) ); cfg.setDataStorageConfiguration(dsCfg); CacheConfiguration ccfg = defaultCacheConfiguration() .setBackups(0) .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC) .setAffinity(new RendezvousAffinityFunction(false, PARTS_CNT)); // Disable rebalance to prevent owning MOVING partitions. if (MvccFeatureChecker.forcedMvcc()) ccfg.setRebalanceDelay(Long.MAX_VALUE); else ccfg.setRebalanceMode(CacheRebalanceMode.NONE); cfg.setCacheConfiguration(ccfg); return cfg; }
Example 5
Source File: IgnitePdsRecoveryAfterFileCorruptionTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); CacheConfiguration ccfg = new CacheConfiguration(cacheName); ccfg.setAffinity(new RendezvousAffinityFunction(true, 1)); if (MvccFeatureChecker.forcedMvcc()) ccfg.setRebalanceDelay(Long.MAX_VALUE); else ccfg.setRebalanceMode(CacheRebalanceMode.NONE); ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cfg.setCacheConfiguration(ccfg); DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(1024L * 1024 * 1024) .setPersistenceEnabled(true) .setName(policyName)) .setWalMode(WALMode.LOG_ONLY) .setCheckpointFrequency(500) .setAlwaysWriteFullPages(true); cfg.setDataStorageConfiguration(memCfg); return cfg; }
Example 6
Source File: IgnitePdsCacheStartStopWithFreqCheckpointTest.java From ignite with Apache License 2.0 | 5 votes |
/** */ private CacheConfiguration cacheConfiguration(int cacheIdx) { CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME + cacheIdx) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setCacheMode(CacheMode.REPLICATED) .setBackups(0); if (MvccFeatureChecker.forcedMvcc()) ccfg.setRebalanceDelay(Long.MAX_VALUE); else ccfg.setRebalanceMode(CacheRebalanceMode.NONE); return ccfg; }
Example 7
Source File: IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param igniteInstanceName Ignite instance name. * @return Test cache configuration. */ public CacheConfiguration cacheConfiguration(String igniteInstanceName) { MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK); CacheConfiguration ccfg = defaultCacheConfiguration(); ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ccfg.setBackups(backups); ccfg.setNearConfiguration(null); ccfg.setCacheMode(CacheMode.PARTITIONED); ccfg.setRebalanceDelay(-1); return ccfg; }
Example 8
Source File: GridCacheRebalancingSyncSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration iCfg = super.getConfiguration(igniteInstanceName); if (MvccFeatureChecker.forcedMvcc()) { iCfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration().setMaxSize(400L * 1024 * 1024) )); } TcpCommunicationSpi commSpi = new CollectingCommunicationSpi(); commSpi.setTcpNoDelay(true); iCfg.setCommunicationSpi(commSpi); CacheConfiguration<Integer, Integer> cachePCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); cachePCfg.setName(CACHE_NAME_DHT_PARTITIONED); cachePCfg.setCacheMode(CacheMode.PARTITIONED); cachePCfg.setRebalanceMode(CacheRebalanceMode.SYNC); cachePCfg.setBackups(1); cachePCfg.setRebalanceBatchSize(1); cachePCfg.setRebalanceBatchesPrefetchCount(1); cachePCfg.setRebalanceOrder(2); cachePCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cachePCfg.setAffinity(new RendezvousAffinityFunction().setPartitions(32)); CacheConfiguration<Integer, Integer> cachePCfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME); cachePCfg2.setName(CACHE_NAME_DHT_PARTITIONED_2); cachePCfg2.setCacheMode(CacheMode.PARTITIONED); cachePCfg2.setRebalanceMode(CacheRebalanceMode.SYNC); cachePCfg2.setBackups(1); cachePCfg2.setRebalanceOrder(2); cachePCfg2.setRebalanceDelay(SF.applyLB(5000, 500)); cachePCfg2.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cachePCfg2.setAffinity(new RendezvousAffinityFunction().setPartitions(32)); CacheConfiguration<Integer, Integer> cacheRCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); cacheRCfg.setName(CACHE_NAME_DHT_REPLICATED); cacheRCfg.setCacheMode(CacheMode.REPLICATED); cacheRCfg.setRebalanceMode(CacheRebalanceMode.SYNC); cacheRCfg.setRebalanceBatchSize(1); cacheRCfg.setRebalanceBatchesPrefetchCount(Integer.MAX_VALUE); cacheRCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cacheRCfg.setAffinity(new RendezvousAffinityFunction().setPartitions(32)); CacheConfiguration<Integer, Integer> cacheRCfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME); cacheRCfg2.setName(CACHE_NAME_DHT_REPLICATED_2); cacheRCfg2.setCacheMode(CacheMode.REPLICATED); cacheRCfg2.setRebalanceMode(CacheRebalanceMode.SYNC); cacheRCfg2.setRebalanceOrder(4); cacheRCfg2.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cacheRCfg2.setAffinity(new RendezvousAffinityFunction().setPartitions(32)); iCfg.setCacheConfiguration(cachePCfg, cachePCfg2, cacheRCfg, cacheRCfg2); iCfg.setRebalanceThreadPoolSize(3); return iCfg; }