Skip to content

Commit

Permalink
IGNITE-20426 Sync deprecated methods in the ClientCacheConfiguration (a…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nastya828 authored and J-Bakuli committed Nov 10, 2023
1 parent 980f444 commit c4f3faf
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 31 deletions.
12 changes: 3 additions & 9 deletions docs/_docs/code-snippets/dotnet/DataRebalancing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,9 @@ public static void RebalanceThrottle()
// tag::RebalanceThrottle[]
IgniteConfiguration cfg = new IgniteConfiguration
{
CacheConfiguration = new[]
{
new CacheConfiguration
{
Name = "mycache",
RebalanceBatchSize = 2 * 1024 * 1024,
RebalanceThrottle = new TimeSpan(0, 0, 0, 0, 100)
}
}
RebalanceBatchSize = 2 * 1024 * 1024,
RebalanceThrottle = new TimeSpan(0, 0, 0, 0, 100),
RebalanceBatchesPrefetchCount = 3
};

// Start a node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ void configure() {
cfg.setRebalanceThreadPoolSize(4);
//end::pool-size[]

CacheConfiguration cacheCfg = new CacheConfiguration("mycache");
//tag::mode[]
CacheConfiguration cacheCfg = new CacheConfiguration("mycache");

cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC);

//end::mode[]
//tag::throttling[]

cfg.setRebalanceBatchSize(2 * 1024 * 1024);
cfg.setRebalanceBatchesPrefetchCount(3);
cfg.setRebalanceThrottle(100);

//end::throttling[]
cfg.setCacheConfiguration(cacheCfg);

// Start a node.
Ignite ignite = Ignition.start(cfg);

//end::ignite-config[]

ignite.close();
Expand Down
23 changes: 12 additions & 11 deletions docs/_docs/code-snippets/xml/rebalancing-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,34 @@
<!-- tag::ignite-config[] -->
<bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">
<!-- tag::pool-size[] -->

<property name="rebalanceThreadPoolSize" value="4"/>

<!-- end::pool-size[] -->
<!-- tag::mode[] -->
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="mycache"/>
<!-- tag::mode[] -->
<!-- enable synchronous rebalance mode -->
<property name="rebalanceMode" value="SYNC"/>
<!-- end::mode[] -->
<!-- tag::throttling[] -->
<!-- Set batch size. -->
<property name="rebalanceBatchSize" value="#{2 * 1024 * 1024}"/>
<!-- Set throttle interval. -->
<property name="rebalanceThrottle" value="100"/>
<!-- end::throttling[] -->
</bean>
</list>
</property>
<!-- end::mode[] -->
<!-- tag::throttling[] -->
<!-- Set batch size. -->
<property name="rebalanceBatchSize" value="#{2 * 1024 * 1024}"/>
<!-- Set batches prefetch count. -->
<property name="rebalanceBatchesPrefetchCount" value="3"/>
<!-- Set throttle interval. -->
<property name="rebalanceThrottle" value="100"/>
<!-- end::throttling[] -->

<!-- tag::discovery[] -->
<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">

<!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<!--bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder"-->
Expand Down
16 changes: 9 additions & 7 deletions docs/_docs/data-rebalancing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

== Overview

When a new node joins the cluster, some of the partitions are relocated to the new node so that the data remains distributed equally in the cluster. This process is called _data rebalancing_.
When a new node joins the cluster, some partitions are relocated to the new node so that the data remains distributed equally in the cluster. This process is called _data rebalancing_.

If an existing node permanently leaves the cluster and backups are not configured, you lose the partitions stored on this node.
When backups are configured, one of the backup copies of the lost partitions becomes a primary partition and the rebalancing process is initiated.
Expand All @@ -28,8 +28,6 @@ In pure in-memory clusters, the default behavior is to start rebalancing immedia
In clusters with persistence, the baseline topology has to be changed manually (default behavior), or can be changed automatically when link:clustering/baseline-topology#baseline-topology-autoadjustment[automatic baseline adjustment] is enabled.
====

Rebalancing is configured per cache.

== Configuring Rebalancing Mode

Ignite supports both synchronous and asynchronous rebalancing.
Expand Down Expand Up @@ -66,7 +64,7 @@ include::code-snippets/dotnet/DataRebalancing.cs[tag=RebalanceMode,indent=0]
tab:C++[unsupported]
--

== Configuring Rebalance Thread Pool
== Configuring Rebalance Thread Pool [[threadpool]]

By default, rebalancing is performed in one thread on each node.
It means that at each point in time only one thread is used to transfer batches from one node to another, or to process batches coming from the remote node.
Expand Down Expand Up @@ -127,7 +125,7 @@ tab:C++[unsupported]

== Other Properties

The following table lists the properties of `CacheConfiguration` related to rebalancing:
The following table lists the properties of `IgniteConfiguration` related to rebalancing:

[CAUTION]
====
Expand All @@ -137,16 +135,20 @@ The following table lists the properties of `CacheConfiguration` related to reba
[cols="1,4,1",opts="header"]
|===
| Property | Description | Default Value
| `rebalanceDelay` | A delay in milliseconds before the rebalancing process starts after a node joins or leaves the topology. Rebalancing delay is useful if you plan to restart nodes or start multiple nodes at once or one after another and don't want to repartition and rebalance the data until all nodes are started.
|0 (no delay)
| `rebalanceThreadPoolSize` |Rebalance thread pool size. Limit of threads used for rebalance. See <<#threadpool>> | min(4, max(1, AVAILABLE_PROC_CNT / 4))

|`rebalanceBatchSize` | The size in bytes of a single rebalance message. The rebalancing algorithm splits the data on every node into multiple batches prior to sending it to other nodes. | 512KB

|`rebalanceBatchesPrefetchCount` | Rebalance batches prefetch count. | 3

|`rebalanceThrottle` | See <<#throttling>>.| 0 (throttling disabled)

| `rebalanceOrder` | The order in which rebalancing should be done. Rebalance order can be set to a non-zero value for caches with SYNC or ASYNC rebalance modes only. Rebalancing for caches with smaller rebalance order is completed first. By default, rebalancing is not ordered. | 0

|`rebalanceTimeout` | Timeout for pending rebalancing messages when they are exchanged between the nodes. | 10 seconds

| `rebalanceDelay` | [Deprecated] A delay in milliseconds before the rebalancing process starts after a node joins or leaves the topology. Rebalancing delay is useful if you plan to restart nodes or start multiple nodes at once or one after another and don't want to repartition and rebalance the data until all nodes are started.
| 0 (no delay)
|===


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public final class ClientCacheConfiguration implements Serializable {
/** @serial Rebalance throttle. */
private long rebalanceThrottle = IgniteConfiguration.DFLT_REBALANCE_THROTTLE;

/** @serial @serial Rebalance timeout. */
/** @serial Rebalance timeout. */
private long rebalanceTimeout = IgniteConfiguration.DFLT_REBALANCE_TIMEOUT;

/** @serial Write synchronization mode. */
Expand Down Expand Up @@ -287,15 +287,19 @@ public ClientCacheConfiguration setGroupName(String newVal) {

/**
* @return Default lock acquisition timeout. {@code 0} and means that lock acquisition will never timeout.
* @deprecated Default lock timeout configuration property has no effect.
*/
@Deprecated
public long getDefaultLockTimeout() {
return dfltLockTimeout;
}

/**
* @param dfltLockTimeout Default lock timeout.
* @return {@code this} for chaining.
* @deprecated Default lock timeout configuration property has no effect.
*/
@Deprecated
public ClientCacheConfiguration setDefaultLockTimeout(long dfltLockTimeout) {
this.dfltLockTimeout = dfltLockTimeout;

Expand Down Expand Up @@ -342,15 +346,19 @@ public ClientCacheConfiguration setReadFromBackup(boolean readFromBackup) {
* @return Size (in number bytes) to be loaded within a single rebalance message.
* Rebalancing algorithm will split total data set on every node into multiple
* batches prior to sending data.
* @deprecated Use {@link IgniteConfiguration#getRebalanceBatchSize()} instead.
*/
@Deprecated
public int getRebalanceBatchSize() {
return rebalanceBatchSize;
}

/**
* @param rebalanceBatchSize Rebalance batch size.
* @return {@code this} for chaining.
* @deprecated Use {@link IgniteConfiguration#setRebalanceBatchSize(int)} instead.
*/
@Deprecated
public ClientCacheConfiguration setRebalanceBatchSize(int rebalanceBatchSize) {
this.rebalanceBatchSize = rebalanceBatchSize;

Expand All @@ -363,15 +371,19 @@ public ClientCacheConfiguration setRebalanceBatchSize(int rebalanceBatchSize) {
*
* @return Number of batches generated by supply node at rebalancing start.
* Minimum is 1.
* @deprecated Use {@link IgniteConfiguration#getRebalanceBatchesPrefetchCount()} instead
*/
@Deprecated
public long getRebalanceBatchesPrefetchCount() {
return rebalanceBatchesPrefetchCnt;
}

/**
* @param rebalanceBatchesPrefetchCnt Rebalance batches prefetch count.
* @return {@code this} for chaining.
* @deprecated Use {@link IgniteConfiguration#getRebalanceBatchesPrefetchCount()} instead
*/
@Deprecated
public ClientCacheConfiguration setRebalanceBatchesPrefetchCount(long rebalanceBatchesPrefetchCnt) {
this.rebalanceBatchesPrefetchCnt = rebalanceBatchesPrefetchCnt;

Expand All @@ -388,15 +400,19 @@ public ClientCacheConfiguration setRebalanceBatchesPrefetchCount(long rebalanceB
* immediately upon node leaving topology. If {@code -1} is returned, then rebalancing
* will only be started manually.
* </p>
* @deprecated Use baseline topology feature instead. Please, be aware this API will be removed in the next releases.
*/
@Deprecated
public long getRebalanceDelay() {
return rebalanceDelay;
}

/**
* @param rebalanceDelay Rebalance delay.
* @return {@code this} for chaining.
* @deprecated Use baseline topology feature instead. Please, be aware this API will be removed in the next releases.
*/
@Deprecated
public ClientCacheConfiguration setRebalanceDelay(long rebalanceDelay) {
this.rebalanceDelay = rebalanceDelay;

Expand Down Expand Up @@ -458,15 +474,19 @@ public ClientCacheConfiguration setRebalanceOrder(int rebalanceOrder) {
* <p>
* Default value of {@code 0} means that throttling is disabled.
* </p>
* @deprecated Use {@link IgniteConfiguration#getRebalanceThrottle()} instead.
*/
@Deprecated
public long getRebalanceThrottle() {
return rebalanceThrottle;
}

/**
* @param newVal Rebalance throttle.
* @return {@code this} for chaining.
* @deprecated Use {@link IgniteConfiguration#setRebalanceThrottle(long)} instead.
*/
@Deprecated
public ClientCacheConfiguration setRebalanceThrottle(long newVal) {
rebalanceThrottle = newVal;

Expand All @@ -475,15 +495,19 @@ public ClientCacheConfiguration setRebalanceThrottle(long newVal) {

/**
* @return Rebalance timeout (ms).
* @deprecated Use {@link IgniteConfiguration#getRebalanceTimeout()} instead.
*/
@Deprecated
public long getRebalanceTimeout() {
return rebalanceTimeout;
}

/**
* @param newVal Rebalance timeout.
* @return {@code this} for chaining.
* @deprecated Use {@link IgniteConfiguration#getRebalanceTimeout()} instead.
*/
@Deprecated
public ClientCacheConfiguration setRebalanceTimeout(long newVal) {
rebalanceTimeout = newVal;

Expand Down

0 comments on commit c4f3faf

Please sign in to comment.