You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by na...@apache.org on 2023/09/25 08:55:18 UTC

[ignite] branch master updated: IGNITE-20426 Sync deprecated methods in the ClientCacheConfiguration (#10948)

This is an automated email from the ASF dual-hosted git repository.

namelchev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new bb91c57884a IGNITE-20426 Sync deprecated methods in the ClientCacheConfiguration (#10948)
bb91c57884a is described below

commit bb91c57884ac8377d3520ebc5e7c1fc4db2b5667
Author: Anastasia Iakimova <94...@users.noreply.github.com>
AuthorDate: Mon Sep 25 11:55:08 2023 +0300

    IGNITE-20426 Sync deprecated methods in the ClientCacheConfiguration (#10948)
---
 docs/_docs/code-snippets/dotnet/DataRebalancing.cs | 12 +++-------
 .../ignite/snippets/RebalancingConfiguration.java  |  6 ++---
 .../_docs/code-snippets/xml/rebalancing-config.xml | 23 ++++++++++---------
 docs/_docs/data-rebalancing.adoc                   | 16 +++++++------
 .../ignite/client/ClientCacheConfiguration.java    | 26 +++++++++++++++++++++-
 5 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/docs/_docs/code-snippets/dotnet/DataRebalancing.cs b/docs/_docs/code-snippets/dotnet/DataRebalancing.cs
index 9fcb2e8e525..7eed96a7d10 100644
--- a/docs/_docs/code-snippets/dotnet/DataRebalancing.cs
+++ b/docs/_docs/code-snippets/dotnet/DataRebalancing.cs
@@ -48,15 +48,9 @@ namespace dotnet_helloworld
             // 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.
diff --git a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/RebalancingConfiguration.java b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/RebalancingConfiguration.java
index 9dc61e9da9a..186b6efe495 100644
--- a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/RebalancingConfiguration.java
+++ b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/RebalancingConfiguration.java
@@ -38,8 +38,8 @@ public class RebalancingConfiguration {
         cfg.setRebalanceThreadPoolSize(4);
         //end::pool-size[]
 
-        CacheConfiguration cacheCfg = new CacheConfiguration("mycache");
         //tag::mode[]
+        CacheConfiguration cacheCfg = new CacheConfiguration("mycache");
 
         cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
 
@@ -47,13 +47,13 @@ public class RebalancingConfiguration {
         //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();
diff --git a/docs/_docs/code-snippets/xml/rebalancing-config.xml b/docs/_docs/code-snippets/xml/rebalancing-config.xml
index 44b6c329b13..4c42fcfa301 100644
--- a/docs/_docs/code-snippets/xml/rebalancing-config.xml
+++ b/docs/_docs/code-snippets/xml/rebalancing-config.xml
@@ -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"-->
diff --git a/docs/_docs/data-rebalancing.adoc b/docs/_docs/data-rebalancing.adoc
index 21af78dd07f..49dffda35c7 100644
--- a/docs/_docs/data-rebalancing.adoc
+++ b/docs/_docs/data-rebalancing.adoc
@@ -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.
@@ -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.
@@ -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.
@@ -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]
 ====
@@ -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)
 |===
 
 
diff --git a/modules/core/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java
index 17735e8eea8..0c1b2f1de36 100644
--- a/modules/core/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/client/ClientCacheConfiguration.java
@@ -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. */
@@ -287,7 +287,9 @@ public final class ClientCacheConfiguration implements Serializable {
 
     /**
      * @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;
     }
@@ -295,7 +297,9 @@ public final class ClientCacheConfiguration implements Serializable {
     /**
      * @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;
 
@@ -342,7 +346,9 @@ public final class ClientCacheConfiguration implements Serializable {
      * @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;
     }
@@ -350,7 +356,9 @@ public final class ClientCacheConfiguration implements Serializable {
     /**
      * @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;
 
@@ -363,7 +371,9 @@ public final class ClientCacheConfiguration implements Serializable {
      *
      * @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;
     }
@@ -371,7 +381,9 @@ public final class ClientCacheConfiguration implements Serializable {
     /**
      * @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;
 
@@ -388,7 +400,9 @@ public final class ClientCacheConfiguration implements Serializable {
      * 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;
     }
@@ -396,7 +410,9 @@ public final class ClientCacheConfiguration implements Serializable {
     /**
      * @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;
 
@@ -458,7 +474,9 @@ public final class ClientCacheConfiguration implements Serializable {
      * <p>
      * Default value of {@code 0} means that throttling is disabled.
      * </p>
+     * @deprecated Use {@link IgniteConfiguration#getRebalanceThrottle()} instead.
      */
+    @Deprecated
     public long getRebalanceThrottle() {
         return rebalanceThrottle;
     }
@@ -466,7 +484,9 @@ public final class ClientCacheConfiguration implements Serializable {
     /**
      * @param newVal Rebalance throttle.
      * @return {@code this} for chaining.
+     * @deprecated Use {@link IgniteConfiguration#setRebalanceThrottle(long)} instead.
      */
+    @Deprecated
     public ClientCacheConfiguration setRebalanceThrottle(long newVal) {
         rebalanceThrottle = newVal;
 
@@ -475,7 +495,9 @@ public final class ClientCacheConfiguration implements Serializable {
 
     /**
      * @return Rebalance timeout (ms).
+     * @deprecated Use {@link IgniteConfiguration#getRebalanceTimeout()} instead.
      */
+    @Deprecated
     public long getRebalanceTimeout() {
         return rebalanceTimeout;
     }
@@ -483,7 +505,9 @@ public final class ClientCacheConfiguration implements Serializable {
     /**
      * @param newVal Rebalance timeout.
      * @return {@code this} for chaining.
+     * @deprecated Use {@link IgniteConfiguration#getRebalanceTimeout()} instead.
      */
+    @Deprecated
     public ClientCacheConfiguration setRebalanceTimeout(long newVal) {
         rebalanceTimeout = newVal;