You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dg...@apache.org on 2019/04/25 09:51:57 UTC
[ignite] branch master updated: IGNITE-8578 .NET: Add baseline
auto-adjust parameters (definition, run-time change) - Fixes #6430.
This is an automated email from the ASF dual-hosted git repository.
dgovorukhin 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 226e753 IGNITE-8578 .NET: Add baseline auto-adjust parameters (definition, run-time change) - Fixes #6430.
226e753 is described below
commit 226e753504096e5a9d56e59b9344a316bbb7d541
Author: Alexandr Shapkin <as...@gridgain.com>
AuthorDate: Thu Apr 25 12:51:33 2019 +0300
IGNITE-8578 .NET: Add baseline auto-adjust parameters (definition, run-time change) - Fixes #6430.
Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>
---
.../processors/platform/PlatformProcessorImpl.java | 30 ++++++++++++++++++
.../Cache/PersistenceTest.cs | 37 ++++++++++++++++++++++
.../dotnet/Apache.Ignite.Core/Cluster/ICluster.cs | 24 ++++++++++++++
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 31 +++++++++++++++++-
4 files changed, 121 insertions(+), 1 deletion(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
index a5f034e..621985d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
@@ -172,6 +172,18 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
/** */
private static final int OP_NODE_VERSION = 31;
+ /** */
+ private static final int OP_IS_BASELINE_AUTO_ADJ_ENABLED = 32;
+
+ /** */
+ private static final int OP_SET_BASELINE_AUTO_ADJ_ENABLED = 33;
+
+ /** */
+ private static final int OP_GET_BASELINE_AUTO_ADJ_TIMEOUT = 34;
+
+ /** */
+ private static final int OP_SET_BASELINE_AUTO_ADJ_TIMEOUT = 35;
+
/** Start latch. */
private final CountDownLatch startLatch = new CountDownLatch(1);
@@ -446,6 +458,12 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
return 0;
}
+
+ case OP_SET_BASELINE_AUTO_ADJ_TIMEOUT: {
+ ctx.grid().cluster().baselineAutoAdjustTimeout(val);
+
+ return 0;
+ }
}
return PlatformAbstractTarget.throwUnsupported(type);
@@ -506,6 +524,18 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
case OP_IS_WAL_ENABLED:
return ctx.grid().cluster().isWalEnabled(reader.readString()) ? TRUE : FALSE;
+
+ case OP_IS_BASELINE_AUTO_ADJ_ENABLED:
+ return ctx.grid().cluster().isBaselineAutoAdjustEnabled() ? TRUE : FALSE;
+
+ case OP_SET_BASELINE_AUTO_ADJ_ENABLED:
+ boolean isEnabled = reader.readBoolean();
+ ctx.grid().cluster().baselineAutoAdjustEnabled(isEnabled);
+
+ return 0;
+
+ case OP_GET_BASELINE_AUTO_ADJ_TIMEOUT:
+ return ctx.grid().cluster().baselineAutoAdjustTimeout();
}
return PlatformAbstractTarget.throwUnsupported(type);
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistenceTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistenceTest.cs
index e4cd038..a7f35fd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistenceTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/PersistenceTest.cs
@@ -23,6 +23,7 @@ namespace Apache.Ignite.Core.Tests.Cache
using Apache.Ignite.Core.Cache.Affinity.Rendezvous;
using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Cache.Store;
+ using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Configuration;
using NUnit.Framework;
@@ -324,6 +325,42 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/// <summary>
+ /// Test the configuration of IsBaselineAutoAdjustEnabled flag
+ /// </summary>
+ [Test]
+ public void TestBaselineTopologyAutoAdjustEnabledDisabled()
+ {
+ using (var ignite = Ignition.Start(GetPersistentConfiguration()))
+ {
+ ICluster cluster = ignite.GetCluster();
+ cluster.SetActive(true);
+
+ bool isEnabled = cluster.IsBaselineAutoAdjustEnabled();
+ cluster.SetBaselineAutoAdjustEnabledFlag(!isEnabled);
+
+ Assert.AreNotEqual(isEnabled, cluster.IsBaselineAutoAdjustEnabled());
+ }
+ }
+
+ /// <summary>
+ /// Test the configuration of BaselineAutoAdjustTimeout property
+ /// </summary>
+ [Test]
+ public void TestBaselineTopologyAutoAdjustTimeoutWriteRead()
+ {
+ const long newTimeout = 333000;
+ using (var ignite = Ignition.Start(GetPersistentConfiguration()))
+ {
+ ICluster cluster = ignite.GetCluster();
+ cluster.SetActive(true);
+
+ cluster.SetBaselineAutoAdjustTimeout(newTimeout);
+
+ Assert.AreEqual(newTimeout, cluster.GetBaselineAutoAdjustTimeout());
+ }
+ }
+
+ /// <summary>
/// Checks active state.
/// </summary>
private static void CheckIsActive(IIgnite ignite, bool isActive)
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs
index a7ef919..6d0da45 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs
@@ -161,5 +161,29 @@ namespace Apache.Ignite.Core.Cluster
/// </summary>
/// <param name="timeout"></param>
void SetTxTimeoutOnPartitionMapExchange(TimeSpan timeout);
+
+ /// <summary>
+ /// Returns value of manual baseline control or auto adjusting baseline.
+ /// </summary>
+ /// <returns><c>true</c> If cluster in auto-adjust. <c>false</c> If cluster in manual.</returns>
+ bool IsBaselineAutoAdjustEnabled();
+
+ /// <summary>
+ /// Sets the value of manual baseline control or auto adjusting baseline.
+ /// </summary>
+ /// <param name="isBaselineAutoAdjustEnabled"><c>true</c> If cluster in auto-adjust. <c>false</c> If cluster in manual.</param>
+ void SetBaselineAutoAdjustEnabledFlag(bool isBaselineAutoAdjustEnabled);
+
+ /// <summary>
+ /// Gets the value of time which we would wait before the actual topology change since last server topology change(node join/left/fail).
+ /// </summary>
+ /// <returns>Timeout value</returns>
+ long GetBaselineAutoAdjustTimeout();
+
+ /// <summary>
+ /// Sets the value of time which we would wait before the actual topology change since last server topology change(node join/left/fail).
+ /// </summary>
+ /// <param name="baselineAutoAdjustTimeout">Timeout value</param>
+ void SetBaselineAutoAdjustTimeout(long baselineAutoAdjustTimeout);
}
}
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index c2c9ad6..14ee486 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -93,7 +93,11 @@ namespace Apache.Ignite.Core.Impl
EnableWal = 28,
IsWalEnabled = 29,
SetTxTimeoutOnPartitionMapExchange = 30,
- GetNodeVersion = 31
+ GetNodeVersion = 31,
+ IsBaselineAutoAdjustmentEnabled = 32,
+ SetBaselineAutoAdjustmentEnabled = 33,
+ GetBaselineAutoAdjustTimeout = 34,
+ SetBaselineAutoAdjustTimeout = 35
}
/** */
@@ -846,6 +850,7 @@ namespace Apache.Ignite.Core.Impl
return DoOutOp((int) Op.IsWalEnabled, w => w.WriteString(cacheName)) == True;
}
+ /** <inheritdoc /> */
public void SetTxTimeoutOnPartitionMapExchange(TimeSpan timeout)
{
DoOutOp((int) Op.SetTxTimeoutOnPartitionMapExchange,
@@ -853,6 +858,30 @@ namespace Apache.Ignite.Core.Impl
}
/** <inheritdoc /> */
+ public bool IsBaselineAutoAdjustEnabled()
+ {
+ return DoOutOp((int) Op.IsBaselineAutoAdjustmentEnabled, s => s.ReadBool()) == True;
+ }
+
+ /** <inheritdoc /> */
+ public void SetBaselineAutoAdjustEnabledFlag(bool isBaselineAutoAdjustEnabled)
+ {
+ DoOutOp((int) Op.SetBaselineAutoAdjustmentEnabled, w => w.WriteBoolean(isBaselineAutoAdjustEnabled));
+ }
+
+ /** <inheritdoc /> */
+ public long GetBaselineAutoAdjustTimeout()
+ {
+ return DoOutOp((int) Op.GetBaselineAutoAdjustTimeout, s => s.ReadLong());
+ }
+
+ /** <inheritdoc /> */
+ public void SetBaselineAutoAdjustTimeout(long baselineAutoAdjustTimeout)
+ {
+ DoOutInOp((int) Op.SetBaselineAutoAdjustTimeout, baselineAutoAdjustTimeout);
+ }
+
+ /** <inheritdoc /> */
#pragma warning disable 618
public IPersistentStoreMetrics GetPersistentStoreMetrics()
{