Skip to content

Commit

Permalink
IGNITE-383 Rename preload to rebalance.
Browse files Browse the repository at this point in the history
  • Loading branch information
niktikhonov committed Mar 2, 2015
1 parent 11efb91 commit dc04e98
Show file tree
Hide file tree
Showing 145 changed files with 656 additions and 666 deletions.
4 changes: 2 additions & 2 deletions examples/config/example-cache.xml
Expand Up @@ -140,8 +140,8 @@
<!-- Initial cache size. --> <!-- Initial cache size. -->
<property name="startSize" value="3000000"/> <property name="startSize" value="3000000"/>


<!-- Set synchronous preloading (default is asynchronous). --> <!-- Set synchronous rebalancing (default is asynchronous). -->
<property name="preloadMode" value="SYNC"/> <property name="rebalanceMode" value="SYNC"/>


<!-- Set to FULL_SYNC for examples, default is PRIMARY_SYNC. --> <!-- Set to FULL_SYNC for examples, default is PRIMARY_SYNC. -->
<property name="writeSynchronizationMode" value="FULL_SYNC"/> <property name="writeSynchronizationMode" value="FULL_SYNC"/>
Expand Down
Expand Up @@ -18,7 +18,6 @@
package org.apache.ignite.examples.misc.client.memcache; package org.apache.ignite.examples.misc.client.memcache;


import org.apache.ignite.*; import org.apache.ignite.*;
import org.apache.ignite.cache.query.*;
import org.apache.ignite.configuration.*; import org.apache.ignite.configuration.*;
import org.apache.ignite.marshaller.optimized.*; import org.apache.ignite.marshaller.optimized.*;
import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.*;
Expand All @@ -27,7 +26,7 @@
import java.util.*; import java.util.*;


import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheAtomicityMode.*;
import static org.apache.ignite.cache.CachePreloadMode.*; import static org.apache.ignite.cache.CacheRebalanceMode.*;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
import static org.apache.ignite.configuration.DeploymentMode.*; import static org.apache.ignite.configuration.DeploymentMode.*;


Expand Down Expand Up @@ -73,7 +72,7 @@ public static IgniteConfiguration configuration() throws IgniteException {


cacheCfg.setAtomicityMode(TRANSACTIONAL); cacheCfg.setAtomicityMode(TRANSACTIONAL);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC); cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setPreloadMode(SYNC); cacheCfg.setRebalanceMode(SYNC);
cacheCfg.setAtomicityMode(TRANSACTIONAL); cacheCfg.setAtomicityMode(TRANSACTIONAL);


CacheQueryConfiguration qryCfg = new CacheQueryConfiguration(); CacheQueryConfiguration qryCfg = new CacheQueryConfiguration();
Expand Down
8 changes: 4 additions & 4 deletions modules/clients/src/test/resources/spring-cache.xml
Expand Up @@ -99,8 +99,8 @@
--> -->
<property name="backups" value="1"/> <property name="backups" value="1"/>


<!-- Set synchronous preloading (default is asynchronous). --> <!-- Set synchronous rebalancing (default is asynchronous). -->
<property name="preloadMode" value="SYNC"/> <property name="rebalanceMode" value="SYNC"/>
</bean> </bean>


<!-- <!--
Expand All @@ -121,8 +121,8 @@
<!-- REPLICATED cache mode. --> <!-- REPLICATED cache mode. -->
<property name="cacheMode" value="REPLICATED"/> <property name="cacheMode" value="REPLICATED"/>


<!-- Set synchronous preloading (default is asynchronous). --> <!-- Set synchronous rebalancing (default is asynchronous). -->
<property name="preloadMode" value="SYNC"/> <property name="rebalanceMode" value="SYNC"/>


<!-- Initial cache size. --> <!-- Initial cache size. -->
<property name="startSize" value="150000"/> <property name="startSize" value="150000"/>
Expand Down
Expand Up @@ -20,48 +20,48 @@
import org.jetbrains.annotations.*; import org.jetbrains.annotations.*;


/** /**
* Cache preload mode. When preloading is enabled (i.e. has value other than {@link #NONE}), distributed caches * Cache rebalance mode. When rebalancing is enabled (i.e. has value other than {@link #NONE}), distributed caches
* will attempt to preload all necessary values from other grid nodes. This enumeration is used to configure * will attempt to rebalance all necessary values from other grid nodes. This enumeration is used to configure
* preloading via {@link org.apache.ignite.configuration.CacheConfiguration#getPreloadMode()} configuration property. If not configured * rebalancing via {@link org.apache.ignite.configuration.CacheConfiguration#getRebalanceMode()} configuration property. If not configured
* explicitly, then {@link org.apache.ignite.configuration.CacheConfiguration#DFLT_PRELOAD_MODE} is used. * explicitly, then {@link org.apache.ignite.configuration.CacheConfiguration#DFLT_REBALANCE_MODE} is used.
* <p> * <p>
* Replicated caches will try to load the full set of cache entries from other nodes (or as defined by * Replicated caches will try to load the full set of cache entries from other nodes (or as defined by
* pluggable {@link org.apache.ignite.cache.affinity.CacheAffinityFunction}), while partitioned caches will only load the entries for which * pluggable {@link org.apache.ignite.cache.affinity.CacheAffinityFunction}), while partitioned caches will only load the entries for which
* current node is primary or back up. * current node is primary or back up.
* <p> * <p>
* Note that preload mode only makes sense for {@link CacheMode#REPLICATED} and {@link CacheMode#PARTITIONED} * Note that rebalance mode only makes sense for {@link CacheMode#REPLICATED} and {@link CacheMode#PARTITIONED}
* caches. Caches with {@link CacheMode#LOCAL} mode are local by definition and therefore cannot preload * caches. Caches with {@link CacheMode#LOCAL} mode are local by definition and therefore cannot rebalance
* any values from neighboring nodes. * any values from neighboring nodes.
*/ */
public enum CachePreloadMode { public enum CacheRebalanceMode {
/** /**
* Synchronous preload mode. Distributed caches will not start until all necessary data * Synchronous rebalance mode. Distributed caches will not start until all necessary data
* is loaded from other available grid nodes. * is loaded from other available grid nodes.
*/ */
SYNC, SYNC,


/** /**
* Asynchronous preload mode. Distributed caches will start immediately and will load all necessary * Asynchronous rebalance mode. Distributed caches will start immediately and will load all necessary
* data from other available grid nodes in the background. * data from other available grid nodes in the background.
*/ */
ASYNC, ASYNC,


/** /**
* In this mode no preloading will take place which means that caches will be either loaded on * In this mode no rebalancing will take place which means that caches will be either loaded on
* demand from persistent store whenever data is accessed, or will be populated explicitly. * demand from persistent store whenever data is accessed, or will be populated explicitly.
*/ */
NONE; NONE;


/** Enumerated values. */ /** Enumerated values. */
private static final CachePreloadMode[] VALS = values(); private static final CacheRebalanceMode[] VALS = values();


/** /**
* Efficiently gets enumerated value from its ordinal. * Efficiently gets enumerated value from its ordinal.
* *
* @param ord Ordinal value. * @param ord Ordinal value.
* @return Enumerated value or {@code null} if ordinal out of range. * @return Enumerated value or {@code null} if ordinal out of range.
*/ */
@Nullable public static CachePreloadMode fromOrdinal(int ord) { @Nullable public static CacheRebalanceMode fromOrdinal(int ord) {
return ord >= 0 && ord < VALS.length ? VALS[ord] : null; return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
} }
} }
Expand Up @@ -19,11 +19,9 @@


import org.apache.ignite.*; import org.apache.ignite.*;
import org.apache.ignite.cache.affinity.*; import org.apache.ignite.cache.affinity.*;
import org.apache.ignite.cache.store.*;
import org.apache.ignite.configuration.*; import org.apache.ignite.configuration.*;
import org.apache.ignite.internal.*; import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.mxbean.*; import org.apache.ignite.mxbean.*;
import org.apache.ignite.transactions.*; import org.apache.ignite.transactions.*;
import org.jetbrains.annotations.*; import org.jetbrains.annotations.*;
Expand Down Expand Up @@ -201,23 +199,23 @@ public interface GridCache<K, V> extends CacheProjection<K, V> {


/** /**
* Forces this cache node to re-balance its partitions. This method is usually used when * Forces this cache node to re-balance its partitions. This method is usually used when
* {@link CacheConfiguration#getPreloadPartitionedDelay()} configuration parameter has non-zero value. * {@link CacheConfiguration#getRebalancePartitionedDelay()} configuration parameter has non-zero value.
* When many nodes are started or stopped almost concurrently, it is more efficient to delay * When many nodes are started or stopped almost concurrently, it is more efficient to delay
* preloading until the node topology is stable to make sure that no redundant re-partitioning * rebalancing until the node topology is stable to make sure that no redundant re-partitioning
* happens. * happens.
* <p> * <p>
* In case of{@link CacheMode#PARTITIONED} caches, for better efficiency user should * In case of{@link CacheMode#PARTITIONED} caches, for better efficiency user should
* usually make sure that new nodes get placed on the same place of consistent hash ring as * usually make sure that new nodes get placed on the same place of consistent hash ring as
* the left nodes, and that nodes are restarted before * the left nodes, and that nodes are restarted before
* {@link CacheConfiguration#getPreloadPartitionedDelay() preloadDelay} expires. To place nodes * {@link CacheConfiguration#getRebalancePartitionedDelay() rebalanceDelay} expires. To place nodes
* on the same place in consistent hash ring, use * on the same place in consistent hash ring, use
* {@link org.apache.ignite.cache.affinity.consistenthash.CacheConsistentHashAffinityFunction#setHashIdResolver(org.apache.ignite.cache.affinity.CacheAffinityNodeHashResolver)} to make sure that * {@link org.apache.ignite.cache.affinity.consistenthash.CacheConsistentHashAffinityFunction#setHashIdResolver(org.apache.ignite.cache.affinity.CacheAffinityNodeHashResolver)} to make sure that
* a node maps to the same hash ID if re-started. * a node maps to the same hash ID if re-started.
* <p> * <p>
* See {@link org.apache.ignite.configuration.CacheConfiguration#getPreloadPartitionedDelay()} for more information on how to configure * See {@link org.apache.ignite.configuration.CacheConfiguration#getRebalancePartitionedDelay()} for more information on how to configure
* preload re-partition delay. * rebalance re-partition delay.
* <p> * <p>
* @return Future that will be completed when preloading is finished. * @return Future that will be completed when rebalancing is finished.
*/ */
public IgniteInternalFuture<?> forceRepartition(); public IgniteInternalFuture<?> forceRepartition();
} }

0 comments on commit dc04e98

Please sign in to comment.