You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/06/13 07:46:31 UTC
[01/39] ignite git commit: IGNITE-5400 .NET:
IgniteConfiguration.SqlConnectorConfiguration
Repository: ignite
Updated Branches:
refs/heads/ignite-5272 1ef802ed4 -> 721d5684f
IGNITE-5400 .NET: IgniteConfiguration.SqlConnectorConfiguration
This closes #2085
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/86d0049b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/86d0049b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/86d0049b
Branch: refs/heads/ignite-5272
Commit: 86d0049b7a248cf6f9fe2532b63d0e22baaa659e
Parents: 56768a2
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Jun 7 12:08:34 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Jun 7 12:08:34 2017 +0300
----------------------------------------------------------------------
.../utils/PlatformConfigurationUtils.java | 86 ++++++++++
.../IgniteConfigurationSerializerTest.cs | 26 ++-
.../IgniteConfigurationTest.cs | 56 +++++++
.../Apache.Ignite.Core.csproj | 2 +
.../Configuration/Package-Info.cs | 26 +++
.../Configuration/SqlConnectorConfiguration.cs | 159 ++++++++++++++++++
.../Apache.Ignite.Core/IgniteConfiguration.cs | 164 +++++++++++++++++++
.../IgniteConfigurationSection.xsd | 92 +++++++++++
.../Common/IgniteConfigurationXmlSerializer.cs | 10 ++
9 files changed, 620 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 7f23b85..40dafbd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -58,6 +58,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.MemoryConfiguration;
import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.configuration.SqlConnectorConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.binary.BinaryRawReaderEx;
import org.apache.ignite.internal.binary.BinaryRawWriterEx;
@@ -562,6 +563,26 @@ public class PlatformConfigurationUtils {
if (in.readBoolean())
cfg.setClientFailureDetectionTimeout(in.readLong());
+ // Thread pools.
+ if (in.readBoolean())
+ cfg.setPublicThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setStripedPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setServiceThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setSystemThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setAsyncCallbackPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setManagementThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setDataStreamerThreadPoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setUtilityCachePoolSize(in.readInt());
+ if (in.readBoolean())
+ cfg.setQueryThreadPoolSize(in.readInt());
+
readCacheConfigurations(in, cfg);
readDiscoveryConfiguration(in, cfg);
@@ -650,6 +671,9 @@ public class PlatformConfigurationUtils {
if (in.readBoolean())
cfg.setMemoryConfiguration(readMemoryConfiguration(in));
+ if (in.readBoolean())
+ cfg.setSqlConnectorConfiguration(readSqlConnectorConfiguration(in));
+
readPluginConfiguration(cfg, in);
}
@@ -978,6 +1002,26 @@ public class PlatformConfigurationUtils {
w.writeBoolean(true);
w.writeLong(cfg.getClientFailureDetectionTimeout());
+ // Thread pools.
+ w.writeBoolean(true);
+ w.writeInt(cfg.getPublicThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getStripedPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getServiceThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getSystemThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getAsyncCallbackPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getManagementThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getDataStreamerThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getUtilityCacheThreadPoolSize());
+ w.writeBoolean(true);
+ w.writeInt(cfg.getQueryThreadPoolSize());
+
CacheConfiguration[] cacheCfg = cfg.getCacheConfiguration();
if (cacheCfg != null) {
@@ -1084,6 +1128,8 @@ public class PlatformConfigurationUtils {
writeMemoryConfiguration(w, cfg.getMemoryConfiguration());
+ writeSqlConnectorConfiguration(w, cfg.getSqlConnectorConfiguration());
+
w.writeString(cfg.getIgniteHome());
w.writeLong(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getInit());
@@ -1371,7 +1417,47 @@ public class PlatformConfigurationUtils {
}
}
+ /**
+ * Reads the SQL connector configuration.
+ *
+ * @param in Reader.
+ * @return Config.
+ */
+ private static SqlConnectorConfiguration readSqlConnectorConfiguration(BinaryRawReader in) {
+ return new SqlConnectorConfiguration()
+ .setHost(in.readString())
+ .setPort(in.readInt())
+ .setPortRange(in.readInt())
+ .setSocketSendBufferSize(in.readInt())
+ .setSocketReceiveBufferSize(in.readInt())
+ .setTcpNoDelay(in.readBoolean())
+ .setMaxOpenCursorsPerConnection(in.readInt())
+ .setThreadPoolSize(in.readInt());
+ }
+
+ /**
+ * Writes the SQL connector configuration.
+ *
+ * @param w Writer.
+ */
+ private static void writeSqlConnectorConfiguration(BinaryRawWriter w, SqlConnectorConfiguration cfg) {
+ assert w != null;
+
+ if (cfg != null) {
+ w.writeBoolean(true);
+ w.writeString(cfg.getHost());
+ w.writeInt(cfg.getPort());
+ w.writeInt(cfg.getPortRange());
+ w.writeInt(cfg.getSocketSendBufferSize());
+ w.writeInt(cfg.getSocketReceiveBufferSize());
+ w.writeBoolean(cfg.isTcpNoDelay());
+ w.writeInt(cfg.getMaxOpenCursorsPerConnection());
+ w.writeInt(cfg.getThreadPoolSize());
+ } else {
+ w.writeBoolean(false);
+ }
+ }
/**
* Private constructor.
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index c726f85..7ba4ed2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -40,6 +40,7 @@ namespace Apache.Ignite.Core.Tests
using Apache.Ignite.Core.Cache.Store;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Communication.Tcp;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.DataStructures.Configuration;
using Apache.Ignite.Core.Deployment;
using Apache.Ignite.Core.Discovery.Tcp;
@@ -140,6 +141,7 @@ namespace Apache.Ignite.Core.Tests
<memoryPolicyConfiguration emptyPagesPoolSize='1' evictionThreshold='0.2' name='dfPlc' pageEvictionMode='RandomLru' initialSize='89' maxSize='98' swapFilePath='abc' metricsEnabled='true' rateTimeInterval='0:1:2' subIntervals='9' />
</memoryPolicies>
</memoryConfiguration>
+ <sqlConnectorConfiguration host='bar' port='10' portRange='11' socketSendBufferSize='12' socketReceiveBufferSize='13' tcpNoDelay='true' maxOpenCursorsPerConnection='14' threadPoolSize='15' />
</igniteConfig>";
var cfg = IgniteConfiguration.FromXml(xml);
@@ -278,6 +280,17 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(TimeSpan.FromSeconds(62), memPlc.RateTimeInterval);
Assert.AreEqual(PeerAssemblyLoadingMode.CurrentAppDomain, cfg.PeerAssemblyLoadingMode);
+
+ var sql = cfg.SqlConnectorConfiguration;
+ Assert.IsNotNull(sql);
+ Assert.AreEqual("bar", sql.Host);
+ Assert.AreEqual(10, sql.Port);
+ Assert.AreEqual(11, sql.PortRange);
+ Assert.AreEqual(12, sql.SocketSendBufferSize);
+ Assert.AreEqual(13, sql.SocketReceiveBufferSize);
+ Assert.IsTrue(sql.TcpNoDelay);
+ Assert.AreEqual(14, sql.MaxOpenCursorsPerConnection);
+ Assert.AreEqual(15, sql.ThreadPoolSize);
}
/// <summary>
@@ -839,7 +852,18 @@ namespace Apache.Ignite.Core.Tests
}
}
},
- PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain
+ PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain,
+ SqlConnectorConfiguration = new SqlConnectorConfiguration
+ {
+ Host = "foo",
+ Port = 2,
+ PortRange = 3,
+ MaxOpenCursorsPerConnection = 4,
+ SocketReceiveBufferSize = 5,
+ SocketSendBufferSize = 6,
+ TcpNoDelay = false,
+ ThreadPoolSize = 7
+ }
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index 80b271d..9d19a23 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -27,6 +27,7 @@ namespace Apache.Ignite.Core.Tests
using Apache.Ignite.Core.Cache.Eviction;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Communication.Tcp;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.DataStructures.Configuration;
using Apache.Ignite.Core.Discovery.Tcp;
using Apache.Ignite.Core.Discovery.Tcp.Multicast;
@@ -81,6 +82,7 @@ namespace Apache.Ignite.Core.Tests
CheckDefaultValueAttributes(new MemoryEventStorageSpi());
CheckDefaultValueAttributes(new MemoryConfiguration());
CheckDefaultValueAttributes(new MemoryPolicyConfiguration());
+ CheckDefaultValueAttributes(new SqlConnectorConfiguration());
}
/// <summary>
@@ -173,6 +175,16 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(cfg.FailureDetectionTimeout, resCfg.FailureDetectionTimeout);
Assert.AreEqual(cfg.ClientFailureDetectionTimeout, resCfg.ClientFailureDetectionTimeout);
+ Assert.AreEqual(cfg.PublicThreadPoolSize, resCfg.PublicThreadPoolSize);
+ Assert.AreEqual(cfg.StripedThreadPoolSize, resCfg.StripedThreadPoolSize);
+ Assert.AreEqual(cfg.ServiceThreadPoolSize, resCfg.ServiceThreadPoolSize);
+ Assert.AreEqual(cfg.SystemThreadPoolSize, resCfg.SystemThreadPoolSize);
+ Assert.AreEqual(cfg.AsyncCallbackThreadPoolSize, resCfg.AsyncCallbackThreadPoolSize);
+ Assert.AreEqual(cfg.ManagementThreadPoolSize, resCfg.ManagementThreadPoolSize);
+ Assert.AreEqual(cfg.DataStreamerThreadPoolSize, resCfg.DataStreamerThreadPoolSize);
+ Assert.AreEqual(cfg.UtilityCacheThreadPoolSize, resCfg.UtilityCacheThreadPoolSize);
+ Assert.AreEqual(cfg.QueryThreadPoolSize, resCfg.QueryThreadPoolSize);
+
var binCfg = cfg.BinaryConfiguration;
Assert.IsFalse(binCfg.CompactFooter);
@@ -218,6 +230,18 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(plc.Name, resPlc.Name);
Assert.AreEqual(plc.SwapFilePath, resPlc.SwapFilePath);
}
+
+ var sql = cfg.SqlConnectorConfiguration;
+ var resSql = resCfg.SqlConnectorConfiguration;
+
+ Assert.AreEqual(sql.Host, resSql.Host);
+ Assert.AreEqual(sql.Port, resSql.Port);
+ Assert.AreEqual(sql.PortRange, resSql.PortRange);
+ Assert.AreEqual(sql.MaxOpenCursorsPerConnection, resSql.MaxOpenCursorsPerConnection);
+ Assert.AreEqual(sql.SocketReceiveBufferSize, resSql.SocketReceiveBufferSize);
+ Assert.AreEqual(sql.SocketSendBufferSize, resSql.SocketSendBufferSize);
+ Assert.AreEqual(sql.TcpNoDelay, resSql.TcpNoDelay);
+ Assert.AreEqual(sql.ThreadPoolSize, resSql.ThreadPoolSize);
}
}
@@ -455,6 +479,17 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(IgniteConfiguration.DefaultFailureDetectionTimeout, cfg.FailureDetectionTimeout);
Assert.AreEqual(IgniteConfiguration.DefaultClientFailureDetectionTimeout,
cfg.ClientFailureDetectionTimeout);
+
+ // Thread pools.
+ Assert.AreEqual(IgniteConfiguration.DefaultManagementThreadPoolSize, cfg.ManagementThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.PublicThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.StripedThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.ServiceThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.SystemThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.AsyncCallbackThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.DataStreamerThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.UtilityCacheThreadPoolSize);
+ Assert.AreEqual(IgniteConfiguration.DefaultThreadPoolSize, cfg.QueryThreadPoolSize);
}
/// <summary>
@@ -466,6 +501,7 @@ namespace Apache.Ignite.Core.Tests
var props = obj.GetType().GetProperties();
foreach (var prop in props.Where(p => p.Name != "SelectorsCount" && p.Name != "ReadStripesNumber" &&
+ !p.Name.Contains("ThreadPoolSize") &&
!(p.Name == "MaxSize" &&
p.DeclaringType == typeof(MemoryPolicyConfiguration))))
{
@@ -615,6 +651,26 @@ namespace Apache.Ignite.Core.Tests
MetricsEnabled = true
}
}
+ },
+ PublicThreadPoolSize = 3,
+ StripedThreadPoolSize = 5,
+ ServiceThreadPoolSize = 6,
+ SystemThreadPoolSize = 7,
+ AsyncCallbackThreadPoolSize = 8,
+ ManagementThreadPoolSize = 9,
+ DataStreamerThreadPoolSize = 10,
+ UtilityCacheThreadPoolSize = 11,
+ QueryThreadPoolSize = 12,
+ SqlConnectorConfiguration = new SqlConnectorConfiguration
+ {
+ Host = "127.0.0.2",
+ Port = 1081,
+ PortRange = 3,
+ SocketReceiveBufferSize = 2048,
+ MaxOpenCursorsPerConnection = 5,
+ ThreadPoolSize = 4,
+ TcpNoDelay = false,
+ SocketSendBufferSize = 4096
}
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index b37b685..82bb5ca 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -98,6 +98,8 @@
<Compile Include="Cache\Configuration\PartitionLossPolicy.cs" />
<Compile Include="Cache\IMemoryMetrics.cs" />
<Compile Include="Common\ExceptionFactory.cs" />
+ <Compile Include="Configuration\Package-Info.cs" />
+ <Compile Include="Configuration\SqlConnectorConfiguration.cs" />
<Compile Include="Deployment\PeerAssemblyLoadingMode.cs" />
<Compile Include="Events\IEventStorageSpi.cs" />
<Compile Include="Events\MemoryEventStorageSpi.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs
new file mode 100644
index 0000000..f2dfb53
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/Package-Info.cs
@@ -0,0 +1,26 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#pragma warning disable 1587 // invalid XML comment
+
+/// <summary>
+/// General configuration APIs.
+/// </summary>
+namespace Apache.Ignite.Core.Configuration
+{
+ // No-op.
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs
new file mode 100644
index 0000000..0a9b7e5
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Configuration/SqlConnectorConfiguration.cs
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Configuration
+{
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using Apache.Ignite.Core.Binary;
+
+ /// <summary>
+ /// SQL connector configuration (for ODBC and JDBC).
+ /// </summary>
+ public class SqlConnectorConfiguration
+ {
+ /// <summary>
+ /// Default port.
+ /// </summary>
+ public const int DefaultPort = 10800;
+
+ /// <summary>
+ /// Default port range.
+ /// </summary>
+ public const int DefaultPortRange = 100;
+
+ /// <summary>
+ /// Default socket buffer size.
+ /// </summary>
+ public const int DefaultSocketBufferSize = 0;
+
+ /// <summary>
+ /// Default value of <see cref="TcpNoDelay" /> property.
+ /// </summary>
+ public const bool DefaultTcpNoDelay = true;
+
+ /// <summary>
+ /// Default maximum number of open cursors per connection.
+ /// </summary>
+ public const int DefaultMaxOpenCursorsPerConnection = 128;
+
+ /// <summary>
+ /// Default SQL connector thread pool size.
+ /// </summary>
+ public static readonly int DefaultThreadPoolSize = IgniteConfiguration.DefaultThreadPoolSize;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SqlConnectorConfiguration"/> class.
+ /// </summary>
+ public SqlConnectorConfiguration()
+ {
+ Port = DefaultPort;
+ PortRange = DefaultPortRange;
+ SocketSendBufferSize = DefaultSocketBufferSize;
+ SocketReceiveBufferSize = DefaultSocketBufferSize;
+ TcpNoDelay = DefaultTcpNoDelay;
+ MaxOpenCursorsPerConnection = DefaultMaxOpenCursorsPerConnection;
+ ThreadPoolSize = DefaultThreadPoolSize;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SqlConnectorConfiguration"/> class.
+ /// </summary>
+ internal SqlConnectorConfiguration(IBinaryRawReader reader)
+ {
+ Debug.Assert(reader != null);
+
+ Host = reader.ReadString();
+ Port = reader.ReadInt();
+ PortRange = reader.ReadInt();
+ SocketSendBufferSize = reader.ReadInt();
+ SocketReceiveBufferSize = reader.ReadInt();
+ TcpNoDelay = reader.ReadBoolean();
+ MaxOpenCursorsPerConnection = reader.ReadInt();
+ ThreadPoolSize = reader.ReadInt();
+ }
+
+ /// <summary>
+ /// Writes to the specified writer.
+ /// </summary>
+ internal void Write(IBinaryRawWriter writer)
+ {
+ Debug.Assert(writer != null);
+
+ writer.WriteString(Host);
+ writer.WriteInt(Port);
+ writer.WriteInt(PortRange);
+ writer.WriteInt(SocketSendBufferSize);
+ writer.WriteInt(SocketReceiveBufferSize);
+ writer.WriteBoolean(TcpNoDelay);
+ writer.WriteInt(MaxOpenCursorsPerConnection);
+ writer.WriteInt(ThreadPoolSize);
+ }
+
+ /// <summary>
+ /// Gets or sets the host.
+ /// </summary>
+ public string Host { get; set; }
+
+ /// <summary>
+ /// Gets or sets the port.
+ /// </summary>
+ [DefaultValue(DefaultPort)]
+ public int Port { get; set; }
+
+ /// <summary>
+ /// Gets or sets the port range.
+ /// </summary>
+ [DefaultValue(DefaultPortRange)]
+ public int PortRange { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the socket send buffer. When set to 0, operating system default is used.
+ /// </summary>
+ [DefaultValue(DefaultSocketBufferSize)]
+ public int SocketSendBufferSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the socket receive buffer. When set to 0, operating system default is used.
+ /// </summary>
+ [DefaultValue(DefaultSocketBufferSize)]
+ public int SocketReceiveBufferSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the value for <c>TCP_NODELAY</c> socket option. Each
+ /// socket will be opened using provided value.
+ /// <para />
+ /// Setting this option to <c>true</c> disables Nagle's algorithm
+ /// for socket decreasing latency and delivery time for small messages.
+ /// <para />
+ /// For systems that work under heavy network load it is advisable to set this value to <c>false</c>.
+ /// </summary>
+ [DefaultValue(DefaultTcpNoDelay)]
+ public bool TcpNoDelay { get; set; }
+
+ /// <summary>
+ /// Gets or sets the maximum open cursors per connection.
+ /// </summary>
+ [DefaultValue(DefaultMaxOpenCursorsPerConnection)]
+ public int MaxOpenCursorsPerConnection { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the thread pool.
+ /// </summary>
+ public int ThreadPoolSize { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 8fab8a4..40bab15 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -34,6 +34,7 @@ namespace Apache.Ignite.Core
using Apache.Ignite.Core.Communication;
using Apache.Ignite.Core.Communication.Tcp;
using Apache.Ignite.Core.Compute;
+ using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.DataStructures.Configuration;
using Apache.Ignite.Core.Deployment;
using Apache.Ignite.Core.Discovery;
@@ -103,6 +104,16 @@ namespace Apache.Ignite.Core
/// </summary>
public static readonly TimeSpan DefaultClientFailureDetectionTimeout = TimeSpan.FromSeconds(30);
+ /// <summary>
+ /// Default thread pool size.
+ /// </summary>
+ public static readonly int DefaultThreadPoolSize = Math.Max(8, Environment.ProcessorCount);
+
+ /// <summary>
+ /// Default management thread pool size.
+ /// </summary>
+ public const int DefaultManagementThreadPoolSize = 4;
+
/** */
private TimeSpan? _metricsExpireTime;
@@ -139,6 +150,33 @@ namespace Apache.Ignite.Core
/** */
private TimeSpan? _clientFailureDetectionTimeout;
+ /** */
+ private int? _publicThreadPoolSize;
+
+ /** */
+ private int? _stripedThreadPoolSize;
+
+ /** */
+ private int? _serviceThreadPoolSize;
+
+ /** */
+ private int? _systemThreadPoolSize;
+
+ /** */
+ private int? _asyncCallbackThreadPoolSize;
+
+ /** */
+ private int? _managementThreadPoolSize;
+
+ /** */
+ private int? _dataStreamerThreadPoolSize;
+
+ /** */
+ private int? _utilityCacheThreadPoolSize;
+
+ /** */
+ private int? _queryThreadPoolSize;
+
/// <summary>
/// Default network retry count.
/// </summary>
@@ -222,6 +260,17 @@ namespace Apache.Ignite.Core
writer.WriteTimeSpanAsLongNullable(_failureDetectionTimeout);
writer.WriteTimeSpanAsLongNullable(_clientFailureDetectionTimeout);
+ // Thread pools
+ writer.WriteIntNullable(_publicThreadPoolSize);
+ writer.WriteIntNullable(_stripedThreadPoolSize);
+ writer.WriteIntNullable(_serviceThreadPoolSize);
+ writer.WriteIntNullable(_systemThreadPoolSize);
+ writer.WriteIntNullable(_asyncCallbackThreadPoolSize);
+ writer.WriteIntNullable(_managementThreadPoolSize);
+ writer.WriteIntNullable(_dataStreamerThreadPoolSize);
+ writer.WriteIntNullable(_utilityCacheThreadPoolSize);
+ writer.WriteIntNullable(_queryThreadPoolSize);
+
// Cache config
var caches = CacheConfiguration;
@@ -371,6 +420,17 @@ namespace Apache.Ignite.Core
writer.WriteBoolean(false);
}
+ // SQL
+ if (SqlConnectorConfiguration != null)
+ {
+ writer.WriteBoolean(true);
+ SqlConnectorConfiguration.Write(writer);
+ }
+ else
+ {
+ writer.WriteBoolean(false);
+ }
+
// Plugins (should be last)
if (PluginConfigurations != null)
{
@@ -438,6 +498,17 @@ namespace Apache.Ignite.Core
_failureDetectionTimeout = r.ReadTimeSpanNullable();
_clientFailureDetectionTimeout = r.ReadTimeSpanNullable();
+ // Thread pools
+ _publicThreadPoolSize = r.ReadIntNullable();
+ _stripedThreadPoolSize = r.ReadIntNullable();
+ _serviceThreadPoolSize = r.ReadIntNullable();
+ _systemThreadPoolSize = r.ReadIntNullable();
+ _asyncCallbackThreadPoolSize = r.ReadIntNullable();
+ _managementThreadPoolSize = r.ReadIntNullable();
+ _dataStreamerThreadPoolSize = r.ReadIntNullable();
+ _utilityCacheThreadPoolSize = r.ReadIntNullable();
+ _queryThreadPoolSize = r.ReadIntNullable();
+
// Cache config
var cacheCfgCount = r.ReadInt();
CacheConfiguration = new List<CacheConfiguration>(cacheCfgCount);
@@ -509,6 +580,12 @@ namespace Apache.Ignite.Core
{
MemoryConfiguration = new MemoryConfiguration(r);
}
+
+ // SQL
+ if (r.ReadBoolean())
+ {
+ SqlConnectorConfiguration = new SqlConnectorConfiguration(r);
+ }
}
/// <summary>
@@ -995,5 +1072,92 @@ namespace Apache.Ignite.Core
/// Peer loading is enabled for <see cref="ICompute"/> functionality.
/// </summary>
public PeerAssemblyLoadingMode PeerAssemblyLoadingMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the size of the public thread pool, which processes compute jobs and user messages.
+ /// </summary>
+ public int PublicThreadPoolSize
+ {
+ get { return _publicThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _publicThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the striped thread pool, which processes cache requests.
+ /// </summary>
+ public int StripedThreadPoolSize
+ {
+ get { return _stripedThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _stripedThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the service thread pool, which processes Ignite services.
+ /// </summary>
+ public int ServiceThreadPoolSize
+ {
+ get { return _serviceThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _serviceThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the system thread pool, which processes internal system messages.
+ /// </summary>
+ public int SystemThreadPoolSize
+ {
+ get { return _systemThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _systemThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the asynchronous callback thread pool.
+ /// </summary>
+ public int AsyncCallbackThreadPoolSize
+ {
+ get { return _asyncCallbackThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _asyncCallbackThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the management thread pool, which processes internal Ignite jobs.
+ /// </summary>
+ [DefaultValue(DefaultManagementThreadPoolSize)]
+ public int ManagementThreadPoolSize
+ {
+ get { return _managementThreadPoolSize ?? DefaultManagementThreadPoolSize; }
+ set { _managementThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the data streamer thread pool.
+ /// </summary>
+ public int DataStreamerThreadPoolSize
+ {
+ get { return _dataStreamerThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _dataStreamerThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the utility cache thread pool.
+ /// </summary>
+ public int UtilityCacheThreadPoolSize
+ {
+ get { return _utilityCacheThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _utilityCacheThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the size of the query thread pool.
+ /// </summary>
+ public int QueryThreadPoolSize
+ {
+ get { return _queryThreadPoolSize ?? DefaultThreadPoolSize; }
+ set { _queryThreadPoolSize = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the SQL connector configuration (for JDBC and ODBC).
+ /// </summary>
+ public SqlConnectorConfiguration SqlConnectorConfiguration { get; set; }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index fae4ebb..0cd58ed 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -1247,6 +1247,53 @@
</xs:annotation>
</xs:attribute>
</xs:complexType>
+ </xs:element>
+ <xs:element name="sqlConnectorConfiguration" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>SQL connector configuration (JDBC and ODBC).</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="port" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Connector port.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="host" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Connector host.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="portRange" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Connector port range.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="socketSendBufferSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Size of the socket send buffer.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="socketReceiveBufferSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Size of the socket receive buffer.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="tcpNoDelay" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>TCP_NODELAY socket option.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="maxOpenCursorsPerConnection" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>Maximum open cursors per connection.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="threadPoolSize" type="xs:int">
+ <xs:annotation>
+ <xs:documentation>SQL connector thread pool size.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
</xs:element>
<xs:element name="pluginConfigurations" minOccurs="0">
<xs:annotation>
@@ -1433,6 +1480,51 @@
<xs:documentation>Indicates whether user assemblies should be loaded on remote nodes automatically.</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="publicThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the public thread pool, which processes compute jobs and user messages.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="stripedThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the striped thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="serviceThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the service thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="systemThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the system thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="asyncCallbackThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the async callback thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="managementThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the management thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="dataStreamerThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the data streamer thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="utilityCacheThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the utility cache thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="queryThreadPoolSize" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Size of the query thread pool.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
http://git-wip-us.apache.org/repos/asf/ignite/blob/86d0049b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
index 6c5d620..775add4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
@@ -529,12 +529,22 @@ namespace Apache.Ignite.Core.Impl.Common
var attr = property.GetCustomAttributes(true).OfType<DefaultValueAttribute>().FirstOrDefault();
if (attr != null)
+ {
return attr.Value;
+ }
+
+ var declType = property.DeclaringType;
+ if (declType != null && !declType.IsAbstract && declType.GetConstructor(new Type[0]) != null)
+ {
+ return property.GetValue(Activator.CreateInstance(declType), null);
+ }
var propertyType = property.PropertyType;
if (propertyType.IsValueType)
+ {
return Activator.CreateInstance(propertyType);
+ }
return null;
}
[34/39] ignite git commit: ignite-5272 For atomic update do not use
GridDiscoveryManager.hasNearCache,
instead always check readers on primary and update expected mapping on near
node.
Posted by sb...@apache.org.
ignite-5272 For atomic update do not use GridDiscoveryManager.hasNearCache, instead always check readers on primary and update expected mapping on near node.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/851b9ad5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/851b9ad5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/851b9ad5
Branch: refs/heads/ignite-5272
Commit: 851b9ad584097bb9aa0ebc984100aec6b95d0965
Parents: 5d98cce
Author: sboikov <sb...@gridgain.com>
Authored: Sat Jun 10 12:44:15 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Sat Jun 10 12:44:15 2017 +0300
----------------------------------------------------------------------
.../distributed/dht/GridDhtCacheEntry.java | 30 ++-
.../GridDhtAtomicAbstractUpdateFuture.java | 76 +++++--
.../GridDhtAtomicAbstractUpdateRequest.java | 22 +-
.../dht/atomic/GridDhtAtomicCache.java | 45 ++---
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 6 +-
.../GridDhtAtomicSingleUpdateRequest.java | 14 ++
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 4 +-
...idNearAtomicAbstractSingleUpdateRequest.java | 19 +-
.../GridNearAtomicAbstractUpdateFuture.java | 200 ++++++++++++++-----
.../GridNearAtomicAbstractUpdateRequest.java | 86 ++++++--
.../atomic/GridNearAtomicFullUpdateRequest.java | 24 +--
...GridNearAtomicSingleUpdateFilterRequest.java | 23 +--
.../GridNearAtomicSingleUpdateFuture.java | 42 ++--
...GridNearAtomicSingleUpdateInvokeRequest.java | 23 +--
.../GridNearAtomicSingleUpdateRequest.java | 20 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 46 +++--
.../atomic/GridNearAtomicUpdateResponse.java | 24 +--
.../atomic/IgniteCacheAtomicProtocolTest.java | 128 ++++++++++++
18 files changed, 548 insertions(+), 284 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
index 2e86fb0..05831b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
@@ -625,6 +625,15 @@ public class GridDhtCacheEntry extends GridDistributedCacheEntry {
}
/**
+ * @return Readers.
+ */
+ @Nullable public ReaderId[] readersLocked() {
+ assert Thread.holdsLock(this);
+
+ return this.rdrs;
+ }
+
+ /**
* @return Collection of readers after check.
* @throws GridCacheEntryRemovedException If removed.
*/
@@ -739,7 +748,7 @@ public class GridDhtCacheEntry extends GridDistributedCacheEntry {
/**
* Reader ID.
*/
- private static class ReaderId {
+ public static class ReaderId {
/** */
private static final ReaderId[] EMPTY_ARRAY = new ReaderId[0];
@@ -765,9 +774,26 @@ public class GridDhtCacheEntry extends GridDistributedCacheEntry {
}
/**
+ * @param readers Readers array.
+ * @param nodeId Node ID to check.
+ * @return {@code True} if node ID found in readers array.
+ */
+ public static boolean contains(@Nullable ReaderId[] readers, UUID nodeId) {
+ if (readers == null)
+ return false;
+
+ for (int i = 0; i < readers.length; i++) {
+ if (nodeId.equals(readers[i].nodeId))
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
* @return Node ID.
*/
- UUID nodeId() {
+ public UUID nodeId() {
return nodeId;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
index 5c7c027..fb58e71 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
@@ -92,6 +92,9 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridCacheFutureA
/** Response count. */
private volatile int resCnt;
+ /** */
+ private boolean addedReader;
+
/**
* @param cctx Cache context.
* @param writeVer Write version.
@@ -175,7 +178,9 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridCacheFutureA
List<ClusterNode> affNodes = affAssignment.get(entry.partition());
- List<ClusterNode> dhtNodes = cctx.dht().topology().nodes(entry.partition(), affAssignment, affNodes);
+ // Client has seen that rebalancing finished, it is safe to use affinity mapping.
+ List<ClusterNode> dhtNodes = updateReq.affinityMapping() ?
+ affNodes : cctx.dht().topology().nodes(entry.partition(), affAssignment, affNodes);
if (dhtNodes == null)
dhtNodes = affNodes;
@@ -232,9 +237,10 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridCacheFutureA
* @param key Key.
* @param readers Near cache readers.
*/
- protected abstract void addNearKey(KeyCacheObject key, Collection<UUID> readers);
+ protected abstract void addNearKey(KeyCacheObject key, GridDhtCacheEntry.ReaderId[] readers);
/**
+ * @param nearNode Near node.
* @param readers Entry readers.
* @param entry Entry.
* @param val Value.
@@ -243,27 +249,43 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridCacheFutureA
* @param expireTime Expire time for near cache update (optional).
*/
final void addNearWriteEntries(
- Collection<UUID> readers,
+ ClusterNode nearNode,
+ GridDhtCacheEntry.ReaderId[] readers,
GridDhtCacheEntry entry,
@Nullable CacheObject val,
EntryProcessor<Object, Object, Object> entryProcessor,
long ttl,
long expireTime) {
+ assert readers != null;
+
CacheWriteSynchronizationMode syncMode = updateReq.writeSynchronizationMode();
addNearKey(entry.key(), readers);
AffinityTopologyVersion topVer = updateReq.topologyVersion();
- for (UUID nodeId : readers) {
- GridDhtAtomicAbstractUpdateRequest updateReq = mappings.get(nodeId);
+ for (int i = 0; i < readers.length; i++) {
+ GridDhtCacheEntry.ReaderId reader = readers[i];
+
+ if (nearNode.id().equals(reader.nodeId()))
+ continue;
+
+ GridDhtAtomicAbstractUpdateRequest updateReq = mappings.get(reader.nodeId());
if (updateReq == null) {
- ClusterNode node = cctx.discovery().node(nodeId);
+ ClusterNode node = cctx.discovery().node(reader.nodeId());
// Node left the grid.
- if (node == null)
+ if (node == null) {
+ try {
+ entry.removeReader(reader.nodeId(), -1L);
+ }
+ catch (GridCacheEntryRemovedException ignore) {
+ assert false; // Assume hold entry lock.
+ }
+
continue;
+ }
updateReq = createRequest(
node.id(),
@@ -275,7 +297,9 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridCacheFutureA
expireTime,
null);
- mappings.put(nodeId, updateReq);
+ mappings.put(node.id(), updateReq);
+
+ addedReader = true;
}
updateReq.addNearWriteValue(entry.key(),
@@ -361,7 +385,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridCacheFutureA
GridNearAtomicUpdateResponse updateRes,
GridDhtAtomicCache.UpdateReplyClosure completionCb) {
if (F.isEmpty(mappings)) {
- updateRes.dhtNodes(Collections.<UUID>emptyList());
+ updateRes.mapping(Collections.<UUID>emptyList());
completionCb.apply(updateReq, updateRes);
@@ -372,18 +396,31 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridCacheFutureA
boolean needReplyToNear = updateReq.writeSynchronizationMode() == PRIMARY_SYNC ||
!ret.emptyResult() ||
- updateRes.nearVersion() != null ||
+ updateReq.nearCache() ||
cctx.localNodeId().equals(nearNode.id());
boolean needMapping = updateReq.fullSync() && (updateReq.needPrimaryResponse() || !sendAllToDht());
- if (needMapping) {
+ boolean readersOnlyNodes = false;
+
+ if (!updateReq.needPrimaryResponse() && addedReader) {
+ for (GridDhtAtomicAbstractUpdateRequest dhtReq : mappings.values()) {
+ if (dhtReq.nearSize() > 0 && dhtReq.size() == 0) {
+ readersOnlyNodes = true;
+
+ break;
+ }
+ }
+ }
+
+ if (needMapping || readersOnlyNodes) {
initMapping(updateRes);
needReplyToNear = true;
}
- sendDhtRequests(nearNode, ret);
+ // If there are readers updates then nearNode should not finish before primary response received.
+ sendDhtRequests(nearNode, ret, !readersOnlyNodes);
if (needReplyToNear)
completionCb.apply(updateReq, updateRes);
@@ -393,24 +430,25 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridCacheFutureA
* @param updateRes Response.
*/
private void initMapping(GridNearAtomicUpdateResponse updateRes) {
- List<UUID> dhtNodes;
+ List<UUID> mapping;
if (!F.isEmpty(mappings)) {
- dhtNodes = new ArrayList<>(mappings.size());
+ mapping = new ArrayList<>(mappings.size());
- dhtNodes.addAll(mappings.keySet());
+ mapping.addAll(mappings.keySet());
}
else
- dhtNodes = Collections.emptyList();
+ mapping = Collections.emptyList();
- updateRes.dhtNodes(dhtNodes);
+ updateRes.mapping(mapping);
}
/**
* @param nearNode Near node.
+ * @param sndRes {@code True} if allow to send result from DHT nodes.
* @param ret Return value.
*/
- private void sendDhtRequests(ClusterNode nearNode, GridCacheReturn ret) {
+ private void sendDhtRequests(ClusterNode nearNode, GridCacheReturn ret, boolean sndRes) {
for (GridDhtAtomicAbstractUpdateRequest req : mappings.values()) {
try {
assert !cctx.localNodeId().equals(req.nodeId()) : req;
@@ -418,7 +456,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridCacheFutureA
if (updateReq.fullSync()) {
req.nearReplyInfo(nearNode.id(), updateReq.futureId());
- if (ret.emptyResult())
+ if (sndRes && ret.emptyResult())
req.hasResult(true);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java
index d2dc817..a50b68c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateRequest.java
@@ -42,13 +42,13 @@ import org.jetbrains.annotations.Nullable;
*/
public abstract class GridDhtAtomicAbstractUpdateRequest extends GridCacheIdMessage implements GridCacheDeployable {
/** Skip store flag bit mask. */
- private static final int DHT_ATOMIC_SKIP_STORE_FLAG_MASK = 0x01;
+ protected static final int DHT_ATOMIC_SKIP_STORE_FLAG_MASK = 0x01;
/** Keep binary flag. */
- private static final int DHT_ATOMIC_KEEP_BINARY_FLAG_MASK = 0x02;
+ protected static final int DHT_ATOMIC_KEEP_BINARY_FLAG_MASK = 0x02;
/** Near cache key flag. */
- private static final int DHT_ATOMIC_NEAR_FLAG_MASK = 0x04;
+ protected static final int DHT_ATOMIC_NEAR_FLAG_MASK = 0x04;
/** */
static final int DHT_ATOMIC_HAS_RESULT_MASK = 0x08;
@@ -451,20 +451,6 @@ public abstract class GridDhtAtomicAbstractUpdateRequest extends GridCacheIdMess
@Nullable public abstract Object[] invokeArguments();
/**
- * @return {@code True} if near cache update request.
- */
- protected final boolean near() {
- return isFlag(DHT_ATOMIC_NEAR_FLAG_MASK);
- }
-
- /**
- * @param near Near cache update flag.
- */
- protected final void near(boolean near) {
- setFlag(near, DHT_ATOMIC_NEAR_FLAG_MASK);
- }
-
- /**
* Sets flag mask.
*
* @param flag Set or clear.
@@ -663,7 +649,7 @@ public abstract class GridDhtAtomicAbstractUpdateRequest extends GridCacheIdMess
appendFlag(flags, "skipStore");
if (keepBinary())
appendFlag(flags, "keepBinary");
- if (near())
+ if (isFlag(DHT_ATOMIC_NEAR_FLAG_MASK))
appendFlag(flags, "near");
if (hasResult())
appendFlag(flags, "hasRes");
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 443b1b1..67e3ebc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1796,7 +1796,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
locked = lockEntries(req, req.topologyVersion());
- boolean hasNear = ctx.discovery().cacheNearNode(node, name());
+ boolean hasNear = req.nearCache();
// Assign next version for update inside entries lock.
GridCacheVersion ver = ctx.versions().next(top.topologyVersion());
@@ -2406,8 +2406,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
AffinityTopologyVersion topVer = req.topologyVersion();
- boolean checkReaders = hasNear || ctx.discovery().hasNearCache(ctx.cacheId(), topVer);
-
boolean intercept = ctx.config().getInterceptor() != null;
AffinityAssignment affAssignment = ctx.affinity().assignment(topVer);
@@ -2431,13 +2429,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
Object writeVal = op == TRANSFORM ? req.entryProcessor(i) : req.writeValue(i);
- Collection<UUID> readers = null;
- Collection<UUID> filteredReaders = null;
-
- if (checkReaders) {
- readers = entry.readers();
- filteredReaders = F.view(entry.readers(), F.notEqualTo(nearNode.id()));
- }
+ // Get readers before innerUpdate (reader cleared after remove).
+ GridDhtCacheEntry.ReaderId[] readers = entry.readersLocked();
GridCacheUpdateAtomicResult updRes = entry.innerUpdate(
ver,
@@ -2492,9 +2485,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
updRes.oldValue(),
updRes.updateCounter());
- if (!F.isEmpty(filteredReaders))
+ if (readers != null)
dhtFut.addNearWriteEntries(
- filteredReaders,
+ nearNode,
+ readers,
entry,
updRes.newValue(),
entryProcessor,
@@ -2522,13 +2516,16 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
res.addNearTtl(i, updRes.newTtl(), updRes.conflictExpireTime());
if (updRes.newValue() != null) {
- IgniteInternalFuture<Boolean> f = entry.addReader(nearNode.id(), req.messageId(), topVer);
+ IgniteInternalFuture<Boolean> f =
+ entry.addReader(nearNode.id(), req.messageId(), topVer);
assert f == null : f;
}
}
- else if (F.contains(readers, nearNode.id())) // Reader became primary or backup.
+ else if (GridDhtCacheEntry.ReaderId.contains(readers, nearNode.id())) {
+ // Reader became primary or backup.
entry.removeReader(nearNode.id(), req.messageId());
+ }
else
res.addSkippedIndex(i);
}
@@ -2627,8 +2624,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
AffinityTopologyVersion topVer = req.topologyVersion();
- boolean checkReaders = hasNear || ctx.discovery().hasNearCache(ctx.cacheId(), topVer);
-
CacheStorePartialUpdateException storeErr = null;
try {
@@ -2688,13 +2683,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
assert writeVal != null || op == DELETE : "null write value found.";
- Collection<UUID> readers = null;
- Collection<UUID> filteredReaders = null;
-
- if (checkReaders) {
- readers = entry.readers();
- filteredReaders = F.view(entry.readers(), F.notEqualTo(nearNode.id()));
- }
+ // Get readers before innerUpdate (reader cleared after remove).
+ GridDhtCacheEntry.ReaderId[] readers = entry.readersLocked();
GridCacheUpdateAtomicResult updRes = entry.innerUpdate(
ver,
@@ -2764,9 +2754,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
updRes.oldValue(),
updRes.updateCounter());
- if (!F.isEmpty(filteredReaders))
+ if (readers != null)
dhtFut.addNearWriteEntries(
- filteredReaders,
+ nearNode,
+ readers,
entry,
writeVal,
entryProcessor,
@@ -2793,8 +2784,10 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
assert f == null : f;
}
}
- else if (readers.contains(nearNode.id())) // Reader became primary or backup.
+ else if (GridDhtCacheEntry.ReaderId.contains(readers, nearNode.id())) {
+ // Reader became primary or backup.
entry.removeReader(nearNode.id(), req.messageId());
+ }
else
res.addSkippedIndex(firstEntryIdx + i);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
index f053d21..595e455 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateFuture.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-import java.util.Collection;
import java.util.List;
import java.util.UUID;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -25,6 +24,7 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -67,9 +67,9 @@ class GridDhtAtomicSingleUpdateFuture extends GridDhtAtomicAbstractUpdateFuture
}
/** {@inheritDoc} */
- @Override protected void addNearKey(KeyCacheObject key, Collection<UUID> readers) {
+ @Override protected void addNearKey(KeyCacheObject key, GridDhtCacheEntry.ReaderId[] readers) {
if (mappings == null)
- mappings = U.newHashMap(readers.size());
+ mappings = U.newHashMap(readers.length);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
index 8931c24..0ade243 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicSingleUpdateRequest.java
@@ -147,6 +147,20 @@ public class GridDhtAtomicSingleUpdateRequest extends GridDhtAtomicAbstractUpdat
}
/**
+ * @return {@code True} if near cache update request.
+ */
+ private boolean near() {
+ return isFlag(DHT_ATOMIC_NEAR_FLAG_MASK);
+ }
+
+ /**
+ * @param near Near cache update flag.
+ */
+ private void near(boolean near) {
+ setFlag(near, DHT_ATOMIC_NEAR_FLAG_MASK);
+ }
+
+ /**
* @param key Key to add.
* @param val Value, {@code null} if should be removed.
* @param entryProcessor Entry processor.
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
index 2a84445..2124330 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
-import java.util.Collection;
import java.util.List;
import java.util.UUID;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
@@ -25,6 +24,7 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheEntry;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -66,7 +66,7 @@ class GridDhtAtomicUpdateFuture extends GridDhtAtomicAbstractUpdateFuture {
}
/** {@inheritDoc} */
- @Override protected void addNearKey(KeyCacheObject key, Collection<UUID> readers) {
+ @Override protected void addNearKey(KeyCacheObject key, GridDhtCacheEntry.ReaderId[] readers) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
index 9a6909a..7022561 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
@@ -51,14 +51,11 @@ public abstract class GridNearAtomicAbstractSingleUpdateRequest extends GridNear
* @param nodeId Node ID.
* @param futId Future ID.
* @param topVer Topology version.
- * @param topLocked Topology locked flag.
* @param syncMode Synchronization mode.
* @param op Cache update operation.
- * @param retval Return value required flag.
* @param subjId Subject ID.
* @param taskNameHash Task name hash code.
- * @param skipStore Skip write-through to a persistent storage.
- * @param keepBinary Keep binary flag.
+ * @param flags Flags.
* @param addDepInfo Deployment info flag.
*/
protected GridNearAtomicAbstractSingleUpdateRequest(
@@ -66,32 +63,22 @@ public abstract class GridNearAtomicAbstractSingleUpdateRequest extends GridNear
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
- boolean topLocked,
CacheWriteSynchronizationMode syncMode,
GridCacheOperation op,
- boolean retval,
@Nullable UUID subjId,
int taskNameHash,
- boolean mappingKnown,
- boolean skipStore,
- boolean keepBinary,
- boolean recovery,
+ byte flags,
boolean addDepInfo
) {
super(cacheId,
nodeId,
futId,
topVer,
- topLocked,
syncMode,
op,
- retval,
subjId,
taskNameHash,
- mappingKnown,
- skipStore,
- keepBinary,
- recovery,
+ flags,
addDepInfo);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
index 6969971..1bd8ec5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
@@ -20,9 +20,10 @@ package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
@@ -473,17 +474,41 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture
/**
*
*/
+ static class NodeResult {
+ /** */
+ boolean rcvd;
+
+ /**
+ * @param rcvd Result received flag.
+ */
+ NodeResult(boolean rcvd) {
+ this.rcvd = rcvd;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "Result [rcvd=" + rcvd + ']';
+ }
+ }
+
+ /**
+ *
+ */
static class PrimaryRequestState {
/** */
final GridNearAtomicAbstractUpdateRequest req;
/** */
@GridToStringInclude
- Set<UUID> dhtNodes;
+ Map<UUID, NodeResult> mappedNodes;
+
+ /** */
+ @GridToStringInclude
+ private int expCnt = -1;
/** */
@GridToStringInclude
- private Set<UUID> rcvd;
+ private int rcvdCnt;
/** */
private boolean hasRes;
@@ -501,24 +526,39 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture
if (req.initMappingLocally()) {
if (single) {
if (nodes.size() > 1) {
- dhtNodes = U.newHashSet(nodes.size() - 1);
+ mappedNodes = U.newHashMap(nodes.size() - 1);
for (int i = 1; i < nodes.size(); i++)
- dhtNodes.add(nodes.get(i).id());
+ mappedNodes.put(nodes.get(i).id(), new NodeResult(false));
}
else
- dhtNodes = Collections.emptySet();
+ mappedNodes = Collections.emptyMap();
}
else {
- dhtNodes = new HashSet<>();
+ mappedNodes = new HashMap<>();
for (int i = 1; i < nodes.size(); i++)
- dhtNodes.add(nodes.get(i).id());
+ mappedNodes.put(nodes.get(i).id(), new NodeResult(false));
}
+
+ expCnt = mappedNodes.size();
}
}
/**
+ *
+ */
+ void resetLocalMapping() {
+ assert req.initMappingLocally() : req;
+
+ mappedNodes = null;
+
+ expCnt = -1;
+
+ req.needPrimaryResponse(true);
+ }
+
+ /**
* @return Primary node ID.
*/
UUID primaryId() {
@@ -532,7 +572,9 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture
assert req.initMappingLocally();
for (int i = 1; i < nodes.size(); i++)
- dhtNodes.add(nodes.get(i).id());
+ mappedNodes.put(nodes.get(i).id(), new NodeResult(false));
+
+ expCnt = mappedNodes.size();
}
/**
@@ -547,11 +589,18 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture
boolean finished = false;
- for (Iterator<UUID> it = dhtNodes.iterator(); it.hasNext();) {
- UUID nodeId = it.next();
+ for (Map.Entry<UUID, NodeResult> e : mappedNodes.entrySet()) {
+ NodeResult res = e.getValue();
+
+ if (res.rcvd)
+ continue;
+
+ UUID nodeId = e.getKey();
if (!cctx.discovery().alive(nodeId)) {
- it.remove();
+ res.rcvd = true;
+
+ rcvdCnt++;
if (finished()) {
finished = true;
@@ -564,7 +613,7 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture
if (finished)
return DhtLeftResult.DONE;
- if (dhtNodes.isEmpty())
+ if (rcvdCnt == expCnt)
return !req.needPrimaryResponse() ? DhtLeftResult.ALL_RCVD_CHECK_PRIMARY : DhtLeftResult.NOT_DONE;
return DhtLeftResult.NOT_DONE;
@@ -577,7 +626,7 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture
if (req.writeSynchronizationMode() == PRIMARY_SYNC)
return hasRes;
- return (dhtNodes != null && dhtNodes.isEmpty()) && hasRes;
+ return (expCnt == rcvdCnt) && hasRes;
}
/**
@@ -622,14 +671,23 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture
* @return {@code True} if request processing finished.
*/
DhtLeftResult onDhtNodeLeft(UUID nodeId) {
- if (req.writeSynchronizationMode() != FULL_SYNC || dhtNodes == null || finished())
+ if (req.writeSynchronizationMode() != FULL_SYNC || mappedNodes == null || finished())
return DhtLeftResult.NOT_DONE;
- if (dhtNodes.remove(nodeId) && dhtNodes.isEmpty()) {
- if (hasRes)
- return DhtLeftResult.DONE;
- else
- return !req.needPrimaryResponse() ? DhtLeftResult.ALL_RCVD_CHECK_PRIMARY : DhtLeftResult.NOT_DONE;
+ NodeResult res = mappedNodes.get(nodeId);
+
+ if (res != null && !res.rcvd) {
+ res.rcvd = true;
+
+ rcvdCnt++;
+
+ if (rcvdCnt == expCnt) {
+ if (hasRes)
+ return DhtLeftResult.DONE;
+ else
+ return !req.needPrimaryResponse() ?
+ DhtLeftResult.ALL_RCVD_CHECK_PRIMARY : DhtLeftResult.NOT_DONE;
+ }
}
return DhtLeftResult.NOT_DONE;
@@ -649,16 +707,38 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture
if (res.hasResult())
hasRes = true;
- if (dhtNodes == null) {
- if (rcvd == null)
- rcvd = new HashSet<>();
+ if (mappedNodes == null) {
+ assert expCnt == -1 : expCnt;
+
+ mappedNodes = new HashMap<>();
+
+ mappedNodes.put(nodeId, new NodeResult(true));
- rcvd.add(nodeId);
+ rcvdCnt++;
return false;
}
- return dhtNodes.remove(nodeId) && finished();
+ NodeResult nodeRes = mappedNodes.get(nodeId);
+
+ if (nodeRes != null) {
+ if (nodeRes.rcvd)
+ return false;
+
+ nodeRes.rcvd = true;
+
+ rcvdCnt++;
+ }
+ else {
+ if (!hasRes) // Do not finish future until primary response received and mapping is known.
+ expCnt = -1;
+
+ mappedNodes.put(nodeId, new NodeResult(true));
+
+ rcvdCnt++;
+ }
+
+ return finished();
}
/**
@@ -676,15 +756,15 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture
assert onRes;
if (res.error() != null || res.remapTopologyVersion() != null) {
- dhtNodes = Collections.emptySet(); // Mark as finished.
+ expCnt = -1; // Mark as finished.
return true;
}
assert res.returnValue() != null : res;
- if (res.dhtNodes() != null)
- initDhtNodes(res.dhtNodes(), cctx);
+ if (res.mapping() != null)
+ initMapping(res.mapping(), cctx);
return finished();
}
@@ -693,39 +773,61 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridCacheFuture
* @param nodeIds Node IDs.
* @param cctx Context.
*/
- private void initDhtNodes(List<UUID> nodeIds, GridCacheContext cctx) {
- assert dhtNodes == null || req.initMappingLocally();
+ private void initMapping(List<UUID> nodeIds, GridCacheContext cctx) {
+ assert rcvdCnt <= nodeIds.size();
- Set<UUID> dhtNodes0 = dhtNodes;
+ expCnt = nodeIds.size();
- dhtNodes = null;
+ if (mappedNodes == null)
+ mappedNodes = U.newHashMap(nodeIds.size());
- for (UUID dhtNodeId : nodeIds) {
- if (F.contains(rcvd, dhtNodeId))
- continue;
+ for (int i = 0; i < nodeIds.size(); i++) {
+ UUID nodeId = nodeIds.get(i);
- if (req.initMappingLocally() && !F.contains(dhtNodes0, dhtNodeId))
- continue;
+ if (!mappedNodes.containsKey(nodeId)) {
+ NodeResult res = new NodeResult(false);
- if (cctx.discovery().node(dhtNodeId) != null) {
- if (dhtNodes == null)
- dhtNodes = U.newHashSet(nodeIds.size());
+ mappedNodes.put(nodeId, res);
- dhtNodes.add(dhtNodeId);
+ if (cctx.discovery().node(nodeId) == null) {
+ res.rcvd = true;
+
+ rcvdCnt++;
+ }
}
}
-
- if (dhtNodes == null)
- dhtNodes = Collections.emptySet();
}
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(PrimaryRequestState.class, this,
- "primary", primaryId(),
- "needPrimaryRes", req.needPrimaryResponse(),
- "primaryRes", req.response() != null,
- "done", finished());
+ Set<UUID> rcvd = null;
+ Set<UUID> nonRcvd = null;
+
+ if (mappedNodes != null) {
+ for (Map.Entry<UUID, NodeResult> e : mappedNodes.entrySet()) {
+ if (e.getValue().rcvd) {
+ if (rcvd == null)
+ rcvd = new HashSet<>();
+
+ rcvd.add(e.getKey());
+ }
+ else {
+ if (nonRcvd == null)
+ nonRcvd = new HashSet<>();
+
+ nonRcvd.add(e.getKey());
+ }
+ }
+ }
+
+ return "Primary [id=" + primaryId() +
+ ", opRes=" + hasRes +
+ ", expCnt=" + expCnt +
+ ", rcvdCnt=" + rcvdCnt +
+ ", primaryRes=" + (req.response() != null) +
+ ", done=" + finished() +
+ ", waitFor=" + nonRcvd +
+ ", rcvd=" + rcvd + ']';
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
index bb47af4..62618f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
@@ -66,6 +66,12 @@ public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheIdMes
/** Recovery value flag. */
private static final int RECOVERY_FLAG_MASK = 0x20;
+ /** */
+ private static final int NEAR_CACHE_FLAG_MASK = 0x40;
+
+ /** */
+ private static final int AFFINITY_MAPPING_FLAG_MASK = 0x80;
+
/** Target node ID. */
@GridDirectTransient
protected UUID nodeId;
@@ -110,15 +116,11 @@ public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheIdMes
* @param nodeId Node ID.
* @param futId Future ID.
* @param topVer Topology version.
- * @param topLocked Topology locked flag.
* @param syncMode Synchronization mode.
* @param op Cache update operation.
- * @param retval Return value required flag.
* @param subjId Subject ID.
* @param taskNameHash Task name hash code.
- * @param needPrimaryRes {@code True} if near node waits for primary response.
- * @param skipStore Skip write-through to a persistent storage.
- * @param keepBinary Keep binary flag.
+ * @param flags Flags.
* @param addDepInfo Deployment info flag.
*/
protected GridNearAtomicAbstractUpdateRequest(
@@ -126,16 +128,11 @@ public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheIdMes
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
- boolean topLocked,
CacheWriteSynchronizationMode syncMode,
GridCacheOperation op,
- boolean retval,
@Nullable UUID subjId,
int taskNameHash,
- boolean needPrimaryRes,
- boolean skipStore,
- boolean keepBinary,
- boolean recovery,
+ byte flags,
boolean addDepInfo
) {
this.cacheId = cacheId;
@@ -146,20 +143,73 @@ public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheIdMes
this.op = op;
this.subjId = subjId;
this.taskNameHash = taskNameHash;
+ this.flags = flags;
this.addDepInfo = addDepInfo;
+ }
+
+ /**
+ * @param nearCache {@code True} if near cache enabled on originating node.
+ * @param topLocked Topology locked flag.
+ * @param retval Return value required flag.
+ * @param affMapping {@code True} if originating node detected that rebalancing finished and
+ * expects that update is mapped using current affinity.
+ * @param needPrimaryRes {@code True} if near node waits for primary response.
+ * @param skipStore Skip write-through to a CacheStore flag.
+ * @param keepBinary Keep binary flag.
+ * @param recovery Recovery mode flag.
+ * @return Flags.
+ */
+ static byte flags(
+ boolean nearCache,
+ boolean topLocked,
+ boolean retval,
+ boolean affMapping,
+ boolean needPrimaryRes,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean recovery) {
+ byte flags = 0;
+
+ if (nearCache)
+ flags |= NEAR_CACHE_FLAG_MASK;
- if (needPrimaryRes)
- needPrimaryResponse(true);
if (topLocked)
- topologyLocked(true);
+ flags |= TOP_LOCKED_FLAG_MASK;
+
if (retval)
- returnValue(true);
+ flags |= RET_VAL_FLAG_MASK;
+
+ if (affMapping)
+ flags |= AFFINITY_MAPPING_FLAG_MASK;
+
+ if (needPrimaryRes)
+ flags |= NEED_PRIMARY_RES_FLAG_MASK;
+
if (skipStore)
- skipStore(true);
+ flags |= SKIP_STORE_FLAG_MASK;
+
if (keepBinary)
- keepBinary(true);
+ flags |= KEEP_BINARY_FLAG_MASK;
+
if (recovery)
- recovery(true);
+ flags |= RECOVERY_FLAG_MASK;
+
+ return flags;
+ }
+
+ /**
+ * @return {@code True} if originating node detected that rebalancing finished and
+ * expects that update is mapped using current affinity.
+ */
+ boolean affinityMapping() {
+ return isFlag(AFFINITY_MAPPING_FLAG_MASK);
+ }
+
+ /**
+ * @return {@code True} if near cache is enabled on node initiated operation.
+ */
+ public boolean nearCache() {
+ return isFlag(NEAR_CACHE_FLAG_MASK);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
index f175ab3..4b9aef0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
@@ -117,22 +117,19 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
/**
* Constructor.
- * @param cacheId Cache ID.
+ *
+ * @param cacheId Cache ID.
* @param nodeId Node ID.
* @param futId Future ID.
* @param topVer Topology version.
- * @param topLocked Topology locked flag.
* @param syncMode Synchronization mode.
* @param op Cache update operation.
- * @param retval Return value required flag.
* @param expiryPlc Expiry policy.
* @param invokeArgs Optional arguments for entry processor.
* @param filter Optional filter for atomic check.
* @param subjId Subject ID.
* @param taskNameHash Task name hash code.
- * @param needPrimaryRes {@code True} if client expects primary node response.
- * @param skipStore Skip write-through to a persistent storage.
- * @param keepBinary Keep binary flag.
+ * @param flags Flags.
* @param addDepInfo Deployment info flag.
* @param maxEntryCnt Maximum entries count.
*/
@@ -141,19 +138,14 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
- boolean topLocked,
CacheWriteSynchronizationMode syncMode,
GridCacheOperation op,
- boolean retval,
@Nullable ExpiryPolicy expiryPlc,
@Nullable Object[] invokeArgs,
@Nullable CacheEntryPredicate[] filter,
@Nullable UUID subjId,
int taskNameHash,
- boolean needPrimaryRes,
- boolean skipStore,
- boolean keepBinary,
- boolean recovery,
+ byte flags,
boolean addDepInfo,
int maxEntryCnt
) {
@@ -161,17 +153,13 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
nodeId,
futId,
topVer,
- topLocked,
syncMode,
op,
- retval,
subjId,
taskNameHash,
- needPrimaryRes,
- skipStore,
- keepBinary,
- recovery,
+ flags,
addDepInfo);
+
this.expiryPlc = expiryPlc;
this.invokeArgs = invokeArgs;
this.filter = filter;
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
index f5bd889..5c66bc4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
@@ -55,20 +55,17 @@ public class GridNearAtomicSingleUpdateFilterRequest extends GridNearAtomicSingl
/**
* Constructor.
- * @param cacheId Cache ID.
+ *
+ * @param cacheId Cache ID.
* @param nodeId Node ID.
* @param futId Future ID.
* @param topVer Topology version.
- * @param topLocked Topology locked flag.
* @param syncMode Synchronization mode.
* @param op Cache update operation.
- * @param retval Return value required flag.
* @param filter Optional filter for atomic check.
* @param subjId Subject ID.
* @param taskNameHash Task name hash code.
- * @param needPrimaryRes {@code True} if client expects primary node response.
- * @param skipStore Skip write-through to a persistent storage.
- * @param keepBinary Keep binary flag.
+ * @param flags Flags.
* @param addDepInfo Deployment info flag.
*/
GridNearAtomicSingleUpdateFilterRequest(
@@ -76,17 +73,12 @@ public class GridNearAtomicSingleUpdateFilterRequest extends GridNearAtomicSingl
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
- boolean topLocked,
CacheWriteSynchronizationMode syncMode,
GridCacheOperation op,
- boolean retval,
@Nullable CacheEntryPredicate[] filter,
@Nullable UUID subjId,
int taskNameHash,
- boolean needPrimaryRes,
- boolean skipStore,
- boolean keepBinary,
- boolean recovery,
+ byte flags,
boolean addDepInfo
) {
super(
@@ -94,16 +86,11 @@ public class GridNearAtomicSingleUpdateFilterRequest extends GridNearAtomicSingl
nodeId,
futId,
topVer,
- topLocked,
syncMode,
op,
- retval,
subjId,
taskNameHash,
- needPrimaryRes,
- skipStore,
- keepBinary,
- recovery,
+ flags,
addDepInfo
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
index 6ffa373..60d94b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
@@ -547,8 +547,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
else
val = EntryProcessorResourceInjectorProxy.wrap(cctx.kernalContext(), (EntryProcessor)val);
- boolean mappingKnown = cctx.topology().rebalanceFinished(topVer) &&
- !cctx.discovery().hasNearCache(cctx.cacheId(), topVer);
+ boolean mappingKnown = cctx.topology().rebalanceFinished(topVer);
List<ClusterNode> nodes = cctx.affinity().nodesByKey(cacheKey, topVer);
@@ -558,10 +557,19 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
ClusterNode primary = nodes.get(0);
- boolean needPrimaryRes = !mappingKnown || primary.isLocal() || nodes.size() == 1;
+ boolean needPrimaryRes = !mappingKnown || primary.isLocal() || nodes.size() == 1 || nearEnabled;
GridNearAtomicAbstractUpdateRequest req;
+ byte flags = GridNearAtomicAbstractUpdateRequest.flags(nearEnabled,
+ topLocked,
+ retval,
+ mappingKnown,
+ needPrimaryRes,
+ skipStore,
+ keepBinary,
+ recovery);
+
if (canUseSingleRequest()) {
if (op == TRANSFORM) {
req = new GridNearAtomicSingleUpdateInvokeRequest(
@@ -569,17 +577,12 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
primary.id(),
futId,
topVer,
- topLocked,
syncMode,
op,
- retval,
invokeArgs,
subjId,
taskNameHash,
- needPrimaryRes,
- skipStore,
- keepBinary,
- recovery,
+ flags,
cctx.deploymentEnabled());
}
else {
@@ -589,16 +592,11 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
primary.id(),
futId,
topVer,
- topLocked,
syncMode,
op,
- retval,
subjId,
taskNameHash,
- needPrimaryRes,
- skipStore,
- keepBinary,
- recovery,
+ flags,
cctx.deploymentEnabled());
}
else {
@@ -607,17 +605,12 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
primary.id(),
futId,
topVer,
- topLocked,
syncMode,
op,
- retval,
filter,
subjId,
taskNameHash,
- needPrimaryRes,
- skipStore,
- keepBinary,
- recovery,
+ flags,
cctx.deploymentEnabled());
}
}
@@ -628,19 +621,14 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
primary.id(),
futId,
topVer,
- topLocked,
syncMode,
op,
- retval,
expiryPlc,
invokeArgs,
filter,
subjId,
taskNameHash,
- needPrimaryRes,
- skipStore,
- keepBinary,
- recovery,
+ flags,
cctx.deploymentEnabled(),
1);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
index 850a0f9..b1fb530 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
@@ -73,20 +73,17 @@ public class GridNearAtomicSingleUpdateInvokeRequest extends GridNearAtomicSingl
/**
* Constructor.
- * @param cacheId Cache ID.
+ *
+ * @param cacheId Cache ID.
* @param nodeId Node ID.
* @param futId Future ID.
* @param topVer Topology version.
- * @param topLocked Topology locked flag.
* @param syncMode Synchronization mode.
* @param op Cache update operation.
- * @param retval Return value required flag.
* @param invokeArgs Optional arguments for entry processor.
* @param subjId Subject ID.
* @param taskNameHash Task name hash code.
- * @param needPrimaryRes {@code True} if client expects primary node response.
- * @param skipStore Skip write-through to a persistent storage.
- * @param keepBinary Keep binary flag.
+ * @param flags Flags.
* @param addDepInfo Deployment info flag.
*/
GridNearAtomicSingleUpdateInvokeRequest(
@@ -94,17 +91,12 @@ public class GridNearAtomicSingleUpdateInvokeRequest extends GridNearAtomicSingl
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
- boolean topLocked,
CacheWriteSynchronizationMode syncMode,
GridCacheOperation op,
- boolean retval,
@Nullable Object[] invokeArgs,
@Nullable UUID subjId,
int taskNameHash,
- boolean needPrimaryRes,
- boolean skipStore,
- boolean keepBinary,
- boolean recovery,
+ byte flags,
boolean addDepInfo
) {
super(
@@ -112,16 +104,11 @@ public class GridNearAtomicSingleUpdateInvokeRequest extends GridNearAtomicSingl
nodeId,
futId,
topVer,
- topLocked,
syncMode,
op,
- retval,
subjId,
taskNameHash,
- needPrimaryRes,
- skipStore,
- keepBinary,
- recovery,
+ flags,
addDepInfo
);
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
index 78e0f5d..dd3a7be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
@@ -71,15 +71,11 @@ public class GridNearAtomicSingleUpdateRequest extends GridNearAtomicAbstractSin
* @param nodeId Node ID.
* @param futId Future ID.
* @param topVer Topology version.
- * @param topLocked Topology locked flag.
* @param syncMode Synchronization mode.
* @param op Cache update operation.
- * @param retval Return value required flag.
* @param subjId Subject ID.
* @param taskNameHash Task name hash code.
- * @param needPrimaryRes {@code True} if client expects primary node response.
- * @param skipStore Skip write-through to a persistent storage.
- * @param keepBinary Keep binary flag.
+ * @param flags Flags.
* @param addDepInfo Deployment info flag.
*/
GridNearAtomicSingleUpdateRequest(
@@ -87,32 +83,22 @@ public class GridNearAtomicSingleUpdateRequest extends GridNearAtomicAbstractSin
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
- boolean topLocked,
CacheWriteSynchronizationMode syncMode,
GridCacheOperation op,
- boolean retval,
@Nullable UUID subjId,
int taskNameHash,
- boolean needPrimaryRes,
- boolean skipStore,
- boolean keepBinary,
- boolean recovery,
+ byte flags,
boolean addDepInfo
) {
super(cacheId,
nodeId,
futId,
topVer,
- topLocked,
syncMode,
op,
- retval,
subjId,
taskNameHash,
- needPrimaryRes,
- skipStore,
- keepBinary,
- recovery,
+ flags,
addDepInfo
);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index 46a3c34..190ed3f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -684,11 +684,8 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
}
else {
try {
- if (req.initMappingLocally() && reqState.dhtNodes.isEmpty()) {
- reqState.dhtNodes = null;
-
- req.needPrimaryResponse(true);
- }
+ if (req.initMappingLocally() && reqState.mappedNodes.isEmpty())
+ reqState.resetLocalMapping();
cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
@@ -753,8 +750,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
int size = keys.size();
- boolean mappingKnown = cctx.topology().rebalanceFinished(topVer) &&
- !cctx.discovery().hasNearCache(cctx.cacheId(), topVer);
+ boolean mappingKnown = cctx.topology().rebalanceFinished(topVer);
try {
if (size == 1) {
@@ -1001,31 +997,35 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
ClusterNode primary = nodes.get(0);
- boolean needPrimaryRes = !mappingKnown || primary.isLocal();
+ boolean needPrimaryRes = !mappingKnown || primary.isLocal() || nearEnabled;
UUID nodeId = primary.id();
PrimaryRequestState mapped = pendingMappings.get(nodeId);
if (mapped == null) {
+ byte flags = GridNearAtomicAbstractUpdateRequest.flags(nearEnabled,
+ topLocked,
+ retval,
+ mappingKnown,
+ needPrimaryRes,
+ skipStore,
+ keepBinary,
+ recovery);
+
GridNearAtomicFullUpdateRequest req = new GridNearAtomicFullUpdateRequest(
cctx.cacheId(),
nodeId,
futId,
topVer,
- topLocked,
syncMode,
op,
- retval,
expiryPlc,
invokeArgs,
filter,
subjId,
taskNameHash,
- needPrimaryRes,
- skipStore,
- keepBinary,
- recovery,
+ flags,
cctx.deploymentEnabled(),
keys.size());
@@ -1112,26 +1112,30 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
ClusterNode primary = nodes.get(0);
- boolean needPrimaryRes = !mappingKnown || primary.isLocal() || nodes.size() == 1;
+ boolean needPrimaryRes = !mappingKnown || primary.isLocal() || nodes.size() == 1 || nearEnabled;
+
+ byte flags = GridNearAtomicAbstractUpdateRequest.flags(nearEnabled,
+ topLocked,
+ retval,
+ mappingKnown,
+ needPrimaryRes,
+ skipStore,
+ keepBinary,
+ recovery);
GridNearAtomicFullUpdateRequest req = new GridNearAtomicFullUpdateRequest(
cctx.cacheId(),
primary.id(),
futId,
topVer,
- topLocked,
syncMode,
op,
- retval,
expiryPlc,
invokeArgs,
filter,
subjId,
taskNameHash,
- needPrimaryRes,
- skipStore,
- keepBinary,
- recovery,
+ flags,
cctx.deploymentEnabled(),
1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 5ba024f..9492164 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -78,7 +78,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheIdMessage implements
/** */
@GridDirectCollection(UUID.class)
@GridToStringInclude
- private List<UUID> dhtNodes;
+ private List<UUID> mapping;
/** */
@GridDirectTransient
@@ -126,17 +126,17 @@ public class GridNearAtomicUpdateResponse extends GridCacheIdMessage implements
}
/**
- * @param dhtNodes DHT nodes.
+ * @param mapping Mapping.
*/
- public void dhtNodes(List<UUID> dhtNodes) {
- this.dhtNodes = dhtNodes;
+ public void mapping(List<UUID> mapping) {
+ this.mapping = mapping;
}
/**
* @return DHT nodes.
*/
- @Nullable public List<UUID> dhtNodes() {
- return dhtNodes;
+ @Nullable public List<UUID> mapping() {
+ return mapping;
}
/**
@@ -406,19 +406,19 @@ public class GridNearAtomicUpdateResponse extends GridCacheIdMessage implements
switch (writer.state()) {
case 3:
- if (!writer.writeCollection("dhtNodes", dhtNodes, MessageCollectionItemType.UUID))
+ if (!writer.writeMessage("errs", errs))
return false;
writer.incrementState();
case 4:
- if (!writer.writeMessage("errs", errs))
+ if (!writer.writeLong("futId", futId))
return false;
writer.incrementState();
case 5:
- if (!writer.writeLong("futId", futId))
+ if (!writer.writeCollection("mapping", mapping, MessageCollectionItemType.UUID))
return false;
writer.incrementState();
@@ -464,7 +464,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheIdMessage implements
switch (reader.state()) {
case 3:
- dhtNodes = reader.readCollection("dhtNodes", MessageCollectionItemType.UUID);
+ errs = reader.readMessage("errs");
if (!reader.isLastRead())
return false;
@@ -472,7 +472,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheIdMessage implements
reader.incrementState();
case 4:
- errs = reader.readMessage("errs");
+ futId = reader.readLong("futId");
if (!reader.isLastRead())
return false;
@@ -480,7 +480,7 @@ public class GridNearAtomicUpdateResponse extends GridCacheIdMessage implements
reader.incrementState();
case 5:
- futId = reader.readLong("futId");
+ mapping = reader.readCollection("mapping", MessageCollectionItemType.UUID);
if (!reader.isLastRead())
return false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/851b9ad5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
index 749ebe8..0bfb4fb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.cache.affinity.Affinity;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.TestRecordingCommunicationSpi;
import org.apache.ignite.internal.processors.cache.GridCacheGroupIdMessage;
@@ -747,6 +748,133 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testPutReaderUpdate1() throws Exception {
+ readerUpdateDhtFails(false, false, false);
+
+ stopAllGrids();
+
+ readerUpdateDhtFails(false, true, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutReaderUpdate2() throws Exception {
+ readerUpdateDhtFails(true, false, false);
+
+ stopAllGrids();
+
+ readerUpdateDhtFails(true, true, false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAllReaderUpdate1() throws Exception {
+ readerUpdateDhtFails(false, false, true);
+
+ stopAllGrids();
+
+ readerUpdateDhtFails(false, true, true);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutAllReaderUpdate2() throws Exception {
+ readerUpdateDhtFails(true, false, true);
+
+ stopAllGrids();
+
+ readerUpdateDhtFails(true, true, true);
+ }
+
+ /**
+ * @param updateNearEnabled {@code True} if enable near cache for second put.
+ * @param delayReader If {@code true} delay reader response, otherwise delay backup response.
+ * @param putAll If {@code true} use putAll, otherwise put.
+ * @throws Exception If failed.
+ */
+ private void readerUpdateDhtFails(boolean updateNearEnabled,
+ boolean delayReader,
+ boolean putAll) throws Exception {
+ ccfg = cacheConfiguration(1, FULL_SYNC);
+
+ client = false;
+
+ startServers(2);
+
+ awaitPartitionMapExchange();
+
+ Ignite srv0 = ignite(0);
+ Ignite srv1 = ignite(1);
+
+ List<Integer> keys = primaryKeys(srv0.cache(TEST_CACHE), putAll ? 3 : 1);
+
+ ccfg = null;
+
+ client = true;
+
+ Ignite client1 = startGrid(2);
+
+ IgniteCache<Object, Object> cache1 = client1.createNearCache(TEST_CACHE, new NearCacheConfiguration<>());
+
+ Ignite client2 = startGrid(3);
+
+ IgniteCache<Object, Object> cache2 = updateNearEnabled ?
+ client2.createNearCache(TEST_CACHE, new NearCacheConfiguration<>()) : client2.cache(TEST_CACHE);
+
+ if (putAll) {
+ Map<Integer, Integer> map = new HashMap<>();
+
+ for (Integer key : keys)
+ map.put(key, 1);
+
+ cache1.putAll(map);
+ }
+ else
+ cache1.put(keys.get(0), 1);
+
+ if (delayReader)
+ testSpi(client1).blockMessages(GridDhtAtomicNearResponse.class, client2.name());
+ else
+ testSpi(srv1).blockMessages(GridDhtAtomicNearResponse.class, client2.name());
+
+ Map<Integer, Integer> map;
+
+ IgniteFuture<?> fut;
+
+ if (putAll) {
+ map = new HashMap<>();
+
+ for (Integer key : keys)
+ map.put(key, 1);
+
+ fut = cache2.putAllAsync(map);
+ }
+ else {
+ map = F.asMap(keys.get(0), 2);
+
+ fut = cache2.putAsync(keys.get(0), 2);
+ }
+
+ U.sleep(2000);
+
+ assertFalse(fut.isDone());
+
+ if (delayReader)
+ testSpi(client1).stopBlock();
+ else
+ testSpi(srv1).stopBlock();
+
+ fut.get();
+
+ checkData(map);
+ }
+
+ /**
* @param expData Expected cache data.
*/
private void checkData(Map<Integer, Integer> expData) {
[30/39] ignite git commit: IGNITE-5431: Better error message in case
of SQL cache mode mismtach. This closes #2103.
Posted by sb...@apache.org.
IGNITE-5431: Better error message in case of SQL cache mode mismtach. This closes #2103.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/72e2f883
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/72e2f883
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/72e2f883
Branch: refs/heads/ignite-5272
Commit: 72e2f883e1a9a1e1fa2d5c275be143163e1c16ee
Parents: 39c5b5d
Author: Alexander Paschenko <al...@gmail.com>
Authored: Fri Jun 9 16:19:37 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jun 9 16:19:37 2017 +0300
----------------------------------------------------------------------
.../processors/cache/ClusterCachesInfo.java | 30 +++++++++++++-------
.../processors/cache/GridCacheAttributes.java | 17 ++---------
.../cache/index/H2DynamicTableSelfTest.java | 3 +-
3 files changed, 23 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/72e2f883/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index 0fcc740..d5718f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -145,22 +145,33 @@ class ClusterCachesInfo {
if (gridData != null && gridData.conflictErr != null)
throw new IgniteCheckedException(gridData.conflictErr);
- if (checkConsistency && joinDiscoData != null && gridData != null) {
+ if (joinDiscoData != null && gridData != null) {
for (CacheJoinNodeDiscoveryData.CacheInfo locCacheInfo : joinDiscoData.caches().values()) {
CacheConfiguration locCfg = locCacheInfo.config();
CacheData cacheData = gridData.gridData.caches().get(locCfg.getName());
- if (cacheData != null)
- checkCache(locCacheInfo, cacheData, cacheData.receivedFrom());
+ if (cacheData != null) {
+ if (!F.eq(cacheData.sql(), locCacheInfo.sql())) {
+ throw new IgniteCheckedException("Cache configuration mismatch (local cache was created " +
+ "via " + (locCacheInfo.sql() ? "CREATE TABLE" : "Ignite API") + ", while remote cache " +
+ "was created via " + (cacheData.sql() ? "CREATE TABLE" : "Ignite API") + "): " +
+ locCacheInfo.config().getName());
+ }
+
+ if (checkConsistency)
+ checkCache(locCacheInfo, cacheData, cacheData.receivedFrom());
+ }
- validateStartCacheConfiguration(locCfg);
+ if (checkConsistency)
+ validateStartCacheConfiguration(locCfg);
}
}
joinDiscoData = null;
gridData = null;
}
+
/**
* Checks that remote caches has configuration compatible with the local.
*
@@ -172,8 +183,8 @@ class ClusterCachesInfo {
@SuppressWarnings("unchecked")
private void checkCache(CacheJoinNodeDiscoveryData.CacheInfo locInfo, CacheData rmtData, UUID rmt)
throws IgniteCheckedException {
- GridCacheAttributes rmtAttr = new GridCacheAttributes(rmtData.cacheConfiguration(), rmtData.sql());
- GridCacheAttributes locAttr = new GridCacheAttributes(locInfo.config(), locInfo.sql());
+ GridCacheAttributes rmtAttr = new GridCacheAttributes(rmtData.cacheConfiguration());
+ GridCacheAttributes locAttr = new GridCacheAttributes(locInfo.config());
CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "cacheMode", "Cache mode",
locAttr.cacheMode(), rmtAttr.cacheMode(), true);
@@ -181,9 +192,6 @@ class ClusterCachesInfo {
CU.checkAttributeMismatch(log, rmtAttr.groupName(), rmt, "groupName", "Cache group name",
locAttr.groupName(), rmtAttr.groupName(), true);
- CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "sql", "SQL flag",
- locAttr.sql(), rmtAttr.sql(), true);
-
if (rmtAttr.cacheMode() != LOCAL) {
CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "interceptor", "Cache Interceptor",
locAttr.interceptorClassName(), rmtAttr.interceptorClassName(), true);
@@ -1219,8 +1227,8 @@ class ClusterCachesInfo {
*/
private void validateCacheGroupConfiguration(CacheConfiguration cfg, CacheConfiguration startCfg)
throws IgniteCheckedException {
- GridCacheAttributes attr1 = new GridCacheAttributes(cfg, false);
- GridCacheAttributes attr2 = new GridCacheAttributes(startCfg, false);
+ GridCacheAttributes attr1 = new GridCacheAttributes(cfg);
+ GridCacheAttributes attr2 = new GridCacheAttributes(startCfg);
CU.validateCacheGroupsAttributesMismatch(log, cfg, startCfg, "cacheMode", "Cache mode",
cfg.getCacheMode(), startCfg.getCacheMode(), true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/72e2f883/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
index 7d97159..dca4286 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.cache;
-import java.io.Externalizable;
import java.io.Serializable;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
@@ -47,17 +46,12 @@ public class GridCacheAttributes implements Serializable {
/** Cache configuration. */
private CacheConfiguration ccfg;
- /** SQL flag - whether the cache is created by an SQL command such as {@code CREATE TABLE}. */
- private boolean sql;
-
/**
* @param cfg Cache configuration.
- * @param sql SQL flag.
+ *
*/
- public GridCacheAttributes(CacheConfiguration cfg, boolean sql) {
+ public GridCacheAttributes(CacheConfiguration cfg) {
ccfg = cfg;
-
- this.sql = sql;
}
/**
@@ -293,13 +287,6 @@ public class GridCacheAttributes implements Serializable {
}
/**
- * @return SQL flag.
- */
- public boolean sql() {
- return sql;
- }
-
- /**
* @param obj Object to get class of.
* @return Class name or {@code null}.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/72e2f883/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index 2255fb8..ca1c937 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -399,7 +399,8 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
return null;
}
- }, IgniteException.class, "SQL flag mismatch (fix sql flag in cache configuration");
+ }, IgniteException.class, "Cache configuration mismatch (local cache was created via Ignite API, while " +
+ "remote cache was created via CREATE TABLE): SQL_PUBLIC_Person");
}
/**
[29/39] ignite git commit: IGNITE-5459: Deprecated
IgniteConfiguration.marshaller property.
Posted by sb...@apache.org.
IGNITE-5459: Deprecated IgniteConfiguration.marshaller property.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/39c5b5db
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/39c5b5db
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/39c5b5db
Branch: refs/heads/ignite-5272
Commit: 39c5b5db250a48437baf4bcb8df0dc1c029cbed8
Parents: 03ec107
Author: devozerov <vo...@gridgain.com>
Authored: Fri Jun 9 16:13:09 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jun 9 16:13:09 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/configuration/IgniteConfiguration.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/39c5b5db/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 8e531e2..76073c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -1179,7 +1179,10 @@ public class IgniteConfiguration {
* without deserialization will be used.
*
* @return Marshaller to use in grid.
+ * @deprecated Since 2.1. Some Ignite features will not work if non-null marshaller is set
+ * (IgniteCache.withKeepBinary(), .NET, CPP, ODBC)
*/
+ @Deprecated
public Marshaller getMarshaller() {
return marsh;
}
@@ -1190,7 +1193,10 @@ public class IgniteConfiguration {
* @param marsh Marshaller to use within grid.
* @see IgniteConfiguration#getMarshaller()
* @return {@code this} for chaining.
+ * @deprecated Since 2.1. Some Ignite features will not work if non-null marshaller is set
+ * (IgniteCache.withKeepBinary(), .NET, CPP, ODBC)
*/
+ @Deprecated
public IgniteConfiguration setMarshaller(Marshaller marsh) {
this.marsh = marsh;
[26/39] ignite git commit: Fixed headers.
Posted by sb...@apache.org.
Fixed headers.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c63988ab
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c63988ab
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c63988ab
Branch: refs/heads/ignite-5272
Commit: c63988ab276cbedfac1dc5943987c94d25870f9d
Parents: 0fb6d2f
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Jun 9 15:05:47 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 9 15:05:47 2017 +0700
----------------------------------------------------------------------
.../ml/math/impls/matrix/SparseDistributedMatrix.java | 9 ---------
.../ml/math/impls/matrix/SparseDistributedMatrixTest.java | 9 ---------
2 files changed, 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c63988ab/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
index cebacc5..50c7da8 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrix.java
@@ -1,12 +1,3 @@
-// @java.file.header
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
- */
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
http://git-wip-us.apache.org/repos/asf/ignite/blob/c63988ab/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
index 5ee2e7d..54975f0 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/SparseDistributedMatrixTest.java
@@ -1,12 +1,3 @@
-// @java.file.header
-
-/* _________ _____ __________________ _____
- * __ ____/___________(_)______ /__ ____/______ ____(_)_______
- * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \
- * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / /
- * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/
- */
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
[36/39] ignite git commit: IGNITE-5414 Fixed cluster topology
serialization.
Posted by sb...@apache.org.
IGNITE-5414 Fixed cluster topology serialization.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0879ca88
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0879ca88
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0879ca88
Branch: refs/heads/ignite-5272
Commit: 0879ca88553ac1299fe21bd1e60cf64e3edf4096
Parents: ca6cd14
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Mon Jun 12 15:53:18 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Mon Jun 12 15:53:18 2017 +0700
----------------------------------------------------------------------
.../console/agent/handlers/ClusterListener.java | 28 ++++++++++++++++----
1 file changed, 23 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0879ca88/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
index 0da4469..cde4701 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/ClusterListener.java
@@ -190,12 +190,12 @@ public class ClusterListener {
}
/** */
- private class TopologySnapshot {
+ private static class TopologySnapshot {
/** */
private Collection<UUID> nids;
/** */
- private String clusterVersion;
+ private String clusterVer;
/**
* @param nodes Nodes.
@@ -210,7 +210,21 @@ public class ClusterListener {
}
});
- clusterVersion = Collections.min(vers).toString();
+ clusterVer = Collections.min(vers).toString();
+ }
+
+ /**
+ * @return Cluster version.
+ */
+ public String getClusterVersion() {
+ return clusterVer;
+ }
+
+ /**
+ * @return Cluster nodes IDs.
+ */
+ public Collection<UUID> getNids() {
+ return nids;
}
/** */
@@ -256,7 +270,9 @@ public class ClusterListener {
clusterDisconnect();
}
}
- catch (IOException ignore) {
+ catch (Exception e) {
+ log.error("WatchTask failed", e);
+
clusterDisconnect();
}
}
@@ -296,7 +312,9 @@ public class ClusterListener {
clusterDisconnect();
}
}
- catch (IOException ignore) {
+ catch (Exception e) {
+ log.error("BroadcastTask failed", e);
+
clusterDisconnect();
watch();
[24/39] ignite git commit: IgniteCacheGroupsTest: reduced test time.
Posted by sb...@apache.org.
IgniteCacheGroupsTest: reduced test time.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4479f213
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4479f213
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4479f213
Branch: refs/heads/ignite-5272
Commit: 4479f2135116d5f8a587af58a20feb5eb2c93e5e
Parents: 8de8fe5
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jun 9 10:56:08 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jun 9 10:56:08 2017 +0300
----------------------------------------------------------------------
.../processors/cache/IgniteCacheGroupsTest.java | 98 ++++++++++++--------
1 file changed, 58 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4479f213/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
index 78d4e0a..a8b0c8b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
@@ -115,7 +115,7 @@ import static org.apache.ignite.transactions.TransactionIsolation.SERIALIZABLE;
/**
*
*/
-@SuppressWarnings("unchecked")
+@SuppressWarnings({"unchecked", "ThrowableNotThrown"})
public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
/** */
private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
@@ -708,9 +708,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
Affinity<Integer> aff = affinity(cache1);
for(int i = 0; i < keys; i++) {
- if (aff.partition(i) == p) {
+ if (aff.partition(i) == p)
keysSet.add(i);
- }
}
for (Cache.Entry<Integer, Integer> entry : cache1.query(qry)) {
@@ -729,9 +728,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
aff = affinity(cache2);
for(int i = 0; i < keys; i++) {
- if (aff.partition(i) == p) {
+ if (aff.partition(i) == p)
keysSet.add(i);
- }
}
for (Cache.Entry<Integer, Integer> entry : cache2.query(qry)) {
@@ -753,9 +751,9 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
Integer[] data1 = generateData(keys);
Integer[] data2 = generateData(keys);
- boolean local = cacheMode == LOCAL;
+ boolean loc = cacheMode == LOCAL;
- if (local)
+ if (loc)
startGrid(0);
else
startGridsMultiThreaded(4);
@@ -765,11 +763,11 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
srv0.createCache(cacheConfiguration(GROUP1, CACHE1, cacheMode, atomicityMode, 2, false));
srv0.createCache(cacheConfiguration(GROUP1, CACHE2, cacheMode, atomicityMode, 2, false));
- if(!local)
+ if(!loc)
awaitPartitionMapExchange();
if (atomicityMode == TRANSACTIONAL) {
- Ignite ignite = ignite(local ? 0 : 1);
+ Ignite ignite = ignite(loc ? 0 : 1);
IgniteCache cache1 = ignite.cache(CACHE1);
IgniteCache cache2 = ignite.cache(CACHE2);
@@ -790,8 +788,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
List<Callable<?>> cls = new ArrayList<>(ldrs * 2);
for (int i = 0; i < ldrs ; i++) {
- cls.add(putOperation(local ? 0 : 1, ldrs, i, CACHE1, data1));
- cls.add(putOperation(local ? 0 : 2, ldrs, i, CACHE2, data2));
+ cls.add(putOperation(loc ? 0 : 1, ldrs, i, CACHE1, data1));
+ cls.add(putOperation(loc ? 0 : 2, ldrs, i, CACHE2, data2));
}
GridTestUtils.runMultiThreaded(cls, "loaders");
@@ -800,7 +798,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
Set<Integer> keysSet = sequence(keys);
- for (Cache.Entry<Integer, Integer> entry : ignite(local ? 0 : 3).<Integer, Integer>cache(CACHE1)) {
+ for (Cache.Entry<Integer, Integer> entry : ignite(loc ? 0 : 3).<Integer, Integer>cache(CACHE1)) {
assertTrue(keysSet.remove(entry.getKey()));
assertEquals(data1[entry.getKey()], entry.getValue());
}
@@ -811,7 +809,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
keysSet = sequence(keys);
- for (Cache.Entry<Integer, Integer> entry : ignite(local ? 0 : 3).<Integer, Integer>cache(CACHE2)) {
+ for (Cache.Entry<Integer, Integer> entry : ignite(loc ? 0 : 3).<Integer, Integer>cache(CACHE2)) {
assertTrue(keysSet.remove(entry.getKey()));
assertEquals(data2[entry.getKey()], entry.getValue());
}
@@ -820,6 +818,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
}
/**
+ * @param cacheMode Cache mode.
+ * @param atomicityMode Cache atomicity mode.
* @throws Exception If failed.
*/
private void entriesTtl(CacheMode cacheMode, CacheAtomicityMode atomicityMode) throws Exception {
@@ -830,9 +830,9 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
Integer[] data1 = generateData(keys);
Integer[] data2 = generateData(keys);
- boolean local = cacheMode == LOCAL;
+ boolean loc = cacheMode == LOCAL;
- if (local)
+ if (loc)
startGrid(0);
else
startGridsMultiThreaded(4);
@@ -849,11 +849,11 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
srv0.createCache(cacheConfiguration(GROUP1, CACHE2, cacheMode, atomicityMode, 2, false));
- if (!local)
+ if (!loc)
awaitPartitionMapExchange();
if (atomicityMode == TRANSACTIONAL) {
- Ignite ignite = ignite(local ? 0 : 1);
+ Ignite ignite = ignite(loc ? 0 : 1);
IgniteCache cache1 = ignite.cache(CACHE1);
IgniteCache cache2 = ignite.cache(CACHE2);
@@ -874,25 +874,25 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
List<Callable<?>> cls = new ArrayList<>(ldrs * 2);
for (int i = 0; i < ldrs ; i++) {
- cls.add(putOperation(local ? 0 : 1, ldrs, i, CACHE1, data1));
- cls.add(putOperation(local ? 0 : 2, ldrs, i, CACHE2, data2));
+ cls.add(putOperation(loc ? 0 : 1, ldrs, i, CACHE1, data1));
+ cls.add(putOperation(loc ? 0 : 2, ldrs, i, CACHE2, data2));
}
GridTestUtils.runMultiThreaded(cls, "loaders");
}
- checkData(local ? 0 : 3, CACHE1, data1);
- checkData(local ? 0 : 3, CACHE2, data2);
+ checkData(loc ? 0 : 3, CACHE1, data1);
+ checkData(loc ? 0 : 3, CACHE2, data2);
srv0.destroyCache(CACHE2);
- checkData(local ? 0 : 3, CACHE1, data1);
+ checkData(loc ? 0 : 3, CACHE1, data1);
// Wait for expiration
Thread.sleep((long)(ttl * 1.2));
- assertEquals(0, ignite(local ? 0 : 3).cache(CACHE1).size());
+ assertEquals(0, ignite(loc ? 0 : 3).cache(CACHE1).size());
}
/**
@@ -1082,21 +1082,21 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
Affinity aff = affinity(cache);
- Set<Integer> localKeys = new TreeSet<>();
+ Set<Integer> locKeys = new TreeSet<>();
for (int key = 0; key < data.length; key++) {
if(aff.isPrimaryOrBackup(node, key))
- localKeys.add(key);
+ locKeys.add(key);
}
- Iterable<Cache.Entry<Integer, Integer>> localEntries = cache.localEntries(CachePeekMode.OFFHEAP);
+ Iterable<Cache.Entry<Integer, Integer>> locEntries = cache.localEntries(CachePeekMode.OFFHEAP);
- for (Cache.Entry<Integer, Integer> entry : localEntries) {
- assertTrue(localKeys.remove(entry.getKey()));
+ for (Cache.Entry<Integer, Integer> entry : locEntries) {
+ assertTrue(locKeys.remove(entry.getKey()));
assertEquals(data[entry.getKey()], entry.getValue());
}
- assertTrue(localKeys.isEmpty());
+ assertTrue(locKeys.isEmpty());
}
/**
@@ -1307,12 +1307,13 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
checkCacheDiscoveryDataConsistent();
for (int i = 0; i < NODES; i++) {
- for (int c = 0; c < CACHES; c++) {
- if (c % 100 == 0)
- log.info("Check node: " + i);
+ log.info("Check node: " + i);
- checkCache(i, "testCache1-" + c, 1);
- checkCache(i, "testCache2-" + c, 1);
+ for (int c = 0; c < 10; c++) {
+ int cache = ThreadLocalRandom.current().nextInt(CACHES);
+
+ checkCache(i, "testCache1-" + cache, 1);
+ checkCache(i, "testCache2-" + cache, 1);
}
}
@@ -2633,27 +2634,44 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
tearDown(cache);
}
-
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheAtomicPartitioned() throws Exception {
loadCache(PARTITIONED, ATOMIC);
}
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheAtomicReplicated() throws Exception {
loadCache(REPLICATED, ATOMIC);
}
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheTxPartitioned() throws Exception {
loadCache(PARTITIONED, TRANSACTIONAL);
}
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheTxReplicated() throws Exception {
loadCache(REPLICATED, TRANSACTIONAL);
}
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheAtomicLocal() throws Exception {
loadCache(LOCAL, ATOMIC);
}
+ /**
+ * @throws Exception If failed.
+ */
public void testLoadCacheTxLocal() throws Exception {
loadCache(LOCAL, TRANSACTIONAL);
}
@@ -2666,7 +2684,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
private void loadCache(CacheMode cacheMode, CacheAtomicityMode atomicityMode) throws Exception {
int keys = 100;
- boolean local = cacheMode == LOCAL;
+ boolean loc = cacheMode == LOCAL;
Map<Integer, Integer> data1 = generateDataMap(keys);
Map<Integer, Integer> data2 = generateDataMap(keys);
@@ -2684,7 +2702,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
CacheConfiguration ccfg2 = cacheConfiguration(GROUP1, CACHE2, cacheMode, atomicityMode, 1, false)
.setCacheStoreFactory(fctr2);
- Ignite node = startGrids(local ? 1 : 4);
+ Ignite node = startGrids(loc ? 1 : 4);
node.createCaches(F.asList(ccfg1, ccfg2));
@@ -4247,7 +4265,8 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
*
*/
static class MapBasedStore<K,V> implements CacheStore<K,V>, Serializable {
- private final Map<K,V> src;
+ /** */
+ private final Map<K, V> src;
/**
* @param src Source map.
@@ -4283,8 +4302,7 @@ public class IgniteCacheGroupsTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override
- public void writeAll(Collection<Cache.Entry<? extends K, ? extends V>> entries) throws CacheWriterException {
+ @Override public void writeAll(Collection<Cache.Entry<? extends K, ? extends V>> entries) {
throw new UnsupportedOperationException();
}
[15/39] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/612f5ad5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/612f5ad5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/612f5ad5
Branch: refs/heads/ignite-5272
Commit: 612f5ad5ea6deaf7addd39ebfc6956adcfb9a545
Parents: c73aad7 d5ecf0a
Author: devozerov <vo...@gridgain.com>
Authored: Thu Jun 8 13:58:53 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jun 8 13:58:53 2017 +0300
----------------------------------------------------------------------
.../utils/PlatformConfigurationUtils.java | 6 ++++++
.../Cache/CacheConfigurationTest.cs | 8 ++++++++
.../IgniteConfigurationSerializerTest.cs | 5 +++--
.../IgniteConfigurationTest.cs | 4 ++++
.../Cache/Configuration/CacheConfiguration.cs | 9 +++++++++
.../Apache.Ignite.Core/IgniteConfiguration.cs | 20 ++++++++++++++++++++
.../IgniteConfigurationSection.xsd | 7 +++++++
7 files changed, 57 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[07/39] ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/ignite
Posted by sb...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d2efe78e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d2efe78e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d2efe78e
Branch: refs/heads/ignite-5272
Commit: d2efe78e1bc59b79a1e544b64bbcd44a0203ce27
Parents: 8371e3a 3a2797e
Author: Sergi Vladykin <se...@gmail.com>
Authored: Wed Jun 7 18:21:19 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Wed Jun 7 18:21:19 2017 +0300
----------------------------------------------------------------------
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 2 +
.../thin/JdbcThinAutoCloseServerCursorTest.java | 359 +++++++++++++++++++
.../jdbc/thin/JdbcThinConnectionSelfTest.java | 36 ++
.../internal/binary/BinaryClassDescriptor.java | 1 -
.../internal/jdbc/thin/JdbcThinConnection.java | 4 +-
.../internal/jdbc/thin/JdbcThinResultSet.java | 18 +-
.../internal/jdbc/thin/JdbcThinStatement.java | 2 +-
.../internal/jdbc/thin/JdbcThinTcpIo.java | 17 +-
.../internal/jdbc/thin/JdbcThinUtils.java | 7 +-
.../query/jdbc/GridCacheQueryJdbcTask.java | 6 +-
.../processors/odbc/SqlListenerNioListener.java | 3 +-
.../processors/odbc/jdbc/JdbcQueryCursor.java | 9 +-
.../odbc/jdbc/JdbcRequestHandler.java | 21 +-
.../processors/query/GridQueryProcessor.java | 2 +-
.../internal/processors/query/QueryUtils.java | 32 ++
.../query/h2/ddl/DdlStatementsProcessor.java | 23 +-
.../cache/index/H2DynamicTableSelfTest.java | 37 +-
17 files changed, 531 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
[25/39] ignite git commit: IGNITE-5303 Added support for multiple
RDBMS.
Posted by sb...@apache.org.
IGNITE-5303 Added support for multiple RDBMS.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0fb6d2f8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0fb6d2f8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0fb6d2f8
Branch: refs/heads/ignite-5272
Commit: 0fb6d2f8d2ac2d26be48dc5513fb6702ae680918
Parents: 4479f21
Author: vsisko <vs...@gridgain.com>
Authored: Fri Jun 9 15:05:34 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 9 15:05:34 2017 +0700
----------------------------------------------------------------------
.../frontend/controllers/domains-controller.js | 123 ++++++++++---------
.../ignite/console/agent/db/DbSchema.java | 60 +++++++++
.../agent/handlers/DatabaseListener.java | 18 ++-
3 files changed, 140 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0fb6d2f8/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index b8fae5d..4d59264 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -433,6 +433,62 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
};
}
+ function isValidJavaIdentifier(s) {
+ return JavaTypes.validIdentifier(s) && !JavaTypes.isKeyword(s) && JavaTypes.nonBuiltInClass(s) &&
+ SqlTypes.validIdentifier(s) && !SqlTypes.isKeyword(s);
+ }
+
+ function toJavaIdentifier(name) {
+ if (_.isEmpty(name))
+ return 'DB';
+
+ const len = name.length;
+
+ let ident = '';
+
+ let capitalizeNext = true;
+
+ for (let i = 0; i < len; i++) {
+ const ch = name.charAt(i);
+
+ if (ch === ' ' || ch === '_')
+ capitalizeNext = true;
+ else if (ch === '-') {
+ ident += '_';
+ capitalizeNext = true;
+ }
+ else if (capitalizeNext) {
+ ident += ch.toLocaleUpperCase();
+
+ capitalizeNext = false;
+ }
+ else
+ ident += ch.toLocaleLowerCase();
+ }
+
+ return ident;
+ }
+
+ function toJavaClassName(name) {
+ const clazzName = toJavaIdentifier(name);
+
+ if (isValidJavaIdentifier(clazzName))
+ return clazzName;
+
+ return 'Class' + clazzName;
+ }
+
+ function toJavaFieldName(dbName) {
+ const javaName = toJavaIdentifier(dbName);
+
+ const fieldName = javaName.charAt(0).toLocaleLowerCase() + javaName.slice(1);
+
+ if (isValidJavaIdentifier(fieldName))
+ return fieldName;
+
+ return 'field' + javaName;
+ }
+
/**
* Show import domain models modal.
*/
@@ -544,17 +600,14 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
return agentMgr.schemas(preset);
})
- .then(function(schemas) {
- $scope.importDomain.schemas = _.map(schemas, function(schema) {
- return {use: true, name: schema};
- });
-
+ .then((schemaInfo) => {
$scope.importDomain.action = 'schemas';
+ $scope.importDomain.info = INFO_SELECT_SCHEMAS;
+ $scope.importDomain.catalog = toJavaIdentifier(schemaInfo.catalog);
+ $scope.importDomain.schemas = _.map(schemaInfo.schemas, (schema) => ({use: true, name: schema}));
if ($scope.importDomain.schemas.length === 0)
$scope.importDomainNext();
-
- $scope.importDomain.info = INFO_SELECT_SCHEMAS;
})
.catch(Messages.showError)
.then(() => Loading.finish('importDomainFromDb'));
@@ -595,55 +648,6 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
return 'Associate with ' + cacheName;
};
- function isValidJavaIdentifier(s) {
- return JavaTypes.validIdentifier(s) && !JavaTypes.isKeyword(s) && JavaTypes.nonBuiltInClass(s) &&
- SqlTypes.validIdentifier(s) && !SqlTypes.isKeyword(s);
- }
-
- function toJavaIdentifier(name) {
- const len = name.length;
-
- let ident = '';
-
- let capitalizeNext = true;
-
- for (let i = 0; i < len; i++) {
- const ch = name.charAt(i);
-
- if (ch === ' ' || ch === '_')
- capitalizeNext = true;
- else if (capitalizeNext) {
- ident += ch.toLocaleUpperCase();
-
- capitalizeNext = false;
- }
- else
- ident += ch.toLocaleLowerCase();
- }
-
- return ident;
- }
-
- function toJavaClassName(name) {
- const clazzName = toJavaIdentifier(name);
-
- if (isValidJavaIdentifier(clazzName))
- return clazzName;
-
- return 'Class' + clazzName;
- }
-
- function toJavaFieldName(dbName) {
- const javaName = toJavaIdentifier(dbName);
-
- const fieldName = javaName.charAt(0).toLocaleLowerCase() + javaName.slice(1);
-
- if (isValidJavaIdentifier(fieldName))
- return fieldName;
-
- return 'field' + javaName;
- }
-
function _fillCommonCachesOrTemplates(item) {
return function(action) {
if (item.cachesOrTemplates)
@@ -968,9 +972,14 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
if (!newCache.cacheStoreFactory || newCache.cacheStoreFactory.kind !== 'CacheJdbcPojoStoreFactory') {
const dialect = $scope.importDomain.demo ? 'H2' : $scope.selectedPreset.db;
+ const catalog = $scope.importDomain.catalog;
+
newCache.cacheStoreFactory = {
kind: 'CacheJdbcPojoStoreFactory',
- CacheJdbcPojoStoreFactory: {dataSourceBean: 'ds' + dialect, dialect},
+ CacheJdbcPojoStoreFactory: {
+ dataSourceBean: 'ds' + dialect + '_' + catalog,
+ dialect
+ },
CacheJdbcBlobStoreFactory: { connectVia: 'DataSource' }
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0fb6d2f8/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbSchema.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbSchema.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbSchema.java
new file mode 100644
index 0000000..1c89ceb
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbSchema.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.console.agent.db;
+
+import java.util.Collection;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Database schema names with catalog name.
+ */
+public class DbSchema {
+ /** Catalog name. */
+ private final String catalog;
+
+ /** Schema names. */
+ private final Collection<String> schemas;
+
+ /**
+ * @param catalog Catalog name.
+ * @param schemas Schema names.
+ */
+ public DbSchema(String catalog, Collection<String> schemas) {
+ this.catalog = catalog;
+ this.schemas = schemas;
+ }
+
+ /**
+ * @return Catalog name.
+ */
+ public String getCatalog() {
+ return catalog;
+ }
+
+ /**
+ * @return Schema names.
+ */
+ public Collection<String> getSchemas() {
+ return schemas;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DbSchema.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0fb6d2f8/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
index d1394c9..9da118d 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
@@ -33,9 +33,10 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.ignite.console.agent.AgentConfiguration;
-import org.apache.ignite.console.demo.AgentMetadataDemo;
import org.apache.ignite.console.agent.db.DbMetadataReader;
+import org.apache.ignite.console.agent.db.DbSchema;
import org.apache.ignite.console.agent.db.DbTable;
+import org.apache.ignite.console.demo.AgentMetadataDemo;
import org.apache.log4j.Logger;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -211,19 +212,28 @@ public class DatabaseListener {
* @return Collection of schema names.
* @throws SQLException If failed to collect schemas.
*/
- protected Collection<String> schemas(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
+ protected DbSchema schemas(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
Properties jdbcInfo) throws SQLException {
if (log.isDebugEnabled())
log.debug("Start collecting database schemas [drvJar=" + jdbcDriverJarPath +
", drvCls=" + jdbcDriverCls + ", jdbcUrl=" + jdbcUrl + "]");
try (Connection conn = connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo)) {
+ String catalog = conn.getCatalog();
+
+ if (catalog == null) {
+ String[] parts = jdbcUrl.split("[/:=]");
+
+ catalog = parts.length > 0 ? parts[parts.length - 1] : "NONE";
+ }
+
Collection<String> schemas = dbMetaReader.schemas(conn);
if (log.isDebugEnabled())
- log.debug("Finished collection of schemas [jdbcUrl=" + jdbcUrl + ", count=" + schemas.size() + "]");
+ log.debug("Finished collection of schemas [jdbcUrl=" + jdbcUrl + ", catalog=" + catalog +
+ ", count=" + schemas.size() + "]");
- return schemas;
+ return new DbSchema(catalog, schemas);
}
catch (Throwable e) {
log.error("Failed to collect schemas", e);
[11/39] ignite git commit: IGNITE-5436 .NET:
CacheConfiguration.GroupName
Posted by sb...@apache.org.
IGNITE-5436 .NET: CacheConfiguration.GroupName
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5c77dab5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5c77dab5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5c77dab5
Branch: refs/heads/ignite-5272
Commit: 5c77dab546f1eded908fd74a51eaef59054e038c
Parents: bd5065b
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Jun 8 12:33:13 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Jun 8 12:33:13 2017 +0300
----------------------------------------------------------------------
.../platform/utils/PlatformConfigurationUtils.java | 2 ++
.../Cache/CacheConfigurationTest.cs | 2 ++
.../IgniteConfigurationSerializerTest.cs | 6 ++++--
.../Cache/Configuration/CacheConfiguration.cs | 14 ++++++++++++++
.../Apache.Ignite.Core/IgniteConfigurationSection.xsd | 5 +++++
5 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 40dafbd..176d77b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -178,6 +178,7 @@ public class PlatformConfigurationUtils {
ccfg.setMemoryPolicyName(memoryPolicyName);
ccfg.setPartitionLossPolicy(PartitionLossPolicy.fromOrdinal((byte)in.readInt()));
+ ccfg.setGroupName(in.readString());
Object storeFactory = in.readObjectDetached();
@@ -829,6 +830,7 @@ public class PlatformConfigurationUtils {
writer.writeBoolean(ccfg.isStatisticsEnabled());
writer.writeString(ccfg.getMemoryPolicyName());
writer.writeInt(ccfg.getPartitionLossPolicy().ordinal());
+ writer.writeString(ccfg.getGroupName());
if (ccfg.getCacheStoreFactory() instanceof PlatformDotNetCacheStoreFactoryNative)
writer.writeObject(((PlatformDotNetCacheStoreFactoryNative)ccfg.getCacheStoreFactory()).getNativeFactory());
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
index 7935cc3..b674b0e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -247,6 +247,7 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(x.EnableStatistics, y.EnableStatistics);
Assert.AreEqual(x.MemoryPolicyName, y.MemoryPolicyName);
Assert.AreEqual(x.PartitionLossPolicy, y.PartitionLossPolicy);
+ Assert.AreEqual(x.GroupName, y.GroupName);
if (x.ExpiryPolicyFactory != null)
Assert.AreEqual(x.ExpiryPolicyFactory.CreateInstance().GetType(),
@@ -512,6 +513,7 @@ namespace Apache.Ignite.Core.Tests.Cache
ReadThrough = true,
WriteThrough = true,
WriteBehindCoalescing = false,
+ GroupName = "someGroup",
QueryEntities = new[]
{
new QueryEntity
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 7ba4ed2..3229de9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -92,7 +92,7 @@ namespace Apache.Ignite.Core.Tests
<iLifecycleHandler type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+LifecycleBean' foo='15' />
</lifecycleHandlers>
<cacheConfiguration>
- <cacheConfiguration cacheMode='Replicated' readThrough='true' writeThrough='true' enableStatistics='true' writeBehindCoalescing='false' partitionLossPolicy='ReadWriteAll'>
+ <cacheConfiguration cacheMode='Replicated' readThrough='true' writeThrough='true' enableStatistics='true' writeBehindCoalescing='false' partitionLossPolicy='ReadWriteAll' groupName='fooGroup'>
<queryEntities>
<queryEntity keyType='System.Int32' valueType='System.String' tableName='myTable'>
<fields>
@@ -179,6 +179,7 @@ namespace Apache.Ignite.Core.Tests
Assert.IsTrue(cacheCfg.EnableStatistics);
Assert.IsFalse(cacheCfg.WriteBehindCoalescing);
Assert.AreEqual(PartitionLossPolicy.ReadWriteAll, cacheCfg.PartitionLossPolicy);
+ Assert.AreEqual("fooGroup", cacheCfg.GroupName);
var queryEntity = cacheCfg.QueryEntities.Single();
Assert.AreEqual(typeof(int), queryEntity.KeyType);
@@ -725,7 +726,8 @@ namespace Apache.Ignite.Core.Tests
new MyPluginConfiguration()
},
MemoryPolicyName = "somePolicy",
- PartitionLossPolicy = PartitionLossPolicy.ReadOnlyAll
+ PartitionLossPolicy = PartitionLossPolicy.ReadOnlyAll,
+ GroupName = "abc"
}
},
ClientMode = true,
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index 1ee7c97..04198dd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -236,6 +236,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
EnableStatistics = reader.ReadBoolean();
MemoryPolicyName = reader.ReadString();
PartitionLossPolicy = (PartitionLossPolicy) reader.ReadInt();
+ GroupName = reader.ReadString();
CacheStoreFactory = reader.ReadObject<IFactory<ICacheStore>>();
var count = reader.ReadInt();
@@ -293,6 +294,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
writer.WriteBoolean(EnableStatistics);
writer.WriteString(MemoryPolicyName);
writer.WriteInt((int) PartitionLossPolicy);
+ writer.WriteString(GroupName);
writer.WriteObject(CacheStoreFactory);
if (QueryEntities != null)
@@ -643,5 +645,17 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// </summary>
[DefaultValue(DefaultPartitionLossPolicy)]
public PartitionLossPolicy PartitionLossPolicy { get; set; }
+
+ /// <summary>
+ /// Gets or sets the cache group name. Caches with the same group name share single underlying 'physical'
+ /// cache (partition set), but are logically isolated.
+ /// <para />
+ /// Since underlying cache is shared, the following configuration properties should be the same within group:
+ /// <see cref="AffinityFunction"/>, <see cref="CacheMode"/>, <see cref="PartitionLossPolicy"/>,
+ /// <see cref="MemoryPolicyName"/>
+ /// <para />
+ /// Grouping caches reduces overall overhead, since internal data structures are shared.
+ /// </summary>
+ public string GroupName { get;set; }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c77dab5/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 0cd58ed..f0b7f44 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -743,6 +743,11 @@
<xs:documentation>Partition loss policy defines how Ignite will react to a situation when all nodes for some partition leave the cluster.</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="groupName" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Cache group name. Caches with the same group name share single underlying 'physical' cache (partition set), but are logically isolated.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
[05/39] ignite git commit: Removed import
Posted by sb...@apache.org.
Removed import
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3a2797e2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3a2797e2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3a2797e2
Branch: refs/heads/ignite-5272
Commit: 3a2797e2dbae8415de790dcf1331b888da08aad9
Parents: ecba1ac
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jun 7 15:04:09 2017 +0200
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jun 7 15:04:09 2017 +0200
----------------------------------------------------------------------
.../org/apache/ignite/internal/binary/BinaryClassDescriptor.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3a2797e2/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
index adfdcfc..4950a53 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
@@ -49,7 +49,6 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.MarshallerExclusions;
-import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.internal.processors.query.QueryUtils.isGeometryClass;
[38/39] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5272
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-5272
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/75ef7f3a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/75ef7f3a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/75ef7f3a
Branch: refs/heads/ignite-5272
Commit: 75ef7f3a2f729f22c4233ff2bdf151599d1dba25
Parents: 8288f30 b843f07
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 13 10:46:05 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 13 10:46:05 2017 +0300
----------------------------------------------------------------------
config/ignite-log4j.xml | 6 +-
config/ignite-log4j2.xml | 6 +-
.../ClientTcpUnreachableMultiNodeSelfTest.java | 6 +-
modules/clients/src/test/resources/log4j.xml | 2 +-
.../apache/ignite/IgniteSystemProperties.java | 6 +
.../configuration/IgniteConfiguration.java | 6 +
.../org/apache/ignite/internal/GridTopic.java | 6 +-
.../ignite/internal/IgniteDiagnosticAware.java | 28 ++
.../ignite/internal/IgniteDiagnosticInfo.java | 45 ++
.../internal/IgniteDiagnosticMessage.java | 467 +++++++++++++++++++
.../IgniteDiagnosticPrepareContext.java | 279 +++++++++++
.../apache/ignite/internal/IgniteKernal.java | 7 +-
.../ignite/internal/binary/BinaryContext.java | 1 -
.../ignite/internal/binary/BinaryFieldEx.java | 5 +
.../ignite/internal/binary/BinaryFieldImpl.java | 5 +
.../ignite/internal/client/GridClientNode.java | 9 +-
.../client/impl/GridClientNodeImpl.java | 22 +-
.../connection/GridClientNioTcpConnection.java | 3 +-
.../managers/communication/GridIoManager.java | 2 +-
.../communication/GridIoMessageFactory.java | 8 +-
.../processors/GridProcessorAdapter.java | 10 +
.../cache/CacheAffinitySharedManager.java | 3 +-
.../processors/cache/ClusterCachesInfo.java | 30 +-
.../processors/cache/GridCacheAttributes.java | 17 +-
.../processors/cache/GridCacheIoManager.java | 35 ++
.../GridCachePartitionExchangeManager.java | 136 ++++--
.../cache/GridCacheSharedManagerAdapter.java | 9 +
.../GridDistributedTxPrepareRequest.java | 14 +-
.../GridDistributedTxPrepareResponse.java | 2 +-
.../distributed/dht/GridDhtCacheAdapter.java | 1 +
.../distributed/dht/GridDhtCacheEntry.java | 30 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 3 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 5 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 42 +-
.../dht/GridPartitionedSingleGetFuture.java | 37 +-
.../GridDhtAtomicAbstractUpdateFuture.java | 76 ++-
.../GridDhtAtomicAbstractUpdateRequest.java | 22 +-
.../dht/atomic/GridDhtAtomicCache.java | 43 +-
.../atomic/GridDhtAtomicSingleUpdateFuture.java | 6 +-
.../GridDhtAtomicSingleUpdateRequest.java | 14 +
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 4 +-
...idNearAtomicAbstractSingleUpdateRequest.java | 19 +-
.../GridNearAtomicAbstractUpdateFuture.java | 200 ++++++--
.../GridNearAtomicAbstractUpdateRequest.java | 85 +++-
.../atomic/GridNearAtomicFullUpdateRequest.java | 24 +-
...GridNearAtomicSingleUpdateFilterRequest.java | 23 +-
.../GridNearAtomicSingleUpdateFuture.java | 42 +-
...GridNearAtomicSingleUpdateInvokeRequest.java | 23 +-
.../GridNearAtomicSingleUpdateRequest.java | 20 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 46 +-
.../atomic/GridNearAtomicUpdateResponse.java | 24 +-
.../colocated/GridDhtColocatedLockFuture.java | 88 +++-
.../GridDhtPartitionsExchangeFuture.java | 48 +-
.../distributed/near/GridNearGetRequest.java | 1 -
.../distributed/near/GridNearLockFuture.java | 1 +
.../distributed/near/GridNearLockRequest.java | 13 +-
.../near/GridNearTxFinishFuture.java | 11 +-
.../near/GridNearTxPrepareFutureAdapter.java | 5 +-
.../near/GridNearTxPrepareResponse.java | 14 +
.../cache/transactions/IgniteTxEntry.java | 8 +
.../cache/transactions/IgniteTxHandler.java | 2 +
.../IgniteTxImplicitSingleStateImpl.java | 11 -
.../cache/transactions/IgniteTxLocalState.java | 10 -
.../IgniteTxRemoteStateAdapter.java | 7 -
.../cache/transactions/IgniteTxState.java | 6 -
.../cache/transactions/IgniteTxStateImpl.java | 32 --
.../processors/cluster/ClusterProcessor.java | 305 +++++++++++-
.../PlatformDotNetConfigurationClosure.java | 8 +-
.../utils/PlatformConfigurationUtils.java | 8 +
.../query/DynamicTableAffinityKeyMapper.java | 92 ++++
.../processors/query/GridQueryProcessor.java | 59 ++-
.../internal/processors/query/QueryUtils.java | 19 +-
.../rest/client/message/GridClientNodeBean.java | 25 +
.../top/GridTopologyCommandHandler.java | 1 +
.../ignite/internal/util/nio/GridNioServer.java | 212 ++++++---
.../visor/cache/VisorCacheConfiguration.java | 13 +
.../visor/query/VisorQueryIndexField.java | 32 +-
.../communication/tcp/TcpCommunicationSpi.java | 185 +++++---
modules/core/src/test/config/log4j-test.xml | 6 +-
modules/core/src/test/config/log4j2-test.xml | 6 +-
.../src/test/config/log4j2-verbose-test.xml | 4 +-
.../managers/IgniteDiagnosticMessagesTest.java | 255 ++++++++++
.../processors/cache/IgniteCacheGroupsTest.java | 98 ++--
.../IgniteOnePhaseCommitNearReadersTest.java | 270 +++++++++++
.../atomic/IgniteCacheAtomicProtocolTest.java | 128 +++++
.../loadtest/GridSingleExecutionTest.java | 4 +-
.../cache/GridCacheAbstractLoadTest.java | 4 +-
.../platform/PlatformComputeEchoTask.java | 4 +-
.../testframework/junits/GridAbstractTest.java | 4 +-
.../junits/logger/GridTestLog4jLogger.java | 4 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 6 +-
.../testsuites/IgniteCacheTestSuite2.java | 3 +
.../testsuites/IgniteCacheTestSuite3.java | 4 +-
.../query/h2/ddl/DdlStatementsProcessor.java | 5 +-
.../processors/query/h2/opt/GridH2Table.java | 5 +-
.../query/h2/sql/GridSqlCreateTable.java | 37 +-
.../processors/query/h2/sql/GridSqlJoin.java | 7 +
.../query/h2/sql/GridSqlQueryParser.java | 54 +++
.../query/h2/sql/GridSqlQuerySplitter.java | 82 +++-
.../h2/twostep/msg/GridH2IndexRangeRequest.java | 2 +
.../cache/index/H2DynamicTableSelfTest.java | 212 ++++++++-
.../query/IgniteSqlSplitterSelfTest.java | 50 ++
.../apache/ignite/logger/log4j/Log4JLogger.java | 4 +-
.../log4j/GridLog4jCorrectFileNameTest.java | 2 +-
.../ignite/logger/log4j2/Log4J2Logger.java | 2 +-
.../impls/matrix/SparseDistributedMatrix.java | 9 -
.../matrix/SparseDistributedMatrixTest.java | 9 -
.../Binary/BinaryCompactFooterInteropTest.cs | 8 +-
.../Binary/BinaryDynamicRegistrationTest.cs | 7 +-
.../Cache/CacheConfigurationTest.cs | 10 +
.../Cache/Query/CacheDmlQueriesTest.cs | 197 +++++++-
.../Compute/ComputeApiTest.cs | 25 +-
.../Config/Log/dotnet-log4j.xml | 2 +-
.../IgniteConfigurationSerializerTest.cs | 11 +-
.../IgniteConfigurationTest.cs | 4 +
.../Cache/Configuration/CacheConfiguration.cs | 23 +
.../Datastream/IDataStreamer.cs | 8 +-
.../Apache.Ignite.Core/IgniteConfiguration.cs | 20 +
.../IgniteConfigurationSection.xsd | 12 +
.../Impl/Binary/BinaryArrayEqualityComparer.cs | 6 +-
.../Impl/Binary/BinaryObjectHeader.cs | 8 +
.../commands/cache/VisorCacheCommand.scala | 1 +
.../src/main/java/log4j.properties | 2 +-
modules/web-console/backend/.gitignore | 1 +
modules/web-console/backend/app/mongo.js | 1 +
modules/web-console/frontend/.gitignore | 1 +
.../generator/ConfigurationGenerator.js | 8 +-
.../states/configuration/caches/general.pug | 4 +
.../frontend/controllers/domains-controller.js | 169 +++----
.../views/configuration/domains-import.tpl.pug | 4 +-
.../apache/ignite/console/agent/AgentUtils.java | 24 +-
.../ignite/console/agent/db/DbColumn.java | 17 +-
.../ignite/console/agent/db/DbSchema.java | 60 +++
.../apache/ignite/console/agent/db/DbTable.java | 21 +-
.../db/dialect/DatabaseMetadataDialect.java | 27 +-
.../agent/db/dialect/JdbcMetadataDialect.java | 42 +-
.../agent/db/dialect/OracleMetadataDialect.java | 116 ++++-
.../console/agent/handlers/ClusterListener.java | 28 +-
.../agent/handlers/DatabaseListener.java | 18 +-
.../src/main/resources/log4j.properties | 6 +-
.../yardstick/cache/load/model/ModelUtil.java | 1 +
141 files changed, 4391 insertions(+), 961 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
index 5566e94,62618f8..e910386
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
@@@ -150,29 -143,73 +144,82 @@@ public abstract class GridNearAtomicAbs
this.op = op;
this.subjId = subjId;
this.taskNameHash = taskNameHash;
+ this.flags = flags;
this.addDepInfo = addDepInfo;
+ }
+
+ /**
+ * @param nearCache {@code True} if near cache enabled on originating node.
+ * @param topLocked Topology locked flag.
+ * @param retval Return value required flag.
+ * @param affMapping {@code True} if originating node detected that rebalancing finished and
+ * expects that update is mapped using current affinity.
+ * @param needPrimaryRes {@code True} if near node waits for primary response.
+ * @param skipStore Skip write-through to a CacheStore flag.
+ * @param keepBinary Keep binary flag.
+ * @param recovery Recovery mode flag.
+ * @return Flags.
+ */
+ static byte flags(
+ boolean nearCache,
+ boolean topLocked,
+ boolean retval,
+ boolean affMapping,
+ boolean needPrimaryRes,
+ boolean skipStore,
+ boolean keepBinary,
+ boolean recovery) {
+ byte flags = 0;
+
+ if (nearCache)
+ flags |= NEAR_CACHE_FLAG_MASK;
- if (needPrimaryRes)
- needPrimaryResponse(true);
if (topLocked)
- topologyLocked(true);
+ flags |= TOP_LOCKED_FLAG_MASK;
+
if (retval)
- returnValue(true);
+ flags |= RET_VAL_FLAG_MASK;
+
+ if (affMapping)
+ flags |= AFFINITY_MAPPING_FLAG_MASK;
+
+ if (needPrimaryRes)
+ flags |= NEED_PRIMARY_RES_FLAG_MASK;
+
if (skipStore)
- skipStore(true);
+ flags |= SKIP_STORE_FLAG_MASK;
+
if (keepBinary)
- keepBinary(true);
+ flags |= KEEP_BINARY_FLAG_MASK;
+
if (recovery)
- recovery(true);
+ flags |= RECOVERY_FLAG_MASK;
+
+ return flags;
+ }
+
+ /**
+ * @return {@code True} if originating node detected that rebalancing finished and
+ * expects that update is mapped using current affinity.
+ */
+ boolean affinityMapping() {
+ return isFlag(AFFINITY_MAPPING_FLAG_MASK);
+ }
+
+ /**
+ * @return {@code True} if near cache is enabled on node initiated operation.
+ */
+ public boolean nearCache() {
+ return isFlag(NEAR_CACHE_FLAG_MASK);
+ if (nearCache)
+ setFlag(true, NEAR_CACHE_FLAG_MASK);
+ }
+
+ /**
+ * @return {@code True} if near cache is enabled on node initiated operation.
+ */
+ public boolean nearCache() {
+ return isFlag(NEAR_CACHE_FLAG_MASK);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index b299db0,190ed3f..dc39888
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@@ -1008,9 -1004,17 +1004,18 @@@ public class GridNearAtomicUpdateFutur
PrimaryRequestState mapped = pendingMappings.get(nodeId);
if (mapped == null) {
+ byte flags = GridNearAtomicAbstractUpdateRequest.flags(nearEnabled,
+ topLocked,
+ retval,
+ mappingKnown,
+ needPrimaryRes,
+ skipStore,
+ keepBinary,
+ recovery);
+
GridNearAtomicFullUpdateRequest req = new GridNearAtomicFullUpdateRequest(
cctx.cacheId(),
+ nearEnabled,
nodeId,
futId,
topVer,
http://git-wip-us.apache.org/repos/asf/ignite/blob/75ef7f3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
[12/39] ignite git commit: IGNITE-5325: CREATE TABLE: added
"cacheGroup" property. This closes #2099.
Posted by sb...@apache.org.
IGNITE-5325: CREATE TABLE: added "cacheGroup" property. This closes #2099.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/45bb5b3a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/45bb5b3a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/45bb5b3a
Branch: refs/heads/ignite-5272
Commit: 45bb5b3a2faca318ede6dd194bd2fb7fb9898d7c
Parents: 5c77dab
Author: Alexander Paschenko <al...@gmail.com>
Authored: Thu Jun 8 13:00:34 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jun 8 13:00:34 2017 +0300
----------------------------------------------------------------------
.../processors/query/GridQueryProcessor.java | 9 ++++-
.../query/h2/ddl/DdlStatementsProcessor.java | 3 +-
.../query/h2/sql/GridSqlCreateTable.java | 20 +++++++++-
.../query/h2/sql/GridSqlQueryParser.java | 10 +++++
.../cache/index/H2DynamicTableSelfTest.java | 39 +++++++++++++++-----
5 files changed, 65 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/45bb5b3a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 4311b12..dd07584 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1278,6 +1278,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param schemaName Schema name to create table in.
* @param entity Entity to create table from.
* @param templateName Template name.
+ * @param cacheGroup Cache group name.
* @param affinityKey Affinity key column name.
* @param atomicityMode Atomicity mode.
* @param backups Backups.
@@ -1285,8 +1286,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
- public void dynamicTableCreate(String schemaName, QueryEntity entity, String templateName, String affinityKey,
- @Nullable CacheAtomicityMode atomicityMode, int backups, boolean ifNotExists) throws IgniteCheckedException {
+ public void dynamicTableCreate(String schemaName, QueryEntity entity, String templateName, String cacheGroup,
+ String affinityKey, @Nullable CacheAtomicityMode atomicityMode, int backups, boolean ifNotExists)
+ throws IgniteCheckedException {
assert !F.isEmpty(templateName);
assert backups >= 0;
@@ -1307,6 +1309,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
ccfg.setName(QueryUtils.createTableCacheName(schemaName, entity.getTableName()));
+ if (!F.isEmpty(cacheGroup))
+ ccfg.setGroupName(cacheGroup);
+
if (atomicityMode != null)
ccfg.setAtomicityMode(atomicityMode);
http://git-wip-us.apache.org/repos/asf/ignite/blob/45bb5b3a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index d6bcabd..65e402d 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -22,7 +22,6 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.QueryEntity;
import org.apache.ignite.cache.QueryIndex;
@@ -177,7 +176,7 @@ public class DdlStatementsProcessor {
if (err != null)
throw err;
- ctx.query().dynamicTableCreate(cmd.schemaName(), e, cmd.templateName(),
+ ctx.query().dynamicTableCreate(cmd.schemaName(), e, cmd.templateName(), cmd.cacheGroup(),
cmd.affinityKey(), cmd.atomicityMode(), cmd.backups(), cmd.ifNotExists());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/45bb5b3a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
index edced6b..fa76123 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
@@ -17,11 +17,10 @@
package org.apache.ignite.internal.processors.query.h2.sql;
-import org.apache.ignite.cache.CacheAtomicityMode;
-
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
+import org.apache.ignite.cache.CacheAtomicityMode;
/**
* CREATE TABLE statement.
@@ -38,6 +37,9 @@ public class GridSqlCreateTable extends GridSqlStatement {
/** Cache name upon which new cache configuration for this table must be based. */
private String templateName;
+ /** Group to put new cache into. */
+ private String cacheGrp;
+
/** Atomicity mode for new cache. */
private CacheAtomicityMode atomicityMode;
@@ -74,6 +76,20 @@ public class GridSqlCreateTable extends GridSqlStatement {
}
/**
+ * @return Group to put new cache into.
+ */
+ public String cacheGroup() {
+ return cacheGrp;
+ }
+
+ /**
+ * @param cacheGrp Group to put new cache into.
+ */
+ public void cacheGroup(String cacheGrp) {
+ this.cacheGrp = cacheGrp;
+ }
+
+ /**
* @return Atomicity mode for new cache.
*/
public CacheAtomicityMode atomicityMode() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/45bb5b3a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index d8baed3..0d6a0b2 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -405,6 +405,9 @@ public class GridSqlQueryParser {
private static final String PARAM_ATOMICITY = "ATOMICITY";
/** */
+ private static final String PARAM_CACHE_GROUP = "CACHEGROUP";
+
+ /** */
private static final String PARAM_AFFINITY_KEY = "AFFINITYKEY";
/** */
@@ -1051,6 +1054,13 @@ public class GridSqlQueryParser {
break;
+ case PARAM_CACHE_GROUP:
+ ensureNotEmpty(name, val);
+
+ res.cacheGroup(val);
+
+ break;
+
case PARAM_AFFINITY_KEY:
ensureNotEmpty(name, val);
http://git-wip-us.apache.org/repos/asf/ignite/blob/45bb5b3a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index e4babba..2255fb8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -105,7 +105,15 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTable() throws Exception {
- doTestCreateTable(CACHE_NAME, null);
+ doTestCreateTable(CACHE_NAME, null, null);
+ }
+
+ /**
+ * Test that {@code CREATE TABLE} actually creates new cache, H2 table and type descriptor on all nodes.
+ * @throws Exception if failed.
+ */
+ public void testCreateTableWithCacheGroup() throws Exception {
+ doTestCreateTable(CACHE_NAME, "MyGroup", null);
}
/**
@@ -114,7 +122,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTableReplicated() throws Exception {
- doTestCreateTable("REPLICATED", CacheMode.REPLICATED);
+ doTestCreateTable("REPLICATED", null, CacheMode.REPLICATED);
}
/**
@@ -123,7 +131,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTablePartitioned() throws Exception {
- doTestCreateTable("PARTITIONED", CacheMode.PARTITIONED);
+ doTestCreateTable("PARTITIONED", null, CacheMode.PARTITIONED);
}
/**
@@ -132,7 +140,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTableReplicatedCaseInsensitive() throws Exception {
- doTestCreateTable("replicated", CacheMode.REPLICATED);
+ doTestCreateTable("replicated", null, CacheMode.REPLICATED);
}
/**
@@ -141,7 +149,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTablePartitionedCaseInsensitive() throws Exception {
- doTestCreateTable("partitioned", CacheMode.PARTITIONED);
+ doTestCreateTable("partitioned", null, CacheMode.PARTITIONED);
}
/**
@@ -150,19 +158,21 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
* @throws Exception if failed.
*/
public void testCreateTableNoTemplate() throws Exception {
- doTestCreateTable(null, CacheMode.PARTITIONED);
+ doTestCreateTable(null, null, CacheMode.PARTITIONED);
}
/**
* Test that {@code CREATE TABLE} with given template cache name actually creates new cache,
* H2 table and type descriptor on all nodes, optionally with cache type check.
* @param tplCacheName Template cache name.
+ * @param cacheGrp Cache group name, or {@code null} if no group is set.
* @param mode Expected cache mode, or {@code null} if no check is needed.
*/
- private void doTestCreateTable(String tplCacheName, CacheMode mode) {
+ private void doTestCreateTable(String tplCacheName, String cacheGrp, CacheMode mode) {
executeDdl("CREATE TABLE \"Person\" (\"id\" int, \"city\" varchar," +
" \"name\" varchar, \"surname\" varchar, \"age\" int, PRIMARY KEY (\"id\", \"city\")) WITH " +
- (F.isEmpty(tplCacheName) ? "" : "\"template=" + tplCacheName + "\",") + "\"backups=10,atomicity=atomic\"");
+ (F.isEmpty(tplCacheName) ? "" : "\"template=" + tplCacheName + "\",") + "\"backups=10,atomicity=atomic\"" +
+ (F.isEmpty(cacheGrp) ? "" : ",\"cacheGroup=" + cacheGrp + '"'));
String cacheName = cacheName("Person");
@@ -184,6 +194,8 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
assertTrue(cacheDesc.sql());
+ assertEquals(cacheGrp, cacheDesc.groupDescriptor().groupName());
+
if (mode != null)
assertEquals(mode, cacheDesc.cacheConfiguration().getCacheMode());
@@ -236,7 +248,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
}
/**
- * Test that attempting to omit mandatory value of ATOMICITY parameter yields an error.
+ * Test that providing an invalid value of ATOMICITY parameter yields an error.
*/
public void testInvalidAtomicity() {
assertCreateTableWithParamsThrows("atomicity=InvalidValue",
@@ -244,6 +256,13 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
}
/**
+ * Test that attempting to omit mandatory value of CACHEGROUP parameter yields an error.
+ */
+ public void testEmptyCacheGroup() {
+ assertCreateTableWithParamsThrows("cachegroup=", "Parameter value cannot be empty: CACHEGROUP");
+ }
+
+ /**
* Test that attempting to {@code CREATE TABLE} that already exists does not yield an error if the statement
* contains {@code IF NOT EXISTS} clause.
* @throws Exception if failed.
@@ -405,7 +424,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
e.setValueType("City");
queryProcessor(client()).dynamicTableCreate("PUBLIC", e, CacheMode.PARTITIONED.name(), null,
- CacheAtomicityMode.ATOMIC, 10, false);
+ null, CacheAtomicityMode.ATOMIC, 10, false);
return null;
}
[06/39] ignite git commit: master - fixes splitter push down
Posted by sb...@apache.org.
master - fixes splitter push down
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8371e3ad
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8371e3ad
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8371e3ad
Branch: refs/heads/ignite-5272
Commit: 8371e3adf453803b2eefe228adebaac3b42b3c0a
Parents: 86d0049
Author: Sergi Vladykin <se...@gmail.com>
Authored: Wed Jun 7 18:20:24 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Wed Jun 7 18:20:24 2017 +0300
----------------------------------------------------------------------
.../query/h2/sql/GridSqlQuerySplitter.java | 69 +++++++++++++++++++-
.../query/IgniteSqlSplitterSelfTest.java | 47 +++++++++++++
2 files changed, 114 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8371e3ad/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index 1b9619e..e87a032 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -43,8 +43,10 @@ import org.apache.ignite.internal.processors.query.h2.H2Utils;
import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
+import org.apache.ignite.internal.util.lang.GridTreePrinter;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.h2.command.Prepared;
import org.h2.command.dml.Query;
@@ -187,6 +189,8 @@ public class GridSqlQuerySplitter {
String originalSql = qry.getSQL();
+// debug("ORIGINAL", originalSql);
+
final boolean explain = qry.explain();
qry.explain(false);
@@ -197,6 +201,8 @@ public class GridSqlQuerySplitter {
// Also it will collect all tables and schemas from the query.
splitter.normalizeQuery(qry);
+// debug("NORMALIZED", qry.getSQL());
+
Connection conn = stmt.getConnection();
// Here we will have correct normalized AST with optimized join order.
@@ -270,13 +276,19 @@ public class GridSqlQuerySplitter {
// Setup the needed information for split.
analyzeQueryModel(qrym);
+// debug("ANALYZED", printQueryModel(qrym));
+
// If we have child queries to split, then go hard way.
if (qrym.needSplitChild) {
// All the siblings to selects we are going to split must be also wrapped into subqueries.
pushDownQueryModel(qrym);
+// debug("PUSHED_DOWN", printQueryModel(qrym));
+
// Need to make all the joined subqueries to be ordered by join conditions.
setupMergeJoinSorting(qrym);
+
+// debug("SETUP_MERGE_JOIN", printQueryModel(qrym));
}
else if (!qrym.needSplit) // Just split the top level query.
setNeedSplit(qrym);
@@ -317,6 +329,20 @@ public class GridSqlQuerySplitter {
}
/**
+ * @param label Label.
+ * @param info Info.
+ * @deprecated Must be commented out.
+ */
+ @Deprecated
+ @SuppressWarnings("unused")
+ private static void debug(String label, String info) {
+ X.println();
+ X.println(" ==" + label + "== ");
+ X.println(info);
+ X.println(" ======== ");
+ }
+
+ /**
* @param qrym Query model for the SELECT.
*/
private void pushDownQueryModelSelect(QueryModel qrym) {
@@ -546,6 +572,8 @@ public class GridSqlQuerySplitter {
// and mark that subquery as splittable.
doPushDownQueryModelRange(qrym, begin, end, true);
}
+
+// debug("PUSH_DOWN_PARTIAL", printQueryModel(qrym));
}
/**
@@ -645,6 +673,9 @@ public class GridSqlQuerySplitter {
int end,
GridSqlAlias wrapAlias
) {
+ // Get the original SELECT.
+ GridSqlSelect select = qrym.ast();
+
GridSqlSelect wrapSelect = GridSqlAlias.<GridSqlSubquery>unwrap(wrapAlias).subquery();
final int last = qrym.size() - 1;
@@ -716,6 +747,7 @@ public class GridSqlQuerySplitter {
wrapSelect.from(endJoin);
afterBeginJoin.leftTable(beginJoin.rightTable());
beginJoin.rightTable(wrapAlias);
+ select.from(beginJoin);
}
else if (begin == 0) {
// From the first model to some middle one.
@@ -780,8 +812,6 @@ public class GridSqlQuerySplitter {
beginJoin.rightTable(wrapAlias);
}
- // Get the original SELECT.
- GridSqlSelect select = qrym.ast();
GridSqlAst from = select.from();
// Push down related ON conditions for all the related joins.
@@ -2177,6 +2207,41 @@ public class GridSqlQuerySplitter {
}
/**
+ * @param root Root model.
+ * @return Tree as a string.
+ */
+ @SuppressWarnings("unused")
+ private String printQueryModel(QueryModel root) {
+ GridTreePrinter<QueryModel> mp = new GridTreePrinter<QueryModel>() {
+ /** {@inheritDoc} */
+ @Override protected List<QueryModel> getChildren(QueryModel m) {
+ return m;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected String formatTreeNode(QueryModel m) {
+ return "[ " +(m.uniqueAlias == null ? "+" : m.uniqueAlias.alias()) +
+ " -> " + m.type +
+ " ns:" + m.needSplit + " nsch:" + m.needSplitChild +
+ " ast: " + ast(m) +" ]";
+ }
+
+ private String ast(QueryModel m) {
+ if (m.prnt == null)
+ return "-+-+-";
+
+ String ast = m.ast().getSQL().replace('\n', ' ');
+
+ int maxLen = 2000;
+
+ return ast.length() <= maxLen ? ast : ast.substring(0, maxLen);
+ }
+ };
+
+ return mp.print(root);
+ }
+
+ /**
* Ensures all given queries have non-empty derived partitions and merges them.
*
* @param queries Collection of queries.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8371e3ad/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index d8f71a3..8b743bf 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@ -50,6 +50,7 @@ import org.apache.ignite.internal.processors.query.h2.twostep.GridMergeIndex;
import org.apache.ignite.internal.util.GridRandom;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
@@ -164,6 +165,52 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
/**
*/
+ public void testPushDown() {
+ IgniteCache<Integer, Person> c = ignite(0).getOrCreateCache(cacheConfig("ps", true,
+ Integer.class, Person.class));
+
+ try {
+ String subqry = "(select max(p.id) as id, p.depId from Person p group by p.depId)";
+
+ for (int i = 0; i < 5; i++) {
+ SB qry = new SB("select * from ");
+
+ for (int j = 0; j < 5; j++) {
+ if (j != 0)
+ qry.a(", ");
+
+ if (j == i)
+ qry.a(subqry);
+ else
+ qry.a("Person");
+
+ qry.a(" p").a(j);
+ }
+
+ qry.a(" where");
+
+ for (int j = 1; j < 5; j++) {
+ if (j != 1)
+ qry.a(" and");
+
+ qry.a(" p").a(j - 1).a(".id").a(" = ").a("p").a(j).a(".depId");
+ }
+
+ c.query(new SqlFieldsQuery(qry.toString())
+ .setEnforceJoinOrder(true)).getAll();
+
+ X.println("\nPlan:\n" +
+ c.query(new SqlFieldsQuery("explain " + qry.toString())
+ .setEnforceJoinOrder(true)).getAll());
+ }
+ }
+ finally {
+ c.destroy();
+ }
+ }
+
+ /**
+ */
public void testReplicatedTablesUsingPartitionedCache() {
doTestReplicatedTablesUsingPartitionedCache(1, false, false);
}
[21/39] ignite git commit: master - fixes for push down with LEFT
OUTER JOIN
Posted by sb...@apache.org.
master - fixes for push down with LEFT OUTER JOIN
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e3ff16ab
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e3ff16ab
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e3ff16ab
Branch: refs/heads/ignite-5272
Commit: e3ff16abed72e2b8a897a2699fe23e0e614f502d
Parents: d2efe78
Author: Sergi Vladykin <se...@gmail.com>
Authored: Thu Jun 8 20:39:05 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Thu Jun 8 20:39:05 2017 +0300
----------------------------------------------------------------------
.../processors/query/h2/sql/GridSqlJoin.java | 7 ++
.../query/h2/sql/GridSqlQuerySplitter.java | 82 ++++++++++++++++++--
.../query/IgniteSqlSplitterSelfTest.java | 50 ++++++++++++
3 files changed, 131 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ff16ab/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
index afe4a53..9546223 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlJoin.java
@@ -93,6 +93,13 @@ public class GridSqlJoin extends GridSqlElement {
return child(ON_CHILD);
}
+ /**
+ * @return {@code true} If this is a LEFT OUTER JOIN.
+ */
+ public boolean isLeftOuter() {
+ return leftOuter;
+ }
+
/** {@inheritDoc} */
@Override public String getSQL() {
StatementBuilder buff = new StatementBuilder();
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ff16ab/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
index e87a032..25d97fc 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQuerySplitter.java
@@ -106,6 +106,9 @@ public class GridSqlQuerySplitter {
private Set<QueryTable> tbls = new HashSet<>();
/** */
+ private Set<String> pushedDownCols = new HashSet<>();
+
+ /** */
private boolean rdcQrySimple;
/** */
@@ -337,22 +340,75 @@ public class GridSqlQuerySplitter {
@SuppressWarnings("unused")
private static void debug(String label, String info) {
X.println();
- X.println(" ==" + label + "== ");
+ X.println(" == " + label + " == ");
X.println(info);
- X.println(" ======== ");
+ X.println(" ======================= ");
+ }
+
+ /**
+ * @param expr Expression.
+ * @return {@code true} If the expression contains pushed down columns.
+ */
+ private boolean hasPushedDownColumn(GridSqlAst expr) {
+ if (expr instanceof GridSqlColumn)
+ return pushedDownCols.contains(((GridSqlColumn)expr).columnName());
+
+ for (int i = 0; i < expr.size(); i++) {
+ if (hasPushedDownColumn(expr.child(i)))
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @param from FROM clause.
+ * @return {@code true} If contains LEFT OUTER JOIN.
+ */
+ private static boolean hasLeftJoin(GridSqlAst from) {
+ while (from instanceof GridSqlJoin) {
+ GridSqlJoin join = (GridSqlJoin)from;
+
+ assert !(join.rightTable() instanceof GridSqlJoin);
+
+ if (join.isLeftOuter())
+ return true;
+
+ from = join.leftTable();
+ }
+
+ return false;
}
/**
* @param qrym Query model for the SELECT.
*/
private void pushDownQueryModelSelect(QueryModel qrym) {
+ assert qrym.type == Type.SELECT: qrym.type;
+
+ boolean hasLeftJoin = hasLeftJoin(qrym.<GridSqlSelect>ast().from());
+
int begin = -1;
// Here we iterate over joined FROM table filters.
+ // !!! qrym.size() can change, never assign it to a variable.
for (int i = 0; i < qrym.size(); i++) {
QueryModel child = qrym.get(i);
- if (child.isQuery() && (child.needSplitChild || child.needSplit)) {
+ boolean hasPushedDownCol = false;
+
+ // It is either splittable subquery (it must remain in REDUCE query)
+ // or left join condition with pushed down columns (this condition
+ // can not be pushed down into a wrap query).
+ if ((child.isQuery() && (child.needSplitChild || child.needSplit)) ||
+ // We always must be at the right side of the join here to push down
+ // range on the left side. If there are no LEFT JOINs in the SELECT, then
+ // we will never have ON conditions, they are getting moved to WHERE clause.
+ (hasPushedDownCol = (hasLeftJoin && i != 0 && hasPushedDownColumn(findJoin(qrym, i).on())))) {
+ // Handle a single table push down case.
+ if (hasPushedDownCol && begin == -1)
+ begin = i - 1;
+
// Push down the currently collected range.
if (begin != -1) {
pushDownQueryModelRange(qrym, begin, i - 1);
@@ -361,8 +417,10 @@ public class GridSqlQuerySplitter {
assert qrym.get(i) == child; // Adjustment check: we have to return to the same point.
- // Reset range begin.
- begin = -1;
+ // Reset range begin: in case of pushed down column we can assume current child as
+ // as new begin (because it is not a splittable subquery), otherwise reset begin
+ // and try to find next range begin further.
+ begin = hasPushedDownCol ? i : -1;
}
if (child.needSplitChild)
@@ -394,7 +452,7 @@ public class GridSqlQuerySplitter {
for (int i = 0; i < qrym.size(); i++) {
QueryModel child = qrym.get(i);
- assert child.isQuery() : qrym.type;
+ assert child.isQuery() : child.type;
if (child.needSplit)
needSplitChild = true;
@@ -579,9 +637,12 @@ public class GridSqlQuerySplitter {
/**
* @param qrym Query model.
*/
- private void setNeedSplit(QueryModel qrym) {
- if (qrym.type == Type.SELECT)
+ private static void setNeedSplit(QueryModel qrym) {
+ if (qrym.type == Type.SELECT) {
+ assert !qrym.needSplitChild;
+
qrym.needSplit = true;
+ }
else if (qrym.type == Type.UNION) {
qrym.needSplitChild = true;
@@ -816,6 +877,8 @@ public class GridSqlQuerySplitter {
// Push down related ON conditions for all the related joins.
while (from instanceof GridSqlJoin) {
+ assert !(((GridSqlJoin)from).rightTable() instanceof GridSqlJoin);
+
pushDownColumnsInExpression(tblAliases, cols, wrapAlias, from, ON_CHILD);
from = from.child(LEFT_TABLE_CHILD);
@@ -909,6 +972,9 @@ public class GridSqlQuerySplitter {
// We have this map to avoid column duplicates in wrap query.
cols.put(uniqueColAlias, colAlias);
+
+ if (!pushedDownCols.add(uniqueColAlias)) // Must be globally unique.
+ throw new IllegalStateException(uniqueColAlias);
}
col = column(uniqueColAlias);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e3ff16ab/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index 8b743bf..6c61988 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@ -211,6 +211,56 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
/**
*/
+ public void testPushDownLeftJoin() {
+ IgniteCache<Integer, Person> c = ignite(0).getOrCreateCache(cacheConfig("ps", true,
+ Integer.class, Person.class));
+
+ try {
+ String subqryAgg = "(select max(p.id) as id, p.depId from Person p group by p.depId)";
+ String subqrySimple = "(select p.id, p.depId from Person p)";
+
+ for (int i = 0; i < 5; i++) {
+ for (int k = 0; k < 5; k++) {
+ SB qry = new SB("select * from ");
+
+ for (int j = 0; j < 5; j++) {
+ if (j != 0)
+ qry.a(j == i ? " left join " : " join ");
+
+ if (j == 2)
+ qry.a(subqryAgg);
+ else
+ qry.a(j == k ? subqrySimple : "Person");
+
+ qry.a(" p").a(j);
+
+ if (j != 0) {
+ qry.a(" on ");
+
+ qry.a(" p0.id").a(" = ").a("p").a(j).a(".depId");
+ }
+ }
+
+
+ X.println(" ---> ik: : " + i + " " + k);
+ X.println("\nqry: \n" + qry.toString());
+
+ c.query(new SqlFieldsQuery(qry.toString())
+ .setEnforceJoinOrder(true)).getAll();
+
+ X.println("\nPlan:\n" +
+ c.query(new SqlFieldsQuery("explain " + qry.toString())
+ .setEnforceJoinOrder(true)).getAll());
+ }
+ }
+ }
+ finally {
+ c.destroy();
+ }
+ }
+
+ /**
+ */
public void testReplicatedTablesUsingPartitionedCache() {
doTestReplicatedTablesUsingPartitionedCache(1, false, false);
}
[35/39] ignite git commit: ignite-5272 Do not always disable
one-phase commit if there is near cache,
instead switch to non one-phase mode if there are readers.
Posted by sb...@apache.org.
ignite-5272 Do not always disable one-phase commit if there is near cache, instead switch to non one-phase mode if there are readers.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ca6cd142
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ca6cd142
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ca6cd142
Branch: refs/heads/ignite-5272
Commit: ca6cd142d43a47399c51a586d43c8eab6f82163d
Parents: 851b9ad
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jun 12 10:44:28 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jun 12 10:44:28 2017 +0300
----------------------------------------------------------------------
.../cache/CacheAffinitySharedManager.java | 3 +-
.../processors/cache/GridCacheIoManager.java | 1 +
.../GridDistributedTxPrepareRequest.java | 14 +-
.../GridDistributedTxPrepareResponse.java | 2 +-
.../distributed/dht/GridDhtCacheAdapter.java | 21 +-
.../cache/distributed/dht/GridDhtGetFuture.java | 16 +-
.../distributed/dht/GridDhtGetSingleFuture.java | 10 +-
.../dht/GridDhtTransactionalCacheAdapter.java | 3 +-
.../cache/distributed/dht/GridDhtTxLocal.java | 2 +-
.../distributed/dht/GridDhtTxLocalAdapter.java | 8 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 11 +
.../dht/GridPartitionedGetFuture.java | 2 +
.../dht/GridPartitionedSingleGetFuture.java | 17 +-
.../colocated/GridDhtColocatedLockFuture.java | 43 +--
.../distributed/near/GridNearGetFuture.java | 4 +-
.../distributed/near/GridNearGetRequest.java | 145 ++++------
.../distributed/near/GridNearLockFuture.java | 1 +
.../distributed/near/GridNearLockRequest.java | 13 +-
.../near/GridNearTxFinishFuture.java | 11 +-
.../cache/distributed/near/GridNearTxLocal.java | 15 +-
.../near/GridNearTxPrepareFutureAdapter.java | 5 +-
.../near/GridNearTxPrepareResponse.java | 14 +
.../cache/transactions/IgniteTxEntry.java | 22 +-
.../cache/transactions/IgniteTxHandler.java | 2 +
.../IgniteTxImplicitSingleStateImpl.java | 11 -
.../transactions/IgniteTxLocalAdapter.java | 6 +-
.../cache/transactions/IgniteTxLocalState.java | 10 -
.../IgniteTxRemoteStateAdapter.java | 7 -
.../cache/transactions/IgniteTxState.java | 6 -
.../cache/transactions/IgniteTxStateImpl.java | 32 ---
.../IgniteOnePhaseCommitNearReadersTest.java | 270 +++++++++++++++++++
.../testsuites/IgniteCacheTestSuite2.java | 3 +
.../testsuites/IgniteCacheTestSuite3.java | 4 +-
33 files changed, 503 insertions(+), 231 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index dc4a91f..b6fe90b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -608,7 +608,8 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
throws IgniteCheckedException {
assert affCalcVer != null || cctx.kernalContext().clientNode();
assert msg.topologyVersion() != null && msg.exchangeId() == null : msg;
- assert affCalcVer == null || affCalcVer.equals(msg.topologyVersion());
+ assert affCalcVer == null || affCalcVer.equals(msg.topologyVersion()) :
+ "Invalid version [affCalcVer=" + affCalcVer + ", msg=" + msg + ']';
final AffinityTopologyVersion topVer = exchFut.topologyVersion();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 946d256..37e495e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -740,6 +740,7 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
null,
null,
null,
+ false,
req.deployInfo() != null);
res.error(req.classError());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
index 4b11414f..3205c58 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
@@ -689,15 +689,19 @@ public class GridDistributedTxPrepareRequest extends GridDistributedBaseMessage
StringBuilder flags = new StringBuilder();
if (needReturnValue())
- flags.append("retVal");
+ appendFlag(flags, "retVal");
+
if (isInvalidate())
- flags.append("invalidate");
+ appendFlag(flags, "invalidate");
+
if (onePhaseCommit())
- flags.append("onePhase");
+ appendFlag(flags, "onePhase");
+
if (last())
- flags.append("last");
+ appendFlag(flags, "last");
+
if (system())
- flags.append("sys");
+ appendFlag(flags, "sys");
return GridToStringBuilder.toString(GridDistributedTxPrepareRequest.class, this,
"flags", flags.toString(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
index 7cd3ad8..58e9492 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
@@ -55,7 +55,7 @@ public class GridDistributedTxPrepareResponse extends GridDistributedBaseMessage
private int part;
/** */
- private byte flags;
+ protected byte flags;
/**
* Empty constructor (required by {@link Externalizable}).
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 418d712..38d0108 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -726,15 +726,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
return sum;
}
- /**
- * This method is used internally. Use
- * {@link #getDhtAsync(UUID, long, Map, boolean, AffinityTopologyVersion, UUID, int, IgniteCacheExpiryPolicy, boolean, boolean)}
- * method instead to retrieve DHT value.
- * @param keys {@inheritDoc}
- * @param forcePrimary {@inheritDoc}
- * @param skipTx {@inheritDoc}
- * @param needVer Need version. @return {@inheritDoc}
- */
+ /** {@inheritDoc} */
@Override public IgniteInternalFuture<Map<K, V>> getAllAsync(
@Nullable Collection<? extends K> keys,
boolean forcePrimary,
@@ -805,6 +797,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
* @param reader Reader node ID.
* @param msgId Message ID.
* @param keys Keys to get.
+ * @param addReaders Add readers flag.
* @param readThrough Read through flag.
* @param topVer Topology version.
* @param subjId Subject ID.
@@ -816,6 +809,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
public GridDhtFuture<Collection<GridCacheEntryInfo>> getDhtAsync(UUID reader,
long msgId,
Map<KeyCacheObject, Boolean> keys,
+ boolean addReaders,
boolean readThrough,
AffinityTopologyVersion topVer,
@Nullable UUID subjId,
@@ -834,7 +828,8 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
taskNameHash,
expiry,
skipVals,
- recovery);
+ recovery,
+ addReaders);
fut.init();
@@ -854,7 +849,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
* @param skipVals Skip vals flag.
* @return Future for the operation.
*/
- private IgniteInternalFuture<GridCacheEntryInfo> getDhtSingleAsync(
+ public GridDhtGetSingleFuture getDhtSingleAsync(
UUID nodeId,
long msgId,
KeyCacheObject key,
@@ -867,7 +862,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
boolean skipVals,
boolean recovery
) {
- GridDhtGetSingleFuture<K, V> fut = new GridDhtGetSingleFuture<>(
+ GridDhtGetSingleFuture fut = new GridDhtGetSingleFuture<>(
ctx,
msgId,
nodeId,
@@ -992,7 +987,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
*/
protected void processNearGetRequest(final UUID nodeId, final GridNearGetRequest req) {
assert ctx.affinityNode();
- assert !req.reload() : req;
final CacheExpiryPolicy expiryPlc = CacheExpiryPolicy.fromRemote(req.createTtl(), req.accessTtl());
@@ -1000,6 +994,7 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
getDhtAsync(nodeId,
req.messageId(),
req.keys(),
+ req.addReaders(),
req.readThrough(),
req.topologyVersion(),
req.subjectId(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
index 8031c8f..29bf3a1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
@@ -112,6 +112,9 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
/** */
private final boolean recovery;
+ /** */
+ private final boolean addReaders;
+
/**
* @param cctx Context.
* @param msgId Message ID.
@@ -135,7 +138,8 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
int taskNameHash,
@Nullable IgniteCacheExpiryPolicy expiryPlc,
boolean skipVals,
- boolean recovery
+ boolean recovery,
+ boolean addReaders
) {
super(CU.<GridCacheEntryInfo>collectionsReducer(keys.size()));
@@ -153,6 +157,7 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
this.expiryPlc = expiryPlc;
this.skipVals = skipVals;
this.recovery = recovery;
+ this.addReaders = addReaders;
futId = IgniteUuid.randomUuid();
@@ -346,12 +351,13 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
GridCompoundFuture<Boolean, Boolean> txFut = null;
- ClusterNode readerNode = cctx.discovery().node(reader);
-
ReaderArguments readerArgs = null;
- if (readerNode != null && !readerNode.isLocal() && cctx.discovery().cacheNearNode(readerNode, cctx.name())) {
+ if (addReaders && !skipVals && !cctx.localNodeId().equals(reader)) {
for (Map.Entry<KeyCacheObject, Boolean> k : keys.entrySet()) {
+ if (!k.getValue())
+ continue;
+
while (true) {
GridDhtCacheEntry e = cache().entryExx(k.getKey(), topVer);
@@ -359,7 +365,7 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
if (e.obsolete())
continue;
- boolean addReader = (!e.deleted() && k.getValue() && !skipVals);
+ boolean addReader = !e.deleted();
if (addReader) {
e.unswap(false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
index b9007ba..095fe77 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
@@ -73,7 +73,7 @@ public final class GridDhtGetSingleFuture<K, V> extends GridFutureAdapter<GridCa
private KeyCacheObject key;
/** */
- private boolean addRdr;
+ private final boolean addRdr;
/** Reserved partitions. */
private int part = -1;
@@ -123,7 +123,7 @@ public final class GridDhtGetSingleFuture<K, V> extends GridFutureAdapter<GridCa
long msgId,
UUID reader,
KeyCacheObject key,
- Boolean addRdr,
+ boolean addRdr,
boolean readThrough,
@NotNull AffinityTopologyVersion topVer,
@Nullable UUID subjId,
@@ -303,11 +303,9 @@ public final class GridDhtGetSingleFuture<K, V> extends GridFutureAdapter<GridCa
IgniteInternalFuture<Boolean> rdrFut = null;
- ClusterNode readerNode = cctx.discovery().node(reader);
-
ReaderArguments readerArgs = null;
- if (readerNode != null && !readerNode.isLocal() && cctx.discovery().cacheNearNode(readerNode, cctx.name())) {
+ if (addRdr && !skipVals && !cctx.localNodeId().equals(reader)) {
while (true) {
GridDhtCacheEntry e = cache().entryExx(key, topVer);
@@ -315,7 +313,7 @@ public final class GridDhtGetSingleFuture<K, V> extends GridFutureAdapter<GridCa
if (e.obsolete())
continue;
- boolean addReader = (!e.deleted() && this.addRdr && !skipVals);
+ boolean addReader = !e.deleted();
if (addReader) {
e.unswap(false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index d607ff1..acba833 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -1026,7 +1026,8 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
req.createTtl(),
req.accessTtl(),
req.skipStore(),
- req.keepBinary());
+ req.keepBinary(),
+ req.nearCache());
final GridDhtTxLocal t = tx;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
index 26f08fa..e1bc313 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
@@ -265,7 +265,7 @@ public class GridDhtTxLocal extends GridDhtTxLocalAdapter implements GridCacheMa
@Override @Nullable protected IgniteInternalFuture<Boolean> addReader(long msgId, GridDhtCacheEntry cached,
IgniteTxEntry entry, AffinityTopologyVersion topVer) {
// Don't add local node as reader.
- if (!cctx.localNodeId().equals(nearNodeId)) {
+ if (entry.addReader() && !cctx.localNodeId().equals(nearNodeId)) {
GridCacheContext cacheCtx = cached.context();
while (true) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
index 8b51cb5..c027ab9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
@@ -535,6 +535,8 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
* @param accessTtl TTL for read operation.
* @param needRetVal Return value flag.
* @param skipStore Skip store flag.
+ * @param keepBinary Keep binary flag.
+ * @param nearCache {@code True} if near cache enabled on originating node.
* @return Lock future.
*/
@SuppressWarnings("ForLoopReplaceableByForEach")
@@ -547,7 +549,8 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
long createTtl,
long accessTtl,
boolean skipStore,
- boolean keepBinary
+ boolean keepBinary,
+ boolean nearCache
) {
try {
checkValid();
@@ -612,7 +615,8 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
-1L,
null,
skipStore,
- keepBinary);
+ keepBinary,
+ nearCache);
if (read)
txEntry.ttl(accessTtl);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 609e4cf..5b4b10f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -855,6 +855,7 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
ret,
prepErr,
null,
+ tx.onePhaseCommit(),
tx.activeCachesDeploymentEnabled());
if (prepErr == null) {
@@ -1231,6 +1232,16 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
return;
if (last) {
+ if (tx.onePhaseCommit() && !tx.nearMap().isEmpty()) {
+ for (GridDistributedTxMapping nearMapping : tx.nearMap().values()) {
+ if (!tx.dhtMap().containsKey(nearMapping.primary().id())) {
+ tx.onePhaseCommit(false);
+
+ break;
+ }
+ }
+ }
+
int miniId = 0;
assert tx.transactionNodes() != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
index 5543cec..8db0ea1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
@@ -292,6 +292,7 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
cache().getDhtAsync(n.id(),
-1,
mappedKeys,
+ false,
readThrough,
topVer,
subjId,
@@ -351,6 +352,7 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
taskName == null ? 0 : taskName.hashCode(),
expiryPlc != null ? expiryPlc.forCreate() : -1L,
expiryPlc != null ? expiryPlc.forAccess() : -1L,
+ false,
skipVals,
cctx.deploymentEnabled(),
recovery);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
index d3bfb3a..9eb01ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
@@ -224,11 +224,10 @@ public class GridPartitionedSingleGetFuture extends GridCacheFutureAdapter<Objec
return;
if (node.isLocal()) {
- Map<KeyCacheObject, Boolean> map = Collections.singletonMap(key, false);
-
- final GridDhtFuture<Collection<GridCacheEntryInfo>> fut = cctx.dht().getDhtAsync(node.id(),
+ final GridDhtFuture<GridCacheEntryInfo> fut = cctx.dht().getDhtSingleAsync(node.id(),
-1,
- map,
+ key,
+ false,
readThrough,
topVer,
subjId,
@@ -250,14 +249,12 @@ public class GridPartitionedSingleGetFuture extends GridCacheFutureAdapter<Objec
map(updTopVer);
}
else {
- fut.listen(new CI1<IgniteInternalFuture<Collection<GridCacheEntryInfo>>>() {
- @Override public void apply(IgniteInternalFuture<Collection<GridCacheEntryInfo>> fut) {
+ fut.listen(new CI1<IgniteInternalFuture<GridCacheEntryInfo>>() {
+ @Override public void apply(IgniteInternalFuture<GridCacheEntryInfo> fut) {
try {
- Collection<GridCacheEntryInfo> infos = fut.get();
-
- assert F.isEmpty(infos) || infos.size() == 1 : infos;
+ GridCacheEntryInfo info = fut.get();
- setResult(F.first(infos));
+ setResult(info);
}
catch (Exception e) {
U.error(log, "Failed to get values from dht cache [fut=" + fut + "]", e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index b88eb47..de63ea3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -963,29 +963,32 @@ public final class GridDhtColocatedLockFuture extends GridCacheCompoundIdentityF
first = false;
}
- assert !implicitTx() && !implicitSingleTx() : tx;req = new GridNearLockRequest(
- cctx.cacheId(),
- topVer,
- cctx.nodeId(),
- threadId,
- futId,
- lockVer,
- inTx(),
- read,
- retval,
- isolation(),
- isInvalidate(),
- timeout,
- mappedKeys.size(),
- inTx() ? tx.size() : mappedKeys.size(),
- inTx() && tx.syncMode() == FULL_SYNC,
- inTx() ? tx.subjectId() : null,
- inTx() ? tx.taskNameHash() : 0,
- read ? createTtl : -1L,
- read ? accessTtl : -1L,
+ assert !implicitTx() && !implicitSingleTx() : tx;
+
+ req = new GridNearLockRequest(
+ cctx.cacheId(),
+ topVer,
+ cctx.nodeId(),
+ threadId,
+ futId,
+ lockVer,
+ inTx(),
+ read,
+ retval,
+ isolation(),
+ isInvalidate(),
+ timeout,
+ mappedKeys.size(),
+ inTx() ? tx.size() : mappedKeys.size(),
+ inTx() && tx.syncMode() == FULL_SYNC,
+ inTx() ? tx.subjectId() : null,
+ inTx() ? tx.taskNameHash() : 0,
+ read ? createTtl : -1L,
+ read ? accessTtl : -1L,
skipStore,
keepBinary,
clientFirst,
+ false,
cctx.deploymentEnabled());
mapping.request(req);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index c7c6e9e..d4769a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -314,6 +314,7 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
dht().getDhtAsync(n.id(),
-1,
mappedKeys,
+ false,
readThrough,
topVer,
subjId,
@@ -379,6 +380,7 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
taskName == null ? 0 : taskName.hashCode(),
expiryPlc != null ? expiryPlc.forCreate() : -1L,
expiryPlc != null ? expiryPlc.forAccess() : -1L,
+ true,
skipVals,
cctx.deploymentEnabled(),
recovery);
@@ -445,7 +447,7 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
EntryGetResult res = entry.innerGetVersioned(
null,
null,
- /**update-metrics*/true,
+ /*update-metrics*/true,
/*event*/!skipVals,
subjId,
null,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
index 6092511..5f042d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
@@ -20,7 +20,6 @@ package org.apache.ignite.internal.processors.cache.distributed.near;
import java.io.Externalizable;
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -55,6 +54,18 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
/** */
private static final long serialVersionUID = 0L;
+ /** */
+ private static final int READ_THROUGH_FLAG_MASK = 0x01;
+
+ /** */
+ private static final int SKIP_VALS_FLAG_MASK = 0x02;
+
+ /** */
+ private static final int ADD_READER_FLAG_MASK = 0x04;
+
+ /** */
+ public static final int RECOVERY_FLAG_MASK = 0x08;
+
/** Future ID. */
private IgniteUuid futId;
@@ -75,19 +86,10 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
/** */
@GridDirectCollection(boolean.class)
- private Collection<Boolean> flags;
-
- /** Reload flag. */
- private boolean reload;
+ private List<Boolean> readersFlags;
- /** Read through flag. */
- private boolean readThrough;
-
- /** Skip values flag. Used for {@code containsKey} method. */
- private boolean skipVals;
-
- /** Recovery flag. */
- private boolean recovery;
+ /** */
+ private byte flags;
/** Topology version. */
private AffinityTopologyVersion topVer;
@@ -139,6 +141,7 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
int taskNameHash,
long createTtl,
long accessTtl,
+ boolean addReader,
boolean skipVals,
boolean addDepInfo,
boolean recovery
@@ -153,22 +156,35 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
this.ver = ver;
this.keys = new ArrayList<>(keys.size());
- flags = new ArrayList<>(keys.size());
+
+ if (addReader)
+ readersFlags = new ArrayList<>(keys.size());
for (Map.Entry<KeyCacheObject, Boolean> entry : keys.entrySet()) {
this.keys.add(entry.getKey());
- flags.add(entry.getValue());
+
+ if (addReader)
+ readersFlags.add(entry.getValue());
}
- this.readThrough = readThrough;
this.topVer = topVer;
this.subjId = subjId;
this.taskNameHash = taskNameHash;
this.createTtl = createTtl;
this.accessTtl = accessTtl;
- this.skipVals = skipVals;
this.addDepInfo = addDepInfo;
- this.recovery = recovery;
+
+ if (readThrough)
+ flags |= READ_THROUGH_FLAG_MASK;
+
+ if (skipVals)
+ flags |= SKIP_VALS_FLAG_MASK;
+
+ if (addReader)
+ flags |= ADD_READER_FLAG_MASK;
+
+ if (recovery)
+ flags |= RECOVERY_FLAG_MASK;
}
/**
@@ -214,17 +230,10 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
}
/**
- * @return Reload flag.
- */
- public boolean reload() {
- return reload;
- }
-
- /**
* @return Read through flag.
*/
public boolean readThrough() {
- return readThrough;
+ return (flags & READ_THROUGH_FLAG_MASK) != 0;
}
/**
@@ -232,14 +241,18 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
* returned as future result.
*/
public boolean skipValues() {
- return skipVals;
+ return (flags & SKIP_VALS_FLAG_MASK) != 0;
}
/**
* @return Recovery flag.
*/
public boolean recovery() {
- return recovery;
+ return (flags & RECOVERY_FLAG_MASK) != 0;
+ }
+
+ public boolean addReaders() {
+ return (flags & ADD_READER_FLAG_MASK) != 0;
}
/**
@@ -277,7 +290,7 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
assert ctx != null;
assert !F.isEmpty(keys);
- assert keys.size() == flags.size();
+ assert readersFlags == null || keys.size() == readersFlags.size();
GridCacheContext cctx = ctx.cacheContext(cacheId);
@@ -297,16 +310,18 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
finishUnmarshalCacheObjects(keys, cctx, ldr);
assert !F.isEmpty(keys);
- assert keys.size() == flags.size();
+ assert readersFlags == null || keys.size() == readersFlags.size();
if (keyMap == null) {
keyMap = U.newLinkedHashMap(keys.size());
Iterator<KeyCacheObject> keysIt = keys.iterator();
- Iterator<Boolean> flagsIt = flags.iterator();
- while (keysIt.hasNext())
- keyMap.put(keysIt.next(), flagsIt.next());
+ for (int i = 0; i < keys.size(); i++) {
+ Boolean addRdr = readersFlags != null ? readersFlags.get(i) : Boolean.FALSE;
+
+ keyMap.put(keysIt.next(), addRdr);
+ }
}
}
@@ -343,7 +358,7 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
writer.incrementState();
case 5:
- if (!writer.writeCollection("flags", flags, MessageCollectionItemType.BOOLEAN))
+ if (!writer.writeByte("flags", flags))
return false;
writer.incrementState();
@@ -367,48 +382,30 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
writer.incrementState();
case 9:
- if (!writer.writeBoolean("readThrough", readThrough))
+ if (!writer.writeCollection("readersFlags", readersFlags, MessageCollectionItemType.BOOLEAN))
return false;
writer.incrementState();
case 10:
- if (!writer.writeBoolean("recovery", recovery))
- return false;
-
- writer.incrementState();
-
- case 11:
- if (!writer.writeBoolean("reload", reload))
- return false;
-
- writer.incrementState();
-
- case 12:
- if (!writer.writeBoolean("skipVals", skipVals))
- return false;
-
- writer.incrementState();
-
- case 13:
if (!writer.writeUuid("subjId", subjId))
return false;
writer.incrementState();
- case 14:
+ case 11:
if (!writer.writeInt("taskNameHash", taskNameHash))
return false;
writer.incrementState();
- case 15:
+ case 12:
if (!writer.writeMessage("topVer", topVer))
return false;
writer.incrementState();
- case 16:
+ case 13:
if (!writer.writeMessage("ver", ver))
return false;
@@ -447,7 +444,7 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
reader.incrementState();
case 5:
- flags = reader.readCollection("flags", MessageCollectionItemType.BOOLEAN);
+ flags = reader.readByte("flags");
if (!reader.isLastRead())
return false;
@@ -479,7 +476,7 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
reader.incrementState();
case 9:
- readThrough = reader.readBoolean("readThrough");
+ readersFlags = reader.readCollection("readersFlags", MessageCollectionItemType.BOOLEAN);
if (!reader.isLastRead())
return false;
@@ -487,30 +484,6 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
reader.incrementState();
case 10:
- recovery = reader.readBoolean("recovery");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 11:
- reload = reader.readBoolean("reload");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 12:
- skipVals = reader.readBoolean("skipVals");
-
- if (!reader.isLastRead())
- return false;
-
- reader.incrementState();
-
- case 13:
subjId = reader.readUuid("subjId");
if (!reader.isLastRead())
@@ -518,7 +491,7 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
reader.incrementState();
- case 14:
+ case 11:
taskNameHash = reader.readInt("taskNameHash");
if (!reader.isLastRead())
@@ -526,7 +499,7 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
reader.incrementState();
- case 15:
+ case 12:
topVer = reader.readMessage("topVer");
if (!reader.isLastRead())
@@ -534,7 +507,7 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
reader.incrementState();
- case 16:
+ case 13:
ver = reader.readMessage("ver");
if (!reader.isLastRead())
@@ -554,7 +527,7 @@ public class GridNearGetRequest extends GridCacheIdMessage implements GridCacheD
/** {@inheritDoc} */
@Override public byte fieldsCount() {
- return 17;
+ return 14;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
index 0786f29..1118d99 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
@@ -1074,6 +1074,7 @@ public final class GridNearLockFuture extends GridCacheCompoundIdentityFuture<Bo
skipStore,
keepBinary,
clientFirst,
+ true,
cctx.deploymentEnabled());
mapping.request(req);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
index 4815fcf..b48693d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
@@ -55,6 +55,9 @@ public class GridNearLockRequest extends GridDistributedLockRequest {
/** */
private static final int SYNC_COMMIT_FLAG_MASK = 0x04;
+ /** */
+ private static final int NEAR_CACHE_FLAG_MASK = 0x08;
+
/** Topology version. */
private AffinityTopologyVersion topVer;
@@ -137,8 +140,8 @@ public class GridNearLockRequest extends GridDistributedLockRequest {
boolean skipStore,
boolean keepBinary,
boolean firstClientReq,
+ boolean nearCache,
boolean addDepInfo
-
) {
super(
cacheId,
@@ -171,6 +174,14 @@ public class GridNearLockRequest extends GridDistributedLockRequest {
setFlag(syncCommit, SYNC_COMMIT_FLAG_MASK);
setFlag(firstClientReq, FIRST_CLIENT_REQ_FLAG_MASK);
setFlag(retVal, NEED_RETURN_VALUE_FLAG_MASK);
+ setFlag(nearCache, NEAR_CACHE_FLAG_MASK);
+ }
+
+ /**
+ * @return {@code True} if near cache enabled on originating node.
+ */
+ public boolean nearCache() {
+ return isFlag(NEAR_CACHE_FLAG_MASK);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index 89874ab..27cebf8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -608,10 +608,19 @@ public final class GridNearTxFinishFuture<K, V> extends GridCacheCompoundIdentit
* @return {@code True} if need to send finish request for one phase commit transaction.
*/
private boolean needFinishOnePhase(boolean commit) {
+ assert tx.onePhaseCommit();
+
if (tx.mappings().empty())
return false;
- return tx.txState().hasNearCache(cctx) || !commit;
+ if (!commit)
+ return true;
+
+ GridDistributedTxMapping mapping = tx.mappings().singleMapping();
+
+ assert mapping != null;
+
+ return mapping.hasNearCacheEntries();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index 8c10e53..55905b7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -1217,7 +1217,8 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements AutoClosea
drExpireTime,
drVer,
skipStore,
- keepBinary);
+ keepBinary,
+ CU.isNearEnabled(cacheCtx));
}
else {
txEntry = addEntry(READ,
@@ -1232,7 +1233,8 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements AutoClosea
-1L,
null,
skipStore,
- keepBinary);
+ keepBinary,
+ CU.isNearEnabled(cacheCtx));
}
txEntry.markValid();
@@ -1262,7 +1264,8 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements AutoClosea
drExpireTime,
drVer,
skipStore,
- keepBinary);
+ keepBinary,
+ CU.isNearEnabled(cacheCtx));
if (enlisted != null)
enlisted.add(cacheKey);
@@ -1365,7 +1368,8 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements AutoClosea
drExpireTime,
drVer,
skipStore,
- keepBinary);
+ keepBinary,
+ CU.isNearEnabled(cacheCtx));
if (enlisted != null)
enlisted.add(cacheKey);
@@ -2201,7 +2205,8 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter implements AutoClosea
-1L,
null,
skipStore,
- !deserializeBinary);
+ !deserializeBinary,
+ CU.isNearEnabled(cacheCtx));
// As optimization, mark as checked immediately
// for non-pessimistic if value is not null.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
index 004e4da..a94d6fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareFutureAdapter.java
@@ -172,7 +172,7 @@ public abstract class GridNearTxPrepareFutureAdapter extends
Collection<UUID> backups = entry.getValue();
- if (backups.size() <= 1 && !tx.txState().hasNearCacheConfigured(cctx, tx.topologyVersion()))
+ if (backups.size() <= 1)
tx.onePhaseCommit(true);
}
}
@@ -191,6 +191,9 @@ public abstract class GridNearTxPrepareFutureAdapter extends
assert res.error() == null : res;
+ if (tx.onePhaseCommit() && !res.onePhaseCommit())
+ tx.onePhaseCommit(false);
+
UUID nodeId = m.primary().id();
for (Map.Entry<IgniteTxKey, CacheVersionedValue> entry : res.ownedValues().entrySet()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index ceab1f1..8162168 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -52,6 +52,9 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
/** */
private static final long serialVersionUID = 0L;
+ /** Tx onePhaseCommit flag on primary node. */
+ private static final int NEAR_PREPARE_ONE_PHASE_COMMIT_FLAG_MASK = 0x01;
+
/** Collection of versions that are pending and less than lock version. */
@GridToStringInclude
@GridDirectCollection(GridCacheVersion.class)
@@ -123,6 +126,7 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
GridCacheReturn retVal,
Throwable err,
AffinityTopologyVersion clientRemapVer,
+ boolean onePhaseCommit,
boolean addDepInfo
) {
super(part, xid, err, addDepInfo);
@@ -136,6 +140,16 @@ public class GridNearTxPrepareResponse extends GridDistributedTxPrepareResponse
this.writeVer = writeVer;
this.retVal = retVal;
this.clientRemapVer = clientRemapVer;
+
+ if (onePhaseCommit)
+ flags |= NEAR_PREPARE_ONE_PHASE_COMMIT_FLAG_MASK;
+ }
+
+ /**
+ * @return One-phase commit state on primary node.
+ */
+ public boolean onePhaseCommit() {
+ return isFlag(NEAR_PREPARE_ONE_PHASE_COMMIT_FLAG_MASK);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index 30aa335..527688e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -88,6 +88,9 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
/** Flag indicating that old value for 'invoke' operation was non null on primary node. */
private static final int TX_ENTRY_OLD_VAL_ON_PRIMARY = 0x04;
+ /** Flag indicating that near cache is enabled on originating node and it should be added as reader. */
+ private static final int TX_ENTRY_ADD_READER_FLAG_MASK = 0x08;
+
/** Prepared flag updater. */
private static final AtomicIntegerFieldUpdater<IgniteTxEntry> PREPARED_UPD =
AtomicIntegerFieldUpdater.newUpdater(IgniteTxEntry.class, "prepared");
@@ -275,6 +278,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
* @param filters Put filters.
* @param conflictVer Data center replication version.
* @param skipStore Skip store flag.
+ * @param addReader Add reader flag.
*/
public IgniteTxEntry(GridCacheContext<?, ?> ctx,
IgniteInternalTx tx,
@@ -287,7 +291,8 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
CacheEntryPredicate[] filters,
GridCacheVersion conflictVer,
boolean skipStore,
- boolean keepBinary
+ boolean keepBinary,
+ boolean addReader
) {
assert ctx != null;
assert tx != null;
@@ -304,6 +309,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
skipStore(skipStore);
keepBinary(keepBinary);
+ addReader(addReader);
if (entryProcessor != null)
addEntryProcessor(entryProcessor, invokeArgs);
@@ -524,6 +530,20 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
}
/**
+ * @param addReader Add reader flag.
+ */
+ public void addReader(boolean addReader) {
+ setFlag(addReader, TX_ENTRY_ADD_READER_FLAG_MASK);
+ }
+
+ /**
+ * @return Add reader flag.
+ */
+ public boolean addReader() {
+ return isFlag(TX_ENTRY_ADD_READER_FLAG_MASK);
+ }
+
+ /**
* Sets flag mask.
*
* @param flag Set or clear.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index ba3b2b6..35ee011 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -249,6 +249,7 @@ public class IgniteTxHandler {
null,
e,
null,
+ req.onePhaseCommit(),
req.deployInfo() != null);
}
}
@@ -365,6 +366,7 @@ public class IgniteTxHandler {
null,
null,
top.topologyVersion(),
+ req.onePhaseCommit(),
req.deployInfo() != null);
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java
index 36f5f2f..99402c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java
@@ -26,7 +26,6 @@ import java.util.Set;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
@@ -133,11 +132,6 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter {
}
/** {@inheritDoc} */
- @Override public boolean hasNearCache(GridCacheSharedContext cctx) {
- return cacheCtx != null && cacheCtx.isNear();
- }
-
- /** {@inheritDoc} */
@Override public GridDhtTopologyFuture topologyReadLock(GridCacheSharedContext cctx, GridFutureAdapter<?> fut) {
if (cacheCtx == null || cacheCtx.isLocal())
return cctx.exchange().lastTopologyFuture();
@@ -294,11 +288,6 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter {
}
/** {@inheritDoc} */
- @Override public boolean hasNearCacheConfigured(GridCacheSharedContext ctx, AffinityTopologyVersion topVer) {
- return cacheCtx != null ? ctx.discovery().hasNearCache(cacheCtx.cacheId(), topVer) : false;
- }
-
- /** {@inheritDoc} */
public String toString() {
return S.toString(IgniteTxImplicitSingleStateImpl.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 52a0f56..e4b850d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -1279,7 +1279,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
long drExpireTime,
@Nullable GridCacheVersion drVer,
boolean skipStore,
- boolean keepBinary
+ boolean keepBinary,
+ boolean addReader
) {
assert invokeArgs == null || op == TRANSFORM;
@@ -1355,7 +1356,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter implements Ig
filter,
drVer,
skipStore,
- keepBinary);
+ keepBinary,
+ addReader);
txEntry.conflictExpireTime(drExpireTime);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalState.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalState.java
index fe9fcbd..123d396 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalState.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalState.java
@@ -17,9 +17,6 @@
package org.apache.ignite.internal.processors.cache.transactions;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-
/**
*
*/
@@ -44,11 +41,4 @@ public interface IgniteTxLocalState extends IgniteTxState {
*
*/
public void seal();
-
- /**
- * @param ctx Context.
- * @param topVer Topology version.
- * @return {@code True} if tx has cache with created near cache.
- */
- public boolean hasNearCacheConfigured(GridCacheSharedContext ctx, AffinityTopologyVersion topVer);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java
index 2532a92..86ae684 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxRemoteStateAdapter.java
@@ -67,13 +67,6 @@ public abstract class IgniteTxRemoteStateAdapter implements IgniteTxRemoteState
}
/** {@inheritDoc} */
- @Override public boolean hasNearCache(GridCacheSharedContext cctx) {
- assert false;
-
- return false;
- }
-
- /** {@inheritDoc} */
@Override public void addActiveCache(GridCacheContext cacheCtx, boolean recovery, IgniteTxLocalAdapter tx)
throws IgniteCheckedException {
assert false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxState.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxState.java
index ed2526e..ee48ed7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxState.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxState.java
@@ -79,12 +79,6 @@ public interface IgniteTxState {
public CacheWriteSynchronizationMode syncMode(GridCacheSharedContext cctx);
/**
- * @param cctx Context.
- * @return {@code True} is tx has active near cache.
- */
- public boolean hasNearCache(GridCacheSharedContext cctx);
-
- /**
* @param cacheCtx Context.
* @param tx Transaction.
* @throws IgniteCheckedException If cache check failed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java
index 3679208..0cf66f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java
@@ -28,8 +28,6 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheInterceptor;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
-import org.apache.ignite.internal.managers.discovery.DiscoCache;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
@@ -202,20 +200,6 @@ public class IgniteTxStateImpl extends IgniteTxLocalStateAdapter {
}
/** {@inheritDoc} */
- @Override public boolean hasNearCache(GridCacheSharedContext cctx) {
- for (int i = 0; i < activeCacheIds.size(); i++) {
- int cacheId = activeCacheIds.get(i);
-
- GridCacheContext cacheCtx = cctx.cacheContext(cacheId);
-
- if (cacheCtx.isNear())
- return true;
- }
-
- return false;
- }
-
- /** {@inheritDoc} */
@Override public void addActiveCache(GridCacheContext cacheCtx, boolean recovery, IgniteTxLocalAdapter tx)
throws IgniteCheckedException {
GridCacheSharedContext cctx = cacheCtx.shared();
@@ -476,22 +460,6 @@ public class IgniteTxStateImpl extends IgniteTxLocalStateAdapter {
}
/** {@inheritDoc} */
- @Override public boolean hasNearCacheConfigured(GridCacheSharedContext ctx, AffinityTopologyVersion topVer) {
- DiscoCache discoCache = ctx.discovery().discoCache(topVer);
-
- assert discoCache != null : topVer;
-
- for (int i = 0; i < activeCacheIds.size(); i++) {
- int cacheId = activeCacheIds.get(i);
-
- if (discoCache.hasNearCache(cacheId))
- return true;
- }
-
- return false;
- }
-
- /** {@inheritDoc} */
public String toString() {
return S.toString(IgniteTxStateImpl.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearReadersTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearReadersTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearReadersTest.java
new file mode 100644
index 0000000..ed347c1
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearReadersTest.java
@@ -0,0 +1,270 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareResponse;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+import org.apache.ignite.transactions.TransactionRollbackException;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.internal.TestRecordingCommunicationSpi.spi;
+
+/**
+ *
+ */
+public class IgniteOnePhaseCommitNearReadersTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private boolean client;
+
+ /** */
+ private boolean testSpi;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ cfg.setClientMode(client);
+
+ if (testSpi) {
+ TestRecordingCommunicationSpi commSpi = new TestRecordingCommunicationSpi();
+
+ cfg.setCommunicationSpi(commSpi);
+ }
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutReadersUpdate1() throws Exception {
+ putReadersUpdate(1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutReadersUpdate2() throws Exception {
+ putReadersUpdate(0);
+ }
+
+ /**
+ * @param backups Backups number.
+ * @throws Exception If failed.
+ */
+ private void putReadersUpdate(int backups) throws Exception {
+ final int SRVS = 3;
+
+ startGrids(SRVS);
+
+ awaitPartitionMapExchange();
+
+ client = true;
+
+ Ignite srv = ignite(0);
+
+ srv.createCache(cacheConfiguration(backups));
+
+ Ignite client1 = startGrid(SRVS);
+
+ IgniteCache<Object, Object> cache1 = client1.createNearCache(DEFAULT_CACHE_NAME,
+ new NearCacheConfiguration<>());
+
+ Integer key = primaryKey(srv.cache(DEFAULT_CACHE_NAME));
+
+ Ignite client2 = startGrid(SRVS + 1);
+
+ IgniteCache<Object, Object> cache2 = client2.cache(DEFAULT_CACHE_NAME);
+
+ cache1.put(key, 1);
+
+ cache2.put(key, 2);
+
+ checkCacheData(F.asMap(key, 2), DEFAULT_CACHE_NAME);
+
+ int val = 10;
+
+ for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
+ for (TransactionIsolation isolation : TransactionIsolation.values()) {
+ try (Transaction tx = client2.transactions().txStart(concurrency, isolation)) {
+ cache2.put(key, val);
+
+ tx.commit();
+ }
+
+ checkCacheData(F.asMap(key, val), DEFAULT_CACHE_NAME);
+
+ val++;
+ }
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutReaderUpdatePrimaryFails1() throws Exception {
+ putReaderUpdatePrimaryFails(1);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPutReaderUpdatePrimaryFails2() throws Exception {
+ putReaderUpdatePrimaryFails(0);
+ }
+
+ /**
+ * @param backups Backups number.
+ * @throws Exception If failed.
+ */
+ private void putReaderUpdatePrimaryFails(int backups) throws Exception {
+ testSpi = true;
+
+ final int SRVS = 3;
+
+ startGrids(SRVS);
+
+ awaitPartitionMapExchange();
+
+ client = true;
+
+ Ignite srv = ignite(0);
+
+ srv.createCache(cacheConfiguration(backups));
+
+ Ignite client1 = startGrid(SRVS);
+
+ IgniteCache<Object, Object> cache1 = client1.createNearCache(DEFAULT_CACHE_NAME,
+ new NearCacheConfiguration<>());
+
+ Ignite client2 = startGrid(SRVS + 1);
+
+ client= false;
+
+ IgniteCache<Object, Object> cache2 = client2.cache(DEFAULT_CACHE_NAME);
+
+ Integer key = primaryKey(srv.cache(DEFAULT_CACHE_NAME));
+
+ cache1.put(key, 1);
+
+ spi(srv).blockMessages(GridNearTxPrepareResponse.class, client2.name());
+
+ IgniteFuture<?> fut = cache2.putAsync(key, 2);
+
+ U.sleep(1000);
+
+ assertFalse(fut.isDone());
+
+ stopGrid(0);
+
+ fut.get();
+
+ checkCacheData(F.asMap(key, backups == 0 ? null : 2), DEFAULT_CACHE_NAME);
+
+ for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
+ for (TransactionIsolation isolation : TransactionIsolation.values()) {
+ srv = startGrid(0);
+
+ awaitPartitionMapExchange();
+
+ key = primaryKey(srv.cache(DEFAULT_CACHE_NAME));
+
+ cache1.put(key, 1);
+
+ spi(srv).blockMessages(GridNearTxPrepareResponse.class, client2.name());
+
+ try (Transaction tx = client2.transactions().txStart(concurrency, isolation)) {
+ cache2.putAsync(key, 2);
+
+ fut = tx.commitAsync();
+
+ U.sleep(1000);
+
+ assertFalse(fut.isDone());
+
+ stopGrid(0);
+
+ if (backups == 0)
+ fut.get();
+ else {
+ try {
+ fut.get();
+
+ fail();
+ }
+ catch (TransactionRollbackException ignore) {
+ // Expected.
+ }
+ }
+ }
+
+ checkCacheData(F.asMap(key, backups == 0 ? null : 1), DEFAULT_CACHE_NAME);
+
+ try (Transaction tx = client2.transactions().txStart(concurrency, isolation)) {
+ cache2.putAsync(key, 2);
+
+ tx.commit();
+ }
+
+ checkCacheData(F.asMap(key, 2), DEFAULT_CACHE_NAME);
+ }
+ }
+ }
+
+ /**
+ * @param backups Backups number.
+ * @return Configuration.
+ */
+ private CacheConfiguration cacheConfiguration(int backups) {
+ CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ ccfg.setAtomicityMode(TRANSACTIONAL);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setBackups(backups);
+
+ return ccfg;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index 943c5f5..43f6b13 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -44,6 +44,7 @@ import org.apache.ignite.internal.processors.cache.IgniteCacheNoSyncForGetTest;
import org.apache.ignite.internal.processors.cache.IgniteCachePartitionMapUpdateTest;
import org.apache.ignite.internal.processors.cache.IgniteDynamicCacheAndNodeStop;
import org.apache.ignite.internal.processors.cache.IgniteOnePhaseCommitInvokeTest;
+import org.apache.ignite.internal.processors.cache.IgniteOnePhaseCommitNearReadersTest;
import org.apache.ignite.internal.processors.cache.MemoryPolicyConfigValidationTest;
import org.apache.ignite.internal.processors.cache.database.MemoryPolicyInitializationTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheLoadingConcurrentGridStartSelfTest;
@@ -270,6 +271,8 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTest(new TestSuite(IgniteCacheNoSyncForGetTest.class));
+ suite.addTest(new TestSuite(IgniteOnePhaseCommitNearReadersTest.class));
+
return suite;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ca6cd142/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
index f0c0c5a..975f951 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
@@ -91,6 +91,8 @@ public class IgniteCacheTestSuite3 extends TestSuite {
public static TestSuite suite() throws Exception {
TestSuite suite = new TestSuite("IgniteCache Test Suite part 3");
+ suite.addTestSuite(IgniteCacheGroupsTest.class);
+
// Value consistency tests.
suite.addTestSuite(GridCacheValueConsistencyAtomicSelfTest.class);
suite.addTestSuite(GridCacheValueConsistencyAtomicNearEnabledSelfTest.class);
@@ -196,8 +198,6 @@ public class IgniteCacheTestSuite3 extends TestSuite {
suite.addTestSuite(CacheAsyncOperationsTest.class);
- suite.addTestSuite(IgniteCacheGroupsTest.class);
-
return suite;
}
}
[23/39] ignite git commit: IGNITE-5414 Implemented usage of UNIQUE
index for key fields generation, if PRIMARY KEY not found.
Posted by sb...@apache.org.
IGNITE-5414 Implemented usage of UNIQUE index for key fields generation, if PRIMARY KEY not found.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8de8fe50
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8de8fe50
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8de8fe50
Branch: refs/heads/ignite-5272
Commit: 8de8fe50c663a0a20fc36b82ae6a621b2864d010
Parents: 4b0998e
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Jun 9 14:36:30 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 9 14:36:30 2017 +0700
----------------------------------------------------------------------
.../visor/query/VisorQueryIndexField.java | 32 ++---
.../frontend/controllers/domains-controller.js | 46 ++++----
.../views/configuration/domains-import.tpl.pug | 4 +-
.../apache/ignite/console/agent/AgentUtils.java | 24 ++--
.../ignite/console/agent/db/DbColumn.java | 17 ++-
.../apache/ignite/console/agent/db/DbTable.java | 21 ++--
.../db/dialect/DatabaseMetadataDialect.java | 27 ++++-
.../agent/db/dialect/JdbcMetadataDialect.java | 42 ++++++-
.../agent/db/dialect/OracleMetadataDialect.java | 116 +++++++++++++++----
9 files changed, 230 insertions(+), 99 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java
index fb32dd1..f1d120d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryIndexField.java
@@ -37,10 +37,10 @@ public class VisorQueryIndexField extends VisorDataTransferObject {
private static final long serialVersionUID = 0L;
/** Index field name. */
- private String fldName;
+ private String name;
/** Index field sort order. */
- private boolean fldSort;
+ private boolean sort;
/**
* Create data transfer object for given cache type metadata.
@@ -50,14 +50,14 @@ public class VisorQueryIndexField extends VisorDataTransferObject {
}
/**
- * Create data transfer object for given cache type metadata.
+ * Create data transfer object for index field.
*
- * @param fldName Index field name.
- * @param fldSort Index field sort order.
+ * @param name Index field name.
+ * @param sort Index field sort order.
*/
- public VisorQueryIndexField(String fldName, boolean fldSort) {
- this.fldName = fldName;
- this.fldSort = fldSort;
+ public VisorQueryIndexField(String name, boolean sort) {
+ this.name = name;
+ this.sort = sort;
}
/**
@@ -76,27 +76,27 @@ public class VisorQueryIndexField extends VisorDataTransferObject {
/**
* @return Index field name.
*/
- public String getFieldName() {
- return fldName;
+ public String getName() {
+ return name;
}
/**
* @return Index field sort order.
*/
- public boolean isFieldSort() {
- return fldSort;
+ public boolean getSortOrder() {
+ return sort;
}
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
- U.writeString(out, fldName);
- out.writeBoolean(fldSort);
+ U.writeString(out, name);
+ out.writeBoolean(sort);
}
/** {@inheritDoc} */
@Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
- fldName = U.readString(in);
- fldSort = in.readBoolean();
+ name = U.readString(in);
+ sort = in.readBoolean();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/frontend/controllers/domains-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/domains-controller.js b/modules/web-console/frontend/controllers/domains-controller.js
index 992c829..b8fae5d 100644
--- a/modules/web-console/frontend/controllers/domains-controller.js
+++ b/modules/web-console/frontend/controllers/domains-controller.js
@@ -697,16 +697,14 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
_fillCommonCachesOrTemplates($scope.importCommon)($scope.importCommon.action);
- _.forEach(tables, function(tbl, idx) {
+ _.forEach(tables, (tbl, idx) => {
tbl.id = idx;
tbl.action = IMPORT_DM_NEW_CACHE;
- tbl.generatedCacheName = toJavaClassName(tbl.tbl) + 'Cache';
+ tbl.generatedCacheName = toJavaClassName(tbl.table) + 'Cache';
tbl.cacheOrTemplate = DFLT_PARTITIONED_CACHE.value;
- tbl.label = tbl.schema + '.' + tbl.tbl;
+ tbl.label = tbl.schema + '.' + tbl.table;
tbl.edit = false;
- tbl.use = LegacyUtils.isDefined(_.find(tbl.cols, function(col) {
- return col.key;
- }));
+ tbl.use = LegacyUtils.isDefined(_.find(tbl.columns, (col) => col.key));
});
$scope.importDomain.action = 'tables';
@@ -718,7 +716,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
}
$scope.applyDefaults = function() {
- _.forEach($scope.importDomain.displayedTables, function(table) {
+ _.forEach($scope.importDomain.displayedTables, (table) => {
table.edit = false;
table.action = $scope.importCommon.action;
table.cacheOrTemplate = $scope.importCommon.cacheOrTemplate;
@@ -770,9 +768,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
let lastItem;
const newItems = [];
- _.forEach(_mapCaches(data.generatedCaches), function(cache) {
- $scope.caches.push(cache);
- });
+ _.forEach(_mapCaches(data.generatedCaches), (cache) => $scope.caches.push(cache));
_.forEach(data.savedDomains, function(savedItem) {
const idx = _.findIndex($scope.domains, function(domain) {
@@ -847,11 +843,11 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
const valFields = [];
const aliases = [];
- const tableName = table.tbl;
+ const tableName = table.table;
let typeName = toJavaClassName(tableName);
if (_.find($scope.importDomain.tables,
- (tbl, ix) => tbl.use && ix !== curIx && tableName === tbl.tbl)) {
+ (tbl, ix) => tbl.use && ix !== curIx && tableName === tbl.table)) {
typeName = typeName + '_' + toJavaClassName(table.schema);
containDup = true;
@@ -869,7 +865,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
let _containKey = false;
- _.forEach(table.cols, function(col) {
+ _.forEach(table.columns, function(col) {
const fld = dbField(col.name, SqlTypes.findJdbcType(col.type), col.nullable, col.unsigned);
qryFields.push({name: fld.javaFieldName, className: fld.javaType});
@@ -892,18 +888,17 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
});
containKey &= _containKey;
-
- if (table.idxs) {
- _.forEach(table.idxs, function(idx) {
- const fields = Object.keys(idx.fields);
+ if (table.indexes) {
+ _.forEach(table.indexes, (idx) => {
+ const idxFields = _.map(idx.fields, (idxFld) => ({
+ name: toJavaFieldName(idxFld.name),
+ direction: idxFld.sortOrder
+ }));
indexes.push({
- name: idx.name, indexType: 'SORTED', fields: _.map(fields, function(fieldName) {
- return {
- name: toJavaFieldName(fieldName),
- direction: idx.fields[fieldName]
- };
- })
+ name: idx.name,
+ indexType: 'SORTED',
+ fields: idxFields
});
});
}
@@ -946,10 +941,11 @@ export default ['$rootScope', '$scope', '$http', '$state', '$filter', '$timeout'
newDomain.keyType = keyField.javaType;
- // Exclude key column from query fields and indexes.
+ // Exclude key column from query fields.
newDomain.fields = _.filter(newDomain.fields, (field) => field.name !== keyField.javaFieldName);
- _.forEach(newDomain.indexes, function(index) {
+ // Exclude key column from indexes.
+ _.forEach(newDomain.indexes, (index) => {
index.fields = _.filter(index.fields, (field) => field.name !== keyField.javaFieldName);
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
index 20a7b85..29bbf4a 100644
--- a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
@@ -74,7 +74,7 @@ mixin td-ellipses-lbl(w, lbl)
.settings-row.settings-row_small-label
+text('JDBC URL:', 'selectedPreset.jdbcUrl', '"jdbcUrl"', true, 'JDBC URL', 'JDBC URL for connecting to database<br>Refer to your database documentation for details')
.settings-row.settings-row_small-label
- +text('User:', 'selectedPreset.user', '"jdbdUser"', false, '', 'User name for connecting to database')
+ +text('User:', 'selectedPreset.user', '"jdbcUser"', false, '', 'User name for connecting to database')
.settings-row.settings-row_small-label
+password('Password:', 'selectedPreset.password', '"jdbcPassword"', false, '', 'Password for connecting to database<br>Note, password would not be saved in preferences for security reasons')(ignite-on-enter='importDomainNext()')
.settings-row
@@ -132,7 +132,7 @@ mixin td-ellipses-lbl(w, lbl)
td(width='30px' style='min-width: 30px; max-width: 30px')
input(type='checkbox' ng-model='table.use' ng-change='selectTable()')
+td-ellipses-lbl('130px', '{{table.schema}}')
- +td-ellipses-lbl('160px', '{{table.tbl}}')
+ +td-ellipses-lbl('160px', '{{table.table}}')
td(colspan='2' width='288px' style='min-width: 160px; max-width: 160px')
div.td-ellipsis
a(ng-if='!table.edit' ng-click='startEditDbTableCache(table)') {{tableActionView(table)}}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
index 1999afc..797951c 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/AgentUtils.java
@@ -17,8 +17,6 @@
package org.apache.ignite.console.agent;
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsonorg.JsonOrgModule;
import io.socket.client.Ack;
@@ -39,7 +37,12 @@ public class AgentUtils {
private static final Logger log = Logger.getLogger(AgentUtils.class.getName());
/** JSON object mapper. */
- private static final ObjectMapper mapper = new ObjectMapper();
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ static {
+ // Register special module with basic serializers.
+ MAPPER.registerModule(new JsonOrgModule());
+ }
/** */
private static final Ack NOOP_CB = new Ack() {
@@ -51,15 +54,6 @@ public class AgentUtils {
}
};
- static {
- JsonOrgModule module = new JsonOrgModule();
-
- mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE);
- mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
-
- mapper.registerModule(module);
- }
-
/**
* Default constructor.
*/
@@ -172,9 +166,9 @@ public class AgentUtils {
*/
public static Object toJSON(Object obj) {
if (obj instanceof Iterable)
- return mapper.convertValue(obj, JSONArray.class);
+ return MAPPER.convertValue(obj, JSONArray.class);
- return mapper.convertValue(obj, JSONObject.class);
+ return MAPPER.convertValue(obj, JSONObject.class);
}
/**
@@ -186,6 +180,6 @@ public class AgentUtils {
* @throws IllegalArgumentException If conversion fails due to incompatible type.
*/
public static <T> T fromJSON(Object obj, Class<T> toValType) throws IllegalArgumentException {
- return mapper.convertValue(obj, toValType);
+ return MAPPER.convertValue(obj, toValType);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
index 723ee25..61c15ba 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
@@ -17,6 +17,8 @@
package org.apache.ignite.console.agent.db;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
/**
* Database table column.
*/
@@ -54,35 +56,40 @@ public class DbColumn {
/**
* @return Column name.
*/
- public String name() {
+ public String getName() {
return name;
}
/**
* @return Column JDBC type.
*/
- public int type() {
+ public int getType() {
return type;
}
/**
* @return {@code true} if this column belongs to primary key.
*/
- public boolean key() {
+ public boolean isKey() {
return key;
}
/**
* @return {@code true} if {@code NULL } allowed for column in database.
*/
- public boolean nullable() {
+ public boolean isNullable() {
return nullable;
}
/**
* @return {@code true} if column is unsigned.
*/
- public boolean unsigned() {
+ public boolean isUnsigned() {
return unsigned;
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DbColumn.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
index b74cfe5..653bb07 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
@@ -17,9 +17,9 @@
package org.apache.ignite.console.agent.db;
-import org.apache.ignite.cache.QueryIndex;
-
import java.util.Collection;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.query.VisorQueryIndex;
/**
* Database table.
@@ -35,7 +35,7 @@ public class DbTable {
private final Collection<DbColumn> cols;
/** Indexes. */
- private final Collection<QueryIndex> idxs;
+ private final Collection<VisorQueryIndex> idxs;
/**
* Default columns.
@@ -45,7 +45,7 @@ public class DbTable {
* @param cols Columns.
* @param idxs Indexes;
*/
- public DbTable(String schema, String tbl, Collection<DbColumn> cols, Collection<QueryIndex> idxs) {
+ public DbTable(String schema, String tbl, Collection<DbColumn> cols, Collection<VisorQueryIndex> idxs) {
this.schema = schema;
this.tbl = tbl;
this.cols = cols;
@@ -55,28 +55,33 @@ public class DbTable {
/**
* @return Schema name.
*/
- public String schema() {
+ public String getSchema() {
return schema;
}
/**
* @return Table name.
*/
- public String table() {
+ public String getTable() {
return tbl;
}
/**
* @return Columns.
*/
- public Collection<DbColumn> columns() {
+ public Collection<DbColumn> getColumns() {
return cols;
}
/**
* @return Indexes.
*/
- public Collection<QueryIndex> indexes() {
+ public Collection<VisorQueryIndex> getIndexes() {
return idxs;
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(DbTable.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
index 674bda5..e049d74 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
@@ -20,16 +20,19 @@ package org.apache.ignite.console.agent.db.dialect;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.ignite.cache.QueryIndex;
import org.apache.ignite.cache.QueryIndexType;
import org.apache.ignite.console.agent.db.DbColumn;
import org.apache.ignite.console.agent.db.DbTable;
+import org.apache.ignite.internal.visor.query.VisorQueryIndex;
/**
* Base class for database metadata dialect.
@@ -81,7 +84,12 @@ public abstract class DatabaseMetadataDialect {
* @return New {@code DbTable} instance.
*/
protected DbTable table(String schema, String tbl, Collection<DbColumn> cols, Collection<QueryIndex>idxs) {
- return new DbTable(schema, tbl, cols, idxs);
+ Collection<VisorQueryIndex> res = new ArrayList<>(idxs.size());
+
+ for (QueryIndex idx : idxs)
+ res.add(new VisorQueryIndex(idx));
+
+ return new DbTable(schema, tbl, cols, res);
}
/**
@@ -99,4 +107,21 @@ public abstract class DatabaseMetadataDialect {
return idx;
}
+
+ /**
+ * Select first shortest index.
+ *
+ * @param uniqueIdxs Unique indexes with columns.
+ * @return Unique index that could be used instead of primary key.
+ */
+ protected Map.Entry<String, Set<String>> uniqueIndexAsPk(Map<String, Set<String>> uniqueIdxs) {
+ Map.Entry<String, Set<String>> uniqueIdxAsPk = null;
+
+ for (Map.Entry<String, Set<String>> uniqueIdx : uniqueIdxs.entrySet()) {
+ if (uniqueIdxAsPk == null || uniqueIdxAsPk.getValue().size() > uniqueIdx.getValue().size())
+ uniqueIdxAsPk = uniqueIdx;
+ }
+
+ return uniqueIdxAsPk;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
index dcfd9c0..031e3a7 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
@@ -23,8 +23,8 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashSet;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -140,13 +140,45 @@ public class JdbcMetadataDialect extends DatabaseMetadataDialect {
if (sys.contains(schema))
continue;
- Collection<String> pkCols = new HashSet<>();
+ Collection<String> pkCols = new LinkedHashSet<>();
try (ResultSet pkRs = dbMeta.getPrimaryKeys(tblCatalog, tblSchema, tblName)) {
while (pkRs.next())
pkCols.add(pkRs.getString(PK_COL_NAME_IDX));
}
+ Map.Entry<String, Set<String>> uniqueIdxAsPk = null;
+
+ // If PK not found, trying to use first UNIQUE index as key.
+ if (pkCols.isEmpty()) {
+ Map<String, Set<String>> uniqueIdxs = new LinkedHashMap<>();
+
+ try (ResultSet idxRs = dbMeta.getIndexInfo(tblCatalog, tblSchema, tblName, true, true)) {
+ while (idxRs.next()) {
+ String idxName = idxRs.getString(IDX_NAME_IDX);
+ String colName = idxRs.getString(IDX_COL_NAME_IDX);
+
+ if (idxName == null || colName == null)
+ continue;
+
+ Set<String> idxCols = uniqueIdxs.get(idxName);
+
+ if (idxCols == null) {
+ idxCols = new LinkedHashSet<>();
+
+ uniqueIdxs.put(idxName, idxCols);
+ }
+
+ idxCols.add(colName);
+ }
+ }
+
+ uniqueIdxAsPk = uniqueIndexAsPk(uniqueIdxs);
+
+ if (uniqueIdxAsPk != null)
+ pkCols.addAll(uniqueIdxAsPk.getValue());
+ }
+
Collection<DbColumn> cols = new ArrayList<>();
try (ResultSet colsRs = dbMeta.getColumns(tblCatalog, tblSchema, tblName, null)) {
@@ -162,15 +194,17 @@ public class JdbcMetadataDialect extends DatabaseMetadataDialect {
}
}
+ String uniqueIdxAsPkName = uniqueIdxAsPk != null ? uniqueIdxAsPk.getKey() : null;
+
Map<String, QueryIndex> idxs = new LinkedHashMap<>();
try (ResultSet idxRs = dbMeta.getIndexInfo(tblCatalog, tblSchema, tblName, false, true)) {
while (idxRs.next()) {
String idxName = idxRs.getString(IDX_NAME_IDX);
-
String colName = idxRs.getString(IDX_COL_NAME_IDX);
- if (idxName == null || colName == null)
+ // Skip {@code null} names and unique index used as PK.
+ if (idxName == null || colName == null || idxName.equals(uniqueIdxAsPkName))
continue;
QueryIndex idx = idxs.get(idxName);
http://git-wip-us.apache.org/repos/asf/ignite/blob/8de8fe50/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java
index 1722948..6d12c81 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java
@@ -28,6 +28,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -61,21 +62,36 @@ import static java.sql.Types.VARCHAR;
public class OracleMetadataDialect extends DatabaseMetadataDialect {
/** SQL to get columns metadata. */
private static final String SQL_COLUMNS = "SELECT a.owner, a.table_name, a.column_name, a.nullable," +
- " a.data_type, a.data_precision, a.data_scale " +
- "FROM all_tab_columns a %s " +
+ " a.data_type, a.data_precision, a.data_scale" +
+ " FROM all_tab_columns a %s" +
" %s " +
" ORDER BY a.owner, a.table_name, a.column_id";
/** SQL to get list of PRIMARY KEYS columns. */
private static final String SQL_PRIMARY_KEYS = "SELECT b.column_name" +
" FROM all_constraints a" +
- " INNER JOIN all_cons_columns b ON a.owner = b.owner AND a.constraint_name = b.constraint_name" +
+ " INNER JOIN all_cons_columns b" +
+ " ON a.owner = b.owner" +
+ " AND a.constraint_name = b.constraint_name" +
" WHERE a.owner = ? and a.table_name = ? AND a.constraint_type = 'P'";
+ /** SQL to get list of UNIQUE INDEX columns. */
+ private static final String SQL_UNIQUE_INDEXES_KEYS = "SELECT a.index_name, b.column_name" +
+ " FROM all_indexes a" +
+ " INNER JOIN all_ind_columns b" +
+ " ON a.index_name = b.index_name" +
+ " AND a.table_owner = b.table_owner" +
+ " AND a.table_name = b.table_name" +
+ " AND a.owner = b.index_owner" +
+ " WHERE a.owner = ? AND a.table_name = ? AND a.uniqueness = 'UNIQUE'" +
+ " ORDER BY b.column_position";
+
/** SQL to get indexes metadata. */
private static final String SQL_INDEXES = "SELECT i.index_name, u.column_expression, i.column_name, i.descend" +
" FROM all_ind_columns i" +
- " LEFT JOIN user_ind_expressions u on u.index_name = i.index_name and i.table_name = u.table_name" +
+ " LEFT JOIN user_ind_expressions u" +
+ " ON u.index_name = i.index_name" +
+ " AND i.table_name = u.table_name" +
" WHERE i.index_owner = ? and i.table_name = ?" +
" ORDER BY i.index_name, i.column_position";
@@ -100,6 +116,12 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
/** Numeric scale index. */
private static final int DATA_SCALE_IDX = 7;
+ /** Unique index name index. */
+ private static final int UNQ_IDX_NAME_IDX = 1;
+
+ /** Unique index column name index. */
+ private static final int UNQ_IDX_COL_NAME_IDX = 2;
+
/** Index name index. */
private static final int IDX_NAME_IDX = 1;
@@ -114,9 +136,9 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
/** {@inheritDoc} */
@Override public Set<String> systemSchemas() {
- return new HashSet<>(Arrays.asList("ANONYMOUS", "CTXSYS", "DBSNMP", "EXFSYS", "LBACSYS", "MDSYS", "MGMT_VIEW",
- "OLAPSYS", "OWBSYS", "ORDPLUGINS", "ORDSYS", "OUTLN", "SI_INFORMTN_SCHEMA", "SYS", "SYSMAN", "SYSTEM",
- "TSMSYS", "WK_TEST", "WKSYS", "WKPROXY", "WMSYS", "XDB",
+ return new HashSet<>(Arrays.asList("ANONYMOUS", "APPQOSSYS", "CTXSYS", "DBSNMP", "EXFSYS", "LBACSYS", "MDSYS",
+ "MGMT_VIEW", "OLAPSYS", "OWBSYS", "ORDPLUGINS", "ORDSYS", "OUTLN", "SI_INFORMTN_SCHEMA", "SYS", "SYSMAN",
+ "SYSTEM", "TSMSYS", "WK_TEST", "WKSYS", "WKPROXY", "WMSYS", "XDB",
"APEX_040000", "APEX_PUBLIC_USER", "DIP", "FLOWS_30000", "FLOWS_FILES", "MDDATA", "ORACLE_OCM",
"SPATIAL_CSW_ADMIN_USR", "SPATIAL_WFS_ADMIN_USR", "XS$NULL",
@@ -235,11 +257,11 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
* @throws SQLException If failed to retrieve primary key columns.
*/
private Set<String> primaryKeys(PreparedStatement stmt, String owner, String tbl) throws SQLException {
- Set<String> pkCols = new HashSet<>();
-
stmt.setString(1, owner);
stmt.setString(2, tbl);
+ Set<String> pkCols = new LinkedHashSet<>();
+
try (ResultSet pkRs = stmt.executeQuery()) {
while(pkRs.next())
pkCols.add(pkRs.getString(1));
@@ -249,24 +271,64 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
}
/**
+ * Retrieve unique indexes with columns.
+ *
+ * @param stmt Prepared SQL statement to execute.
+ * @param owner DB owner.
+ * @param tbl Table name.
+ * @return Unique indexes.
+ * @throws SQLException If failed to retrieve unique indexes columns.
+ */
+ private Map<String, Set<String>> uniqueIndexes(PreparedStatement stmt, String owner, String tbl) throws SQLException {
+ stmt.setString(1, owner);
+ stmt.setString(2, tbl);
+
+ Map<String, Set<String>> uniqueIdxs = new LinkedHashMap<>();
+
+ try (ResultSet idxsRs = stmt.executeQuery()) {
+ while (idxsRs.next()) {
+ String idxName = idxsRs.getString(UNQ_IDX_NAME_IDX);
+ String colName = idxsRs.getString(UNQ_IDX_COL_NAME_IDX);
+
+ Set<String> idxCols = uniqueIdxs.get(idxName);
+
+ if (idxCols == null) {
+ idxCols = new LinkedHashSet<>();
+
+ uniqueIdxs.put(idxName, idxCols);
+ }
+
+ idxCols.add(colName);
+ }
+ }
+
+ return uniqueIdxs;
+ }
+
+ /**
* Retrieve index columns.
*
* @param stmt Prepared SQL statement to execute.
* @param owner DB owner.
* @param tbl Table name.
+ * @param uniqueIdxAsPk Optional unique index that used as PK.
* @return Indexes.
* @throws SQLException If failed to retrieve indexes columns.
*/
- private Collection<QueryIndex> indexes(PreparedStatement stmt, String owner, String tbl) throws SQLException {
- Map<String, QueryIndex> idxs = new LinkedHashMap<>();
-
+ private Collection<QueryIndex> indexes(PreparedStatement stmt, String owner, String tbl, String uniqueIdxAsPk) throws SQLException {
stmt.setString(1, owner);
stmt.setString(2, tbl);
+ Map<String, QueryIndex> idxs = new LinkedHashMap<>();
+
try (ResultSet idxsRs = stmt.executeQuery()) {
while (idxsRs.next()) {
String idxName = idxsRs.getString(IDX_NAME_IDX);
+ // Skip unique index used as PK.
+ if (idxName.equals(uniqueIdxAsPk))
+ continue;
+
QueryIndex idx = idxs.get(idxName);
if (idx == null) {
@@ -287,12 +349,9 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
}
/** {@inheritDoc} */
- @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly)
- throws SQLException {
- Collection<DbTable> tbls = new ArrayList<>();
-
+ @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly) throws SQLException {
PreparedStatement pkStmt = conn.prepareStatement(SQL_PRIMARY_KEYS);
-
+ PreparedStatement uniqueIdxsStmt = conn.prepareStatement(SQL_UNIQUE_INDEXES_KEYS);
PreparedStatement idxStmt = conn.prepareStatement(SQL_INDEXES);
if (schemas.isEmpty())
@@ -300,16 +359,13 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
Set<String> sysSchemas = systemSchemas();
+ Collection<DbTable> tbls = new ArrayList<>();
+
try (Statement colsStmt = conn.createStatement()) {
for (String schema: schemas) {
if (systemSchemas().contains(schema) || (schema != null && schema.startsWith("FLOWS_")))
continue;
- Collection<DbColumn> cols = new ArrayList<>();
-
- Set<String> pkCols = Collections.emptySet();
- Collection<QueryIndex> idxs = Collections.emptyList();
-
String sql = String.format(SQL_COLUMNS,
tblsOnly ? "INNER JOIN all_tables b on a.table_name = b.table_name and a.owner = b.owner" : "",
schema != null ? String.format(" WHERE a.owner = '%s' ", schema) : "");
@@ -320,6 +376,10 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
boolean first = true;
+ Set<String> pkCols = Collections.emptySet();
+ Collection<DbColumn> cols = new ArrayList<>();
+ Collection<QueryIndex> idxs = Collections.emptyList();
+
while (colsRs.next()) {
String owner = colsRs.getString(OWNER_IDX);
String tbl = colsRs.getString(TBL_NAME_IDX);
@@ -339,7 +399,17 @@ public class OracleMetadataDialect extends DatabaseMetadataDialect {
prevTbl = tbl;
cols = new ArrayList<>();
pkCols = primaryKeys(pkStmt, owner, tbl);
- idxs = indexes(idxStmt, owner, tbl);
+
+ Map.Entry<String, Set<String>> uniqueIdxAsPk = null;
+
+ if (pkCols.isEmpty()) {
+ uniqueIdxAsPk = uniqueIndexAsPk(uniqueIndexes(uniqueIdxsStmt, owner, tbl));
+
+ if (uniqueIdxAsPk != null)
+ pkCols.addAll(uniqueIdxAsPk.getValue());
+ }
+
+ idxs = indexes(idxStmt, owner, tbl, uniqueIdxAsPk != null ? uniqueIdxAsPk.getKey() : null);
}
String colName = colsRs.getString(COL_NAME_IDX);
[08/39] ignite git commit: IGNITE-5075 CacheConfiguration.groupName:
update javadoc
Posted by sb...@apache.org.
IGNITE-5075 CacheConfiguration.groupName: update javadoc
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0a6b44ce
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0a6b44ce
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0a6b44ce
Branch: refs/heads/ignite-5272
Commit: 0a6b44cee31084f35591f3a4d28c69d68ebeb857
Parents: d2efe78
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Jun 7 19:46:54 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Jun 7 19:46:54 2017 +0300
----------------------------------------------------------------------
.../configuration/CacheConfiguration.java | 24 ++++++++++++++++++++
1 file changed, 24 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a6b44ce/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 67b7590..6e0836e 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -459,6 +459,18 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
}
/**
+ * Gets the cache group name.
+ *
+ * Caches with the same group name share single underlying 'physical' cache (partition set),
+ * but are logically isolated.
+ *
+ * Since underlying cache is shared, the following configuration properties should be the same within group:
+ * {@link #setAffinity(AffinityFunction)}, {@link #setNodeFilter(IgnitePredicate)}, {@link #cacheMode},
+ * {@link #setTopologyValidator(TopologyValidator)}, {@link #setPartitionLossPolicy(PartitionLossPolicy)},
+ * {@link #setMemoryPolicyName(String)}.
+ *
+ * Grouping caches reduces overall overhead, since internal data structures are shared.
+ *
* @return Cache group name.
*/
public String getGroupName() {
@@ -466,6 +478,18 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
}
/**
+ * Sets the cache group name.
+ *
+ * Caches with the same group name share single underlying 'physical' cache (partition set),
+ * but are logically isolated.
+ *
+ * Since underlying cache is shared, the following configuration properties should be the same within group:
+ * {@link #setAffinity(AffinityFunction)}, {@link #setNodeFilter(IgnitePredicate)}, {@link #cacheMode},
+ * {@link #setTopologyValidator(TopologyValidator)}, {@link #setPartitionLossPolicy(PartitionLossPolicy)},
+ * {@link #setMemoryPolicyName(String)}.
+ *
+ * Grouping caches reduces overall overhead, since internal data structures are shared.
+ *
* @param grpName Cache group name.
* @return {@code this} for chaining.
*/
[16/39] ignite git commit: IGNITE-5450 .NET: Update
IDataStreamer.AllowOverwrite documentation
Posted by sb...@apache.org.
IGNITE-5450 .NET: Update IDataStreamer.AllowOverwrite documentation
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e238d563
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e238d563
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e238d563
Branch: refs/heads/ignite-5272
Commit: e238d563bf374489b34e6c719d10f580e4eb7b14
Parents: 612f5ad
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Jun 8 15:25:07 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Jun 8 15:25:07 2017 +0300
----------------------------------------------------------------------
.../dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e238d563/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
index d18040f..222f6c3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
@@ -86,7 +86,11 @@ namespace Apache.Ignite.Core.Datastream
string CacheName { get; }
/// <summary>
- /// Flag value indicating that this data streamer assumes that there could be concurrent updates to the cache.
+ /// Gets or sets a value indicating whether existing values can be overwritten by the data streamer.
+ /// Performance is better when this flag is false.
+ /// <para />
+ /// NOTE: When false, cache updates won't be propagated to cache store
+ /// (even if <see cref="SkipStore"/> is false).
/// <para />
/// Default is <c>false</c>.
/// </summary>
@@ -95,6 +99,8 @@ namespace Apache.Ignite.Core.Datastream
/// <summary>
/// Flag indicating that write-through behavior should be disabled for data loading.
/// <para />
+ /// <see cref="AllowOverwrite"/> must be true for write-through to work.
+ /// <para />
/// Default is <c>false</c>.
/// </summary>
bool SkipStore { get; set; }
[09/39] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5272
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-5272
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8288f304
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8288f304
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8288f304
Branch: refs/heads/ignite-5272
Commit: 8288f3040a9a303b02f7d91f1c62406873cd65c0
Parents: 1ef802e 0a6b44c
Author: sboikov <sb...@gridgain.com>
Authored: Thu Jun 8 09:54:10 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Jun 8 09:54:10 2017 +0300
----------------------------------------------------------------------
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 2 +
.../thin/JdbcThinAutoCloseServerCursorTest.java | 359 +++++++++++++++++++
.../jdbc/thin/JdbcThinConnectionSelfTest.java | 36 ++
.../configuration/CacheConfiguration.java | 24 ++
.../internal/binary/BinaryClassDescriptor.java | 1 -
.../internal/jdbc/thin/JdbcThinConnection.java | 4 +-
.../internal/jdbc/thin/JdbcThinResultSet.java | 18 +-
.../internal/jdbc/thin/JdbcThinStatement.java | 2 +-
.../internal/jdbc/thin/JdbcThinTcpIo.java | 17 +-
.../internal/jdbc/thin/JdbcThinUtils.java | 7 +-
.../query/jdbc/GridCacheQueryJdbcTask.java | 6 +-
.../processors/odbc/SqlListenerNioListener.java | 3 +-
.../processors/odbc/jdbc/JdbcQueryCursor.java | 9 +-
.../odbc/jdbc/JdbcRequestHandler.java | 21 +-
.../utils/PlatformConfigurationUtils.java | 86 +++++
.../processors/query/GridQueryProcessor.java | 2 +-
.../internal/processors/query/QueryUtils.java | 32 ++
.../query/h2/ddl/DdlStatementsProcessor.java | 23 +-
.../query/h2/sql/GridSqlQuerySplitter.java | 69 +++-
.../cache/index/H2DynamicTableSelfTest.java | 37 +-
.../query/IgniteSqlSplitterSelfTest.java | 47 +++
.../IgniteConfigurationSerializerTest.cs | 26 +-
.../IgniteConfigurationTest.cs | 56 +++
.../Apache.Ignite.Core.csproj | 2 +
.../Configuration/Package-Info.cs | 26 ++
.../Configuration/SqlConnectorConfiguration.cs | 159 ++++++++
.../Apache.Ignite.Core/IgniteConfiguration.cs | 164 +++++++++
.../IgniteConfigurationSection.xsd | 92 +++++
.../Common/IgniteConfigurationXmlSerializer.cs | 10 +
29 files changed, 1289 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
[02/39] ignite git commit: IGNITE-5430: CREATE TABLE: cache name is
now masked as follows: "SQL_[schemaName]_[cacheName]". This closes #2101.
Posted by sb...@apache.org.
IGNITE-5430: CREATE TABLE: cache name is now masked as follows: "SQL_[schemaName]_[cacheName]". This closes #2101.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8555e21e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8555e21e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8555e21e
Branch: refs/heads/ignite-5272
Commit: 8555e21e9063724e6f0a35862549c0b251d4d27b
Parents: 86d0049
Author: Alexander Paschenko <al...@gmail.com>
Authored: Wed Jun 7 14:16:47 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Jun 7 14:16:47 2017 +0300
----------------------------------------------------------------------
.../processors/query/GridQueryProcessor.java | 2 +-
.../internal/processors/query/QueryUtils.java | 32 +++++++++++++++++
.../query/h2/ddl/DdlStatementsProcessor.java | 23 +++++-------
.../cache/index/H2DynamicTableSelfTest.java | 37 +++++++++++++-------
4 files changed, 65 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8555e21e/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index edf8dc1..48c7229 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -1305,7 +1305,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
throw new SchemaOperationException("Template cache already contains query entities which it should not: " +
templateName);
- ccfg.setName(entity.getTableName());
+ ccfg.setName(QueryUtils.createTableCacheName(schemaName, entity.getTableName()));
if (atomicityMode != null)
ccfg.setAtomicityMode(atomicityMode);
http://git-wip-us.apache.org/repos/asf/ignite/blob/8555e21e/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
index fd498ad..fbd9afa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
@@ -1112,6 +1112,38 @@ public class QueryUtils {
}
/**
+ * Construct cache name for table.
+ *
+ * @param schemaName Schema name.
+ * @param tblName Table name.
+ * @return Cache name.
+ */
+ public static String createTableCacheName(String schemaName, String tblName) {
+ return "SQL_" + schemaName + "_" + tblName;
+ }
+
+ /**
+ * Construct value type name for table.
+ *
+ * @param schemaName Schema name.
+ * @param tblName Table name.
+ * @return Value type name.
+ */
+ public static String createTableValueTypeName(String schemaName, String tblName) {
+ return createTableCacheName(schemaName, tblName) + "_" + UUID.randomUUID().toString().replace("-", "_");
+ }
+
+ /**
+ * Construct key type name for table.
+ *
+ * @param valTypeName Value type name.
+ * @return Key type name.
+ */
+ public static String createTableKeyTypeName(String valTypeName) {
+ return valTypeName + "_KEY";
+ }
+
+ /**
* Private constructor.
*/
private QueryUtils() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/8555e21e/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index 251ee9f..5efc5c9 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -22,7 +22,6 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.QueryEntity;
@@ -191,6 +190,12 @@ public class DdlStatementsProcessor {
GridH2Table tbl = idx.dataTable(cmd.schemaName(), cmd.tableName());
+ if (tbl == null && cmd.ifExists()) {
+ ctx.cache().createMissingQueryCaches();
+
+ tbl = idx.dataTable(cmd.schemaName(), cmd.tableName());
+ }
+
if (tbl == null) {
if (!cmd.ifExists())
throw new SchemaOperationException(SchemaOperationException.CODE_TABLE_NOT_FOUND,
@@ -290,8 +295,8 @@ public class DdlStatementsProcessor {
res.addQueryField(e.getKey(), DataType.getTypeClassName(col.getType()), null);
}
- String valTypeName = valueType(createTbl.schemaName(), createTbl.tableName());
- String keyTypeName = valTypeName + "_Key";
+ String valTypeName = QueryUtils.createTableValueTypeName(createTbl.schemaName(), createTbl.tableName());
+ String keyTypeName = QueryUtils.createTableKeyTypeName(valTypeName);
res.setValueType(valTypeName);
res.setKeyType(keyTypeName);
@@ -302,18 +307,6 @@ public class DdlStatementsProcessor {
}
/**
- * Construct value type name for table.
- *
- * @param schemaName Schema name.
- * @param tblName Table name.
- * @return Value type name.
- */
- private static String valueType(String schemaName, String tblName) {
- return "sql_" + schemaName + "_" + tblName + "_" + UUID.randomUUID().toString().replace("-", "_");
- }
-
-
- /**
* @param cmd Statement.
* @return Whether {@code cmd} is a DDL statement we're able to handle.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/8555e21e/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index efb6cc8..699fdad 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -91,11 +91,8 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
- if (client().cache("Person") != null)
- executeDdl("DROP TABLE IF EXISTS PUBLIC.\"Person\"");
-
-
- executeDdl("DROP TABLE IF EXISTS PUBLIC.\"City\"");
+ executeDdl("DROP TABLE IF EXISTS PUBLIC.\"Person\"");
+ executeDdl("DROP TABLE IF EXISTS PUBLIC.\"City\"");
super.afterTest();
}
@@ -164,12 +161,14 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
" \"name\" varchar, \"surname\" varchar, \"age\" int, PRIMARY KEY (\"id\", \"city\")) WITH " +
(F.isEmpty(tplCacheName) ? "" : "\"template=" + tplCacheName + "\",") + "\"backups=10,atomicity=atomic\"");
+ String cacheName = cacheName("Person");
+
for (int i = 0; i < 4; i++) {
IgniteEx node = grid(i);
- assertNotNull(node.cache("Person"));
+ assertNotNull(node.cache(cacheName));
- DynamicCacheDescriptor cacheDesc = node.context().cache().cacheDescriptor("Person");
+ DynamicCacheDescriptor cacheDesc = node.context().cache().cacheDescriptor(cacheName);
assertNotNull(cacheDesc);
@@ -185,7 +184,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
if (mode != null)
assertEquals(mode, cacheDesc.cacheConfiguration().getCacheMode());
- QueryTypeDescriptorImpl desc = typeExisting(node, "Person", "Person");
+ QueryTypeDescriptorImpl desc = typeExisting(node, cacheName, "Person");
assertEquals(Object.class, desc.keyClass());
assertEquals(Object.class, desc.valueClass());
@@ -193,7 +192,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
assertTrue(desc.valueTypeName(), desc.valueTypeName().contains("Person"));
assertTrue(desc.keyTypeName(), desc.keyTypeName().startsWith(desc.valueTypeName()));
- assertTrue(desc.keyTypeName(), desc.keyTypeName().endsWith("Key"));
+ assertTrue(desc.keyTypeName(), desc.keyTypeName().endsWith("KEY"));
assertEquals(
F.asList("id", "city", "name", "surname", "age"),
@@ -352,12 +351,12 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
GridTestUtils.assertThrows(null, new Callable<Object>() {
@Override public Object call() throws Exception {
- client().destroyCache("Person");
+ client().destroyCache(cacheName("Person"));
return null;
}
}, CacheException.class,
- "Only cache created with cache API may be removed with direct call to destroyCache [cacheName=Person]");
+ "Only cache created with cache API may be removed with direct call to destroyCache");
}
/**
@@ -372,7 +371,9 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
GridTestUtils.assertThrows(null, new Callable<Object>() {
@Override public Object call() throws Exception {
- Ignition.start(clientConfiguration(5).setCacheConfiguration(new CacheConfiguration("Person")));
+ String cacheName = cacheName("Person");
+
+ Ignition.start(clientConfiguration(5).setCacheConfiguration(new CacheConfiguration(cacheName)));
return null;
}
@@ -397,7 +398,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
e.setKeyFields(Collections.singleton("name"));
e.setFields(new LinkedHashMap<>(Collections.singletonMap("name", String.class.getName())));
e.setIndexes(Collections.singleton(new QueryIndex("name").setName("idx")));
- e.setValueType("CityKey");
+ e.setKeyType("CityKey");
e.setValueType("City");
queryProcessor(client()).dynamicTableCreate("PUBLIC", e, CacheMode.PARTITIONED.name(),
@@ -621,4 +622,14 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
.setSqlSchema(QueryUtils.DFLT_SCHEMA)
.setNodeFilter(F.not(new DynamicIndexAbstractSelfTest.NodeFilter()));
}
+
+ /**
+ * Get cache name.
+ *
+ * @param tblName Table name.
+ * @return Cache name.
+ */
+ private static String cacheName(String tblName) {
+ return QueryUtils.createTableCacheName("PUBLIC", tblName);
+ }
}
[31/39] ignite git commit: IGNITE-5455 .NET: Fix binary hash code
calculation
Posted by sb...@apache.org.
IGNITE-5455 .NET: Fix binary hash code calculation
This closes #2108
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3c5ffd1a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3c5ffd1a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3c5ffd1a
Branch: refs/heads/ignite-5272
Commit: 3c5ffd1ac7556b99b64aed70aea58b2d90abc51a
Parents: 72e2f88
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Jun 9 18:58:44 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Jun 9 18:58:44 2017 +0300
----------------------------------------------------------------------
.../platform/PlatformComputeEchoTask.java | 4 +-
.../Binary/BinaryCompactFooterInteropTest.cs | 8 +-
.../Binary/BinaryDynamicRegistrationTest.cs | 7 +-
.../Cache/Query/CacheDmlQueriesTest.cs | 197 +++++++++++++++++--
.../Compute/ComputeApiTest.cs | 25 ++-
.../Impl/Binary/BinaryArrayEqualityComparer.cs | 6 +-
.../Impl/Binary/BinaryObjectHeader.cs | 8 +
7 files changed, 224 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c5ffd1a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
index 984cf62..12d9e09 100644
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
@@ -187,7 +187,9 @@ public class PlatformComputeEchoTask extends ComputeTaskAdapter<Integer, Object>
return new HashMap<>(Collections.singletonMap(1, 1));
case TYPE_BINARY:
- return new PlatformComputeBinarizable(1);
+ Integer field = (Integer) ignite.cache(DEFAULT_CACHE_NAME).get(TYPE_BINARY);
+
+ return new PlatformComputeBinarizable(field);
case TYPE_BINARY_JAVA:
return new PlatformComputeJavaBinarizable(1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c5ffd1a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
index 735cfff..6f97677 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
@@ -71,10 +71,12 @@ namespace Apache.Ignite.Core.Tests.Binary
try
{
- var fromJava = grid.GetCompute().ExecuteJavaTask<PlatformComputeBinarizable>(ComputeApiTest.EchoTask,
- ComputeApiTest.EchoTypeBinarizable);
+ grid.GetOrCreateCache<int, int>("default").Put(ComputeApiTest.EchoTypeBinarizable, i * 99);
- Assert.AreEqual(1, fromJava.Field);
+ var fromJava = grid.GetCompute().ExecuteJavaTask<PlatformComputeBinarizable>(
+ ComputeApiTest.EchoTask, ComputeApiTest.EchoTypeBinarizable);
+
+ Assert.AreEqual(i * 99, fromJava.Field);
return;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c5ffd1a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
index 927aa32..4f458f4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
@@ -316,18 +316,19 @@ namespace Apache.Ignite.Core.Tests.Binary
var cache = ignite.CreateCache<int, object>(cacheCfg);
// Force dynamic registration for .NET
- cache.Put(1, new PlatformComputeBinarizable {Field = 7});
+ cache.Put(-1, new PlatformComputeBinarizable {Field = 7});
+ cache.Put(ComputeApiTest.EchoTypeBinarizable, 255);
// Run Java code that will also perform dynamic registration
var fromJava = ignite.GetCompute().ExecuteJavaTask<PlatformComputeBinarizable>(ComputeApiTest.EchoTask,
ComputeApiTest.EchoTypeBinarizable);
// Check that objects are compatible
- Assert.AreEqual(1, fromJava.Field);
+ Assert.AreEqual(255, fromJava.Field);
// Check that Java can read what .NET has put
var qryRes = ignite.GetCompute().ExecuteJavaTask<IList>(
- BinaryCompactFooterInteropTest.PlatformSqlQueryTask, "Field < 10");
+ BinaryCompactFooterInteropTest.PlatformSqlQueryTask, "Field = 7");
Assert.AreEqual(7, qryRes.OfType<PlatformComputeBinarizable>().Single().Field);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c5ffd1a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
index d79844e..9d16799 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
@@ -18,11 +18,13 @@
// ReSharper disable UnusedAutoPropertyAccessor.Local
namespace Apache.Ignite.Core.Tests.Cache.Query
{
+ using System;
using System.Linq;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Cache.Query;
using Apache.Ignite.Core.Common;
+ using Apache.Ignite.Core.Impl.Binary;
using NUnit.Framework;
/// <summary>
@@ -38,7 +40,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
{
var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
{
- BinaryConfiguration = new BinaryConfiguration(typeof(Foo), typeof(Key), typeof(Key2))
+ // Type registration is required because we call DML first and cache.Get after.
+ BinaryConfiguration = new BinaryConfiguration(typeof(Foo), typeof(Key), typeof(Key2), typeof(KeyAll))
{
NameMapper = GetNameMapper()
}
@@ -100,33 +103,74 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
+ /// Tests all primitive key types.
+ /// </summary>
+ [Test]
+ public void TestPrimitiveKeyAllTypes()
+ {
+ TestKey(byte.MinValue, byte.MaxValue);
+ TestKey(sbyte.MinValue, sbyte.MaxValue);
+ TestKey(short.MinValue, short.MaxValue);
+ TestKey(int.MinValue, int.MaxValue);
+ TestKey(uint.MinValue, uint.MaxValue);
+ TestKey(long.MinValue, long.MaxValue);
+ TestKey(ulong.MinValue, ulong.MaxValue);
+ TestKey(float.MinValue, float.MaxValue);
+ TestKey(double.MinValue, double.MaxValue);
+ TestKey(decimal.MinValue, decimal.MaxValue);
+ TestKey(Guid.NewGuid());
+ }
+
+ /// <summary>
+ /// Tests the key.
+ /// </summary>
+ private static void TestKey<T>(params T[] vals)
+ {
+ var cfg = new CacheConfiguration("primitive_key_dotnet_" + typeof(T),
+ new QueryEntity(typeof(T), typeof(string)));
+ var cache = Ignition.GetIgnite().CreateCache<T, string>(cfg);
+
+ foreach (var val in vals)
+ {
+ var res = cache.QueryFields(new SqlFieldsQuery(
+ "insert into string(_key, _val) values (?, ?)", val, val.ToString())).GetAll();
+
+ Assert.AreEqual(1, res.Count);
+ Assert.AreEqual(1, res[0].Count);
+ Assert.AreEqual(1, res[0][0]);
+
+ Assert.AreEqual(val.ToString(), cache[val]);
+ }
+ }
+
+ /// <summary>
/// Tests composite key (which requires QueryField.IsKeyField).
/// </summary>
[Test]
- public void TestCompositeKeyArrayEquality()
+ public void TestCompositeKey()
{
var cfg = new CacheConfiguration("composite_key_arr", new QueryEntity(typeof(Key), typeof(Foo)));
var cache = Ignition.GetIgnite().CreateCache<Key, Foo>(cfg);
// Test insert.
var res = cache.QueryFields(new SqlFieldsQuery("insert into foo(hi, lo, id, name) " +
- "values (1, 2, 3, 'John'), (4, 5, 6, 'Mary')")).GetAll();
+ "values (-1, 65500, 3, 'John'), (255, 128, 6, 'Mary')")).GetAll();
Assert.AreEqual(1, res.Count);
Assert.AreEqual(1, res[0].Count);
Assert.AreEqual(2, res[0][0]); // 2 affected rows
- var foos = cache.OrderBy(x => x.Key.Lo).ToArray();
+ var foos = cache.OrderByDescending(x => x.Key.Lo).ToArray();
Assert.AreEqual(2, foos.Length);
- Assert.AreEqual(1, foos[0].Key.Hi);
- Assert.AreEqual(2, foos[0].Key.Lo);
+ Assert.AreEqual(-1, foos[0].Key.Hi);
+ Assert.AreEqual(65500, foos[0].Key.Lo);
Assert.AreEqual(3, foos[0].Value.Id);
Assert.AreEqual("John", foos[0].Value.Name);
- Assert.AreEqual(4, foos[1].Key.Hi);
- Assert.AreEqual(5, foos[1].Key.Lo);
+ Assert.AreEqual(255, foos[1].Key.Hi);
+ Assert.AreEqual(128, foos[1].Key.Lo);
Assert.AreEqual(6, foos[1].Value.Id);
Assert.AreEqual("Mary", foos[1].Value.Name);
@@ -134,33 +178,33 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
var binary = cache.Ignite.GetBinary();
var binCache = cache.WithKeepBinary<IBinaryObject, IBinaryObject>();
- Assert.IsTrue(cache.ContainsKey(new Key(2, 1)));
+ Assert.IsTrue(cache.ContainsKey(new Key(65500, -1)));
Assert.IsTrue(cache.ContainsKey(foos[0].Key));
Assert.IsTrue(binCache.ContainsKey(
- binary.GetBuilder(typeof(Key)).SetField("hi", 1).SetField("lo", 2).Build()));
+ binary.GetBuilder(typeof(Key)).SetField("hi", -1).SetField("lo", 65500).Build()));
Assert.IsTrue(binCache.ContainsKey( // Fields are sorted.
- binary.GetBuilder(typeof(Key)).SetField("lo", 2).SetField("hi", 1).Build()));
+ binary.GetBuilder(typeof(Key)).SetField("lo", 65500).SetField("hi", -1).Build()));
- Assert.IsTrue(cache.ContainsKey(new Key(5, 4)));
+ Assert.IsTrue(cache.ContainsKey(new Key(128, 255)));
Assert.IsTrue(cache.ContainsKey(foos[1].Key));
Assert.IsTrue(binCache.ContainsKey(
- binary.GetBuilder(typeof(Key)).SetField("hi", 4).SetField("lo", 5).Build()));
+ binary.GetBuilder(typeof(Key)).SetField("hi", 255).SetField("lo", 128).Build()));
Assert.IsTrue(binCache.ContainsKey( // Fields are sorted.
- binary.GetBuilder(typeof(Key)).SetField("lo", 5).SetField("hi", 4).Build()));
+ binary.GetBuilder(typeof(Key)).SetField("lo", 128).SetField("hi", 255).Build()));
}
/// <summary>
/// Tests composite key (which requires QueryField.IsKeyField).
/// </summary>
[Test]
- public void TestCompositeKeyFieldEquality()
+ public void TestCompositeKey2()
{
var cfg = new CacheConfiguration("composite_key_fld", new QueryEntity(typeof(Key2), typeof(Foo)));
var cache = Ignition.GetIgnite().CreateCache<Key2, Foo>(cfg);
// Test insert.
var res = cache.QueryFields(new SqlFieldsQuery("insert into foo(hi, lo, str, id, name) " +
- "values (1, 2, 'Foo', 3, 'John'), (4, 5, 'Bar', 6, 'Mary')")).GetAll();
+ "values (1, 2, 'Фу', 3, 'John'), (4, 5, 'Бар', 6, 'Mary')")).GetAll();
Assert.AreEqual(1, res.Count);
Assert.AreEqual(1, res[0].Count);
@@ -172,21 +216,21 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
Assert.AreEqual(1, foos[0].Key.Hi);
Assert.AreEqual(2, foos[0].Key.Lo);
- Assert.AreEqual("Foo", foos[0].Key.Str);
+ Assert.AreEqual("Фу", foos[0].Key.Str);
Assert.AreEqual(3, foos[0].Value.Id);
Assert.AreEqual("John", foos[0].Value.Name);
Assert.AreEqual(4, foos[1].Key.Hi);
Assert.AreEqual(5, foos[1].Key.Lo);
- Assert.AreEqual("Bar", foos[1].Key.Str);
+ Assert.AreEqual("Бар", foos[1].Key.Str);
Assert.AreEqual(6, foos[1].Value.Id);
Assert.AreEqual("Mary", foos[1].Value.Name);
// Existence tests check that hash codes are consistent.
- Assert.IsTrue(cache.ContainsKey(new Key2(2, 1, "Foo")));
+ Assert.IsTrue(cache.ContainsKey(new Key2(2, 1, "Фу")));
Assert.IsTrue(cache.ContainsKey(foos[0].Key));
- Assert.IsTrue(cache.ContainsKey(new Key2(5, 4, "Bar")));
+ Assert.IsTrue(cache.ContainsKey(new Key2(5, 4, "Бар")));
Assert.IsTrue(cache.ContainsKey(foos[1].Key));
}
@@ -254,6 +298,59 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
}
/// <summary>
+ /// Tests the composite key with fields of all data types.
+ /// </summary>
+ [Test]
+ public void TestCompositeKeyAllDataTypes()
+ {
+ var cfg = new CacheConfiguration("composite_key_all", new QueryEntity(typeof(KeyAll), typeof(string)));
+ var cache = Ignition.GetIgnite().CreateCache<KeyAll, string>(cfg);
+
+ var key = new KeyAll
+ {
+ Byte = byte.MaxValue,
+ SByte = sbyte.MaxValue,
+ Short = short.MaxValue,
+ UShort = ushort.MaxValue,
+ Int = int.MaxValue,
+ UInt = uint.MaxValue,
+ Long = long.MaxValue,
+ ULong = ulong.MaxValue,
+ Float = float.MaxValue,
+ Double = double.MaxValue,
+ Decimal = decimal.MaxValue,
+ Guid = Guid.NewGuid(),
+ String = "привет",
+ Key = new Key(255, 65555)
+ };
+
+ // Test insert.
+ var res = cache.QueryFields(new SqlFieldsQuery(
+ "insert into string(byte, sbyte, short, ushort, int, uint, long, ulong, float, double, decimal, " +
+ "guid, string, key, _val) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
+ key.Byte, key.SByte, key.Short, key.UShort, key.Int, key.UInt, key.Long, key.ULong, key.Float,
+ key.Double, key.Decimal, key.Guid, key.String, key.Key, "VALUE"))
+ .GetAll();
+
+ Assert.AreEqual(1, res.Count);
+ Assert.AreEqual(1, res[0].Count);
+ Assert.AreEqual(1, res[0][0]);
+
+ // Compare resulting keys.
+ Assert.AreEqual(key, cache.Single().Key);
+
+ // Compare keys in binary form.
+ var binKey = cache.Ignite.GetBinary().ToBinary<BinaryObject>(key);
+ var binKeyRes = cache.WithKeepBinary<BinaryObject, string>().Single().Key;
+
+ Assert.AreEqual(binKey.Header, binKeyRes.Header);
+ Assert.AreEqual(binKey, binKeyRes);
+
+ // Get by key to verify identity.
+ Assert.AreEqual("VALUE", cache[key]);
+ }
+
+ /// <summary>
/// Key.
/// </summary>
private struct Key
@@ -293,5 +390,65 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
[QuerySqlField] public int Id { get; set; }
[QuerySqlField] public string Name { get; set; }
}
+
+ /// <summary>
+ /// Key with all kinds of fields.
+ /// </summary>
+ private class KeyAll
+ {
+ [QuerySqlField] public byte Byte { get; set; }
+ [QuerySqlField] public sbyte SByte { get; set; }
+ [QuerySqlField] public short Short { get; set; }
+ [QuerySqlField] public ushort UShort { get; set; }
+ [QuerySqlField] public int Int { get; set; }
+ [QuerySqlField] public uint UInt { get; set; }
+ [QuerySqlField] public long Long { get; set; }
+ [QuerySqlField] public ulong ULong { get; set; }
+ [QuerySqlField] public float Float { get; set; }
+ [QuerySqlField] public double Double { get; set; }
+ [QuerySqlField] public decimal Decimal { get; set; }
+ [QuerySqlField] public Guid Guid { get; set; }
+ [QuerySqlField] public string String { get; set; }
+ [QuerySqlField] public Key Key { get; set; }
+
+ private bool Equals(KeyAll other)
+ {
+ return Byte == other.Byte && SByte == other.SByte && Short == other.Short &&
+ UShort == other.UShort && Int == other.Int && UInt == other.UInt && Long == other.Long &&
+ ULong == other.ULong && Float.Equals(other.Float) && Double.Equals(other.Double) &&
+ Decimal == other.Decimal && Guid.Equals(other.Guid) && string.Equals(String, other.String) &&
+ Key.Equals(other.Key);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != GetType()) return false;
+ return Equals((KeyAll) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ var hashCode = Byte.GetHashCode();
+ hashCode = (hashCode * 397) ^ SByte.GetHashCode();
+ hashCode = (hashCode * 397) ^ Short.GetHashCode();
+ hashCode = (hashCode * 397) ^ UShort.GetHashCode();
+ hashCode = (hashCode * 397) ^ Int;
+ hashCode = (hashCode * 397) ^ (int) UInt;
+ hashCode = (hashCode * 397) ^ Long.GetHashCode();
+ hashCode = (hashCode * 397) ^ ULong.GetHashCode();
+ hashCode = (hashCode * 397) ^ Float.GetHashCode();
+ hashCode = (hashCode * 397) ^ Double.GetHashCode();
+ hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
+ hashCode = (hashCode * 397) ^ Guid.GetHashCode();
+ hashCode = (hashCode * 397) ^ String.GetHashCode();
+ hashCode = (hashCode * 397) ^ Key.GetHashCode();
+ return hashCode;
+ }
+ }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c5ffd1a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index 0c6d20e..5427d3d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -30,6 +30,7 @@ namespace Apache.Ignite.Core.Tests.Compute
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Compute;
using Apache.Ignite.Core.Impl;
+ using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Resource;
using NUnit.Framework;
@@ -875,9 +876,29 @@ namespace Apache.Ignite.Core.Tests.Compute
[Test]
public void TestEchoTaskBinarizable()
{
- var res = _grid1.GetCompute().ExecuteJavaTask<PlatformComputeBinarizable>(EchoTask, EchoTypeBinarizable);
+ var values = new[] {int.MinValue, int.MaxValue, 0, 1, -1, byte.MaxValue, byte.MinValue};
+ var cache = _grid1.GetCache<int, int>(DefaultCacheName);
+ var compute = _grid1.GetCompute();
- Assert.AreEqual(1, res.Field);
+ foreach (var val in values)
+ {
+ cache[EchoTypeBinarizable] = val;
+
+ var res = compute.ExecuteJavaTask<PlatformComputeBinarizable>(EchoTask, EchoTypeBinarizable);
+ Assert.AreEqual(val, res.Field);
+
+ // Binary mode.
+ var binRes = compute.WithKeepBinary().ExecuteJavaTask<BinaryObject>(EchoTask, EchoTypeBinarizable);
+
+ Assert.AreEqual(val, binRes.GetField<long>("Field"));
+
+ var dotNetBin = _grid1.GetBinary().ToBinary<BinaryObject>(res);
+
+ Assert.AreEqual(dotNetBin.Header.HashCode, binRes.Header.HashCode);
+
+ Func<BinaryObject, byte[]> getData = bo => bo.Data.Skip(bo.Offset).Take(bo.Header.Length).ToArray();
+ Assert.AreEqual(getData(dotNetBin), getData(binRes));
+ }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c5ffd1a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryArrayEqualityComparer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryArrayEqualityComparer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryArrayEqualityComparer.cs
index 8ba409b..d969b8f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryArrayEqualityComparer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryArrayEqualityComparer.cs
@@ -146,11 +146,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public unsafe int Invoke(byte* data, KeyValuePair<int, int> arg)
{
- var hash = 1;
- var ptr = data + arg.Key;
+ int hash = 1;
+ sbyte* ptr = (sbyte*) (data + arg.Key);
for (var i = 0; i < arg.Value; i++)
+ {
hash = 31 * hash + *(ptr + i);
+ }
return hash;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3c5ffd1a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
index 0f0fafe..d7dd74d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectHeader.cs
@@ -357,5 +357,13 @@ namespace Apache.Ignite.Core.Impl.Binary
{
return !left.Equals(right);
}
+
+ /** <inheritdoc /> */
+ public override string ToString()
+ {
+ return string.Format("BinaryObjectHeader [Header={0}, Version={1}, Flags={2}, TypeId={3}, " +
+ "HashCode={4}, Length={5}, SchemaId={6}, SchemaOffset={7}]",
+ Header, Version, Flags, TypeId, HashCode, Length, SchemaId, SchemaOffset);
+ }
}
}
[19/39] ignite git commit: Fixed test compilation.
Posted by sb...@apache.org.
Fixed test compilation.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f03ecba3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f03ecba3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f03ecba3
Branch: refs/heads/ignite-5272
Commit: f03ecba3c9351dea56794fcb829b4b1142f726a2
Parents: 6cc5f18
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Thu Jun 8 20:45:26 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Thu Jun 8 20:45:26 2017 +0700
----------------------------------------------------------------------
.../integration/ClientTcpUnreachableMultiNodeSelfTest.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f03ecba3/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
index e70df53..362b978 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
@@ -120,6 +120,10 @@ public class ClientTcpUnreachableMultiNodeSelfTest extends ClientTcpMultiNodeSel
@Override public boolean connectable() {
return node.connectable();
}
+
+ @Override public long order() {
+ return node.order();
+ }
};
}
@@ -135,4 +139,4 @@ public class ClientTcpUnreachableMultiNodeSelfTest extends ClientTcpMultiNodeSel
((GridClientTopologyListener)b).onNodeRemoved(node);
}
}
-}
\ No newline at end of file
+}
[17/39] ignite git commit: Web Console: Added yarn.lock to gitignore.
Posted by sb...@apache.org.
Web Console: Added yarn.lock to gitignore.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0a0ddbc0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0a0ddbc0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0a0ddbc0
Branch: refs/heads/ignite-5272
Commit: 0a0ddbc01fb70cce248aa75431b18f8206885a59
Parents: e238d56
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Jun 8 19:39:51 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Jun 8 19:39:51 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/.gitignore | 1 +
modules/web-console/frontend/.gitignore | 1 +
2 files changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a0ddbc0/modules/web-console/backend/.gitignore
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/.gitignore b/modules/web-console/backend/.gitignore
index 1074aff..08090a1 100644
--- a/modules/web-console/backend/.gitignore
+++ b/modules/web-console/backend/.gitignore
@@ -4,3 +4,4 @@
node_modules
agent_dists/*.zip
config/*.json
+yarn.lock
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a0ddbc0/modules/web-console/frontend/.gitignore
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/.gitignore b/modules/web-console/frontend/.gitignore
index 296d61c..1439664 100644
--- a/modules/web-console/frontend/.gitignore
+++ b/modules/web-console/frontend/.gitignore
@@ -5,3 +5,4 @@
build/*
node_modules
public/stylesheets/*.css
+yarn.lock
[14/39] ignite git commit: IGNITE-5075: Fix to Yardstick in for cache
groups.
Posted by sb...@apache.org.
IGNITE-5075: Fix to Yardstick in for cache groups.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c73aad7c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c73aad7c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c73aad7c
Branch: refs/heads/ignite-5272
Commit: c73aad7c0b7960bf41e64f60a7342fef13fb301e
Parents: 45bb5b3
Author: devozerov <vo...@gridgain.com>
Authored: Thu Jun 8 13:58:27 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jun 8 13:58:27 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/yardstick/cache/load/model/ModelUtil.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c73aad7c/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
index 492ace7..eb945a0 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
@@ -38,6 +38,7 @@ public class ModelUtil {
* Classes of keys.
*/
private static Class[] keyClasses = {
+ Integer.class,
Double.class,
Identifier.class,
Mark.class,
[18/39] ignite git commit: Clients / REST: added node order to
GridClientNode / GridClientNodeBean.
Posted by sb...@apache.org.
Clients / REST: added node order to GridClientNode / GridClientNodeBean.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6cc5f18a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6cc5f18a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6cc5f18a
Branch: refs/heads/ignite-5272
Commit: 6cc5f18a9a8da1c741a9728091fdb5988183af81
Parents: 0a0ddbc
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Thu Jun 8 19:41:19 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Thu Jun 8 19:41:19 2017 +0700
----------------------------------------------------------------------
.../ignite/internal/client/GridClientNode.java | 9 ++++++-
.../client/impl/GridClientNodeImpl.java | 22 ++++++++++++++++-
.../connection/GridClientNioTcpConnection.java | 3 ++-
.../rest/client/message/GridClientNodeBean.java | 25 ++++++++++++++++++++
.../top/GridTopologyCommandHandler.java | 1 +
5 files changed, 57 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
index be8053b..1df1c21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
@@ -119,4 +119,11 @@ public interface GridClientNode {
* {@code false} if request may be passed through a router.
*/
public boolean connectable();
-}
\ No newline at end of file
+
+ /**
+ * Node order within grid topology.
+ *
+ * @return Node startup order.
+ */
+ public long order();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
index ac0866b..a4b659b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
@@ -66,6 +66,9 @@ public class GridClientNodeImpl implements GridClientNode {
/** Cache for REST TCP socket addresses. */
private final AtomicReference<Collection<InetSocketAddress>> tcpSockAddrs = new AtomicReference<>();
+ /** Node order within grid topology */
+ private long order;
+
/**
* Default constructor (private).
*/
@@ -99,7 +102,8 @@ public class GridClientNodeImpl implements GridClientNode {
.tcpAddresses(from.tcpAddresses())
.tcpPort(from.tcpPort())
.caches(from.caches())
- .connectable(from.connectable());
+ .connectable(from.connectable())
+ .order(from.order());
if (!skipAttrs)
b.attributes(from.attributes());
@@ -186,6 +190,11 @@ public class GridClientNodeImpl implements GridClientNode {
return filterIfNecessary(addrs0, filterResolved);
}
+ /** {@inheritDoc} */
+ public long order() {
+ return order;
+ }
+
/**
* Filters sockets with resolved addresses.
*
@@ -377,5 +386,16 @@ public class GridClientNodeImpl implements GridClientNode {
return this;
}
+
+ /**
+ * Set node order within grid topology
+ *
+ * @param order Node order within grid topology
+ */
+ public Builder order(long order) {
+ impl.order = order;
+
+ return this;
+ }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
index 75fa315..18ce6e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
@@ -946,7 +946,8 @@ public class GridClientNioTcpConnection extends GridClientConnection {
.nodeId(nodeBean.getNodeId())
.consistentId(nodeBean.getConsistentId())
.tcpAddresses(nodeBean.getTcpAddresses())
- .tcpPort(nodeBean.getTcpPort());
+ .tcpPort(nodeBean.getTcpPort())
+ .order(nodeBean.getOrder());
Map<String, GridClientCacheMode> caches = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
index f1848df..b4bdaa1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
@@ -60,6 +60,9 @@ public class GridClientNodeBean implements Externalizable {
/** Node caches. */
private Collection<GridClientCacheBean> caches;
+ /** Node order within grid topology. */
+ private long order;
+
/**
* Gets node ID.
*
@@ -200,6 +203,24 @@ public class GridClientNodeBean implements Externalizable {
this.tcpPort = tcpPort;
}
+ /**
+ * Node order within grid topology.
+ *
+ * @return Node startup order.
+ */
+ public long getOrder() {
+ return order;
+ }
+
+ /**
+ * Set node order within grid topology
+ *
+ * @param order Node order within grid topology
+ */
+ public void setOrder(long order) {
+ this.order = order;
+ }
+
/** {@inheritDoc} */
@Override public int hashCode() {
return nodeId != null ? nodeId.hashCode() : 0;
@@ -252,6 +273,8 @@ public class GridClientNodeBean implements Externalizable {
out.writeObject(String.valueOf(consistentId));
out.writeObject(metrics);
+
+ out.writeLong(order);
}
/** {@inheritDoc} */
@@ -287,6 +310,8 @@ public class GridClientNodeBean implements Externalizable {
consistentId = in.readObject();
metrics = (GridClientNodeMetricsBean)in.readObject();
+
+ order = in.readLong();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
index fa677c7..b773e16 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
@@ -211,6 +211,7 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter {
nodeBean.setNodeId(node.id());
nodeBean.setConsistentId(node.consistentId());
nodeBean.setTcpPort(attribute(node, ATTR_REST_TCP_PORT, 0));
+ nodeBean.setOrder(node.order());
nodeBean.setTcpAddresses(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_ADDRS)));
nodeBean.setTcpHostNames(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_HOST_NAMES)));
[10/39] ignite git commit: IGNITE-5188: CREATE TABLE: added affinity
key support. This closes #2097.
Posted by sb...@apache.org.
IGNITE-5188: CREATE TABLE: added affinity key support. This closes #2097.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bd5065b1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bd5065b1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bd5065b1
Branch: refs/heads/ignite-5272
Commit: bd5065b1b1a4babf7cd882b9753700e7a58a6094
Parents: 0a6b44c
Author: Alexander Paschenko <al...@gmail.com>
Authored: Thu Jun 8 12:07:38 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Jun 8 12:07:38 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 1 -
.../ignite/internal/binary/BinaryFieldEx.java | 5 +
.../ignite/internal/binary/BinaryFieldImpl.java | 5 +
.../query/DynamicTableAffinityKeyMapper.java | 92 ++++++++++
.../processors/query/GridQueryProcessor.java | 52 +++---
.../internal/processors/query/QueryUtils.java | 19 ++-
.../query/h2/ddl/DdlStatementsProcessor.java | 2 +-
.../processors/query/h2/opt/GridH2Table.java | 5 +-
.../query/h2/sql/GridSqlCreateTable.java | 17 ++
.../query/h2/sql/GridSqlQueryParser.java | 44 +++++
.../cache/index/H2DynamicTableSelfTest.java | 170 ++++++++++++++++++-
11 files changed, 375 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 70bc2f9..be02ba1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -116,7 +116,6 @@ import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.marshaller.MarshallerContext;
import org.apache.ignite.marshaller.MarshallerUtils;
-import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldEx.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldEx.java
index 42aa282..c998022 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldEx.java
@@ -26,6 +26,11 @@ import org.apache.ignite.binary.BinaryObject;
*/
public interface BinaryFieldEx extends BinaryField {
/**
+ * @return Type ID this field relates to.
+ */
+ public int typeId();
+
+ /**
* Writes field value to the given byte buffer.
*
* @param obj Object from which the field should be extracted.
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldImpl.java
index c318397..59bd03d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryFieldImpl.java
@@ -109,6 +109,11 @@ public class BinaryFieldImpl implements BinaryFieldEx {
}
/** {@inheritDoc} */
+ @Override public int typeId() {
+ return typeId;
+ }
+
+ /** {@inheritDoc} */
@Override public boolean writeField(BinaryObject obj, ByteBuffer buf) {
BinaryObjectExImpl obj0 = (BinaryObjectExImpl)obj;
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DynamicTableAffinityKeyMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DynamicTableAffinityKeyMapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DynamicTableAffinityKeyMapper.java
new file mode 100644
index 0000000..e49341a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/DynamicTableAffinityKeyMapper.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.query;
+
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryType;
+import org.apache.ignite.cache.affinity.AffinityKeyMapper;
+import org.apache.ignite.internal.binary.BinaryFieldEx;
+import org.apache.ignite.internal.binary.BinaryObjectEx;
+import org.apache.ignite.internal.util.typedef.F;
+
+/**
+ * Trivial mapper to take extract field value from binary object of specific type as affinity key.
+ */
+@SuppressWarnings("deprecation")
+public class DynamicTableAffinityKeyMapper implements AffinityKeyMapper {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Type name. */
+ private final String typeName;
+
+ /** Field name. */
+ private final String fieldName;
+
+ /** Type id for faster type checks. */
+ private transient volatile BinaryFieldEx field;
+
+ /**
+ * Constructor.
+ *
+ * @param typeName Type name.
+ * @param fieldName Field name.
+ */
+ DynamicTableAffinityKeyMapper(String typeName, String fieldName) {
+ this.typeName = typeName;
+ this.fieldName = fieldName;
+ }
+
+ /**
+ * @return Field name.
+ */
+ public String fieldName() {
+ return fieldName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object affinityKey(Object key) {
+ if (!(key instanceof BinaryObject))
+ return key;
+
+ assert key instanceof BinaryObjectEx;
+
+ BinaryObjectEx key0 = (BinaryObjectEx)key;
+
+ if (field == null) {
+ BinaryType type = key0.type();
+
+ if (!F.eq(type.typeName(), typeName))
+ return key;
+
+ field = (BinaryFieldEx)type.field(fieldName);
+ }
+
+ if (!F.eq(key0.typeId(), field.typeId()))
+ return key;
+
+ Object affKey = field.value(key0);
+
+ return affKey != null ? affKey : key;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void reset() {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 48c7229..4311b12 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -17,6 +17,25 @@
package org.apache.ignite.internal.processors.query;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.Cache;
+import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.IgniteException;
@@ -34,8 +53,8 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.events.CacheQueryExecutedEvent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.NodeStoppingException;
+import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -72,9 +91,9 @@ import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.apache.ignite.internal.util.lang.GridClosureException;
import org.apache.ignite.internal.util.lang.IgniteOutClosureX;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.T3;
+import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.internal.util.worker.GridWorkerFuture;
@@ -88,26 +107,6 @@ import org.apache.ignite.spi.indexing.IndexingQueryFilter;
import org.apache.ignite.thread.IgniteThread;
import org.jetbrains.annotations.Nullable;
-import javax.cache.Cache;
-import javax.cache.CacheException;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-
import static org.apache.ignite.events.EventType.EVT_CACHE_QUERY_EXECUTED;
import static org.apache.ignite.internal.GridTopic.TOPIC_SCHEMA;
import static org.apache.ignite.internal.IgniteComponentType.INDEXING;
@@ -1279,13 +1278,14 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param schemaName Schema name to create table in.
* @param entity Entity to create table from.
* @param templateName Template name.
+ * @param affinityKey Affinity key column name.
* @param atomicityMode Atomicity mode.
* @param backups Backups.
* @param ifNotExists Quietly ignore this command if table already exists.
* @throws IgniteCheckedException If failed.
*/
@SuppressWarnings("unchecked")
- public void dynamicTableCreate(String schemaName, QueryEntity entity, String templateName,
+ public void dynamicTableCreate(String schemaName, QueryEntity entity, String templateName, String affinityKey,
@Nullable CacheAtomicityMode atomicityMode, int backups, boolean ifNotExists) throws IgniteCheckedException {
assert !F.isEmpty(templateName);
assert backups >= 0;
@@ -1316,6 +1316,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
ccfg.setSqlEscapeAll(true);
ccfg.setQueryEntities(Collections.singleton(entity));
+ if (affinityKey != null) {
+ assert entity.getFields().containsKey(affinityKey) && entity.getKeyFields().contains(affinityKey);
+
+ ccfg.setAffinityMapper(new DynamicTableAffinityKeyMapper(entity.getKeyType(), affinityKey));
+ }
+
boolean res;
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
index fbd9afa..e0815fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
@@ -427,16 +427,19 @@ public class QueryUtils {
if (valCls != null)
altTypeId = new QueryTypeIdKey(cacheName, valCls);
- if (!cctx.customAffinityMapper() && qryEntity.findKeyType() != null) {
- // Need to setup affinity key for distributed joins.
- String affField = ctx.cacheObjects().affinityField(qryEntity.findKeyType());
+ String affField = null;
- if (affField != null) {
- if (!escape)
- affField = normalizeObjectName(affField, false);
+ // Need to setup affinity key for distributed joins.
+ if (!cctx.customAffinityMapper() && qryEntity.findKeyType() != null)
+ affField = ctx.cacheObjects().affinityField(qryEntity.findKeyType());
+ else if (cctx.config().getAffinityMapper() instanceof DynamicTableAffinityKeyMapper)
+ affField = ((DynamicTableAffinityKeyMapper)cctx.config().getAffinityMapper()).fieldName();
- desc.affinityKey(affField);
- }
+ if (affField != null) {
+ if (!escape)
+ affField = normalizeObjectName(affField, false);
+
+ desc.affinityKey(affField);
}
}
else {
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index 5efc5c9..d6bcabd 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -178,7 +178,7 @@ public class DdlStatementsProcessor {
throw err;
ctx.query().dynamicTableCreate(cmd.schemaName(), e, cmd.templateName(),
- cmd.atomicityMode(), cmd.backups(), cmd.ifNotExists());
+ cmd.affinityKey(), cmd.atomicityMode(), cmd.backups(), cmd.ifNotExists());
}
}
else if (stmt0 instanceof GridSqlDropTable) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index d656cc3..4f3ef01 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.query.QueryTable;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.query.DynamicTableAffinityKeyMapper;
import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
@@ -130,7 +131,9 @@ public class GridH2Table extends TableBase {
this.desc = desc;
this.cctx = cctx;
- if (desc != null && desc.context() != null && !desc.context().customAffinityMapper()) {
+ if (desc != null && desc.context() != null &&
+ (!desc.context().customAffinityMapper() ||
+ desc.context().config().getAffinityMapper() instanceof DynamicTableAffinityKeyMapper)) {
boolean affinityColExists = true;
String affKey = desc.type().affinityKey();
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
index 50348fe..edced6b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlCreateTable.java
@@ -53,6 +53,9 @@ public class GridSqlCreateTable extends GridSqlStatement {
/** Primary key columns. */
private LinkedHashSet<String> pkCols;
+ /** Name of the column that represents affinity key. */
+ private String affinityKey;
+
/** Extra WITH-params. */
private List<String> params;
@@ -127,6 +130,20 @@ public class GridSqlCreateTable extends GridSqlStatement {
}
/**
+ * @return Name of the column that represents affinity key.
+ */
+ public String affinityKey() {
+ return affinityKey;
+ }
+
+ /**
+ * @param affinityKey Name of the column that represents affinity key.
+ */
+ public void affinityKey(String affinityKey) {
+ this.affinityKey = affinityKey;
+ }
+
+ /**
* @return Schema name upon which this statement has been issued.
*/
public String schemaName() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
index fdb908e..d8baed3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/GridSqlQueryParser.java
@@ -405,6 +405,9 @@ public class GridSqlQueryParser {
private static final String PARAM_ATOMICITY = "ATOMICITY";
/** */
+ private static final String PARAM_AFFINITY_KEY = "AFFINITYKEY";
+
+ /** */
private final IdentityHashMap<Object, Object> h2ObjToGridObj = new IdentityHashMap<>();
/** */
@@ -1048,6 +1051,47 @@ public class GridSqlQueryParser {
break;
+ case PARAM_AFFINITY_KEY:
+ ensureNotEmpty(name, val);
+
+ String affColName = null;
+
+ // Either strip column name off its quotes, or uppercase it.
+ if (val.startsWith("'")) {
+ if (val.length() == 1 || !val.endsWith("'"))
+ throw new IgniteSQLException("Affinity key column name does not have trailing quote: " + val,
+ IgniteQueryErrorCode.PARSING);
+
+ val = val.substring(1, val.length() - 1);
+
+ ensureNotEmpty(name, val);
+
+ affColName = val;
+ }
+ else {
+ for (String colName : res.columns().keySet()) {
+ if (val.equalsIgnoreCase(colName)) {
+ if (affColName != null)
+ throw new IgniteSQLException("Ambiguous affinity column name, use single quotes " +
+ "for case sensitivity: " + val, IgniteQueryErrorCode.PARSING);
+
+ affColName = colName;
+ }
+ }
+ }
+
+ if (affColName == null || !res.columns().containsKey(affColName))
+ throw new IgniteSQLException("Affinity key column with given name not found: " + val,
+ IgniteQueryErrorCode.PARSING);
+
+ if (!res.primaryKeyColumns().contains(affColName))
+ throw new IgniteSQLException("Affinity key column must be one of key columns: " + affColName,
+ IgniteQueryErrorCode.PARSING);
+
+ res.affinityKey(affColName);
+
+ break;
+
default:
throw new IgniteSQLException("Unsupported parameter: " + name, IgniteQueryErrorCode.PARSING);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd5065b1/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
index 699fdad..e4babba 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/H2DynamicTableSelfTest.java
@@ -19,13 +19,15 @@ package org.apache.ignite.internal.processors.cache.index;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Random;
import java.util.concurrent.Callable;
-
import javax.cache.CacheException;
-
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
@@ -41,6 +43,7 @@ import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.query.GridQueryProperty;
+import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.query.QueryTypeDescriptorImpl;
import org.apache.ignite.internal.processors.query.QueryUtils;
@@ -401,7 +404,7 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
e.setKeyType("CityKey");
e.setValueType("City");
- queryProcessor(client()).dynamicTableCreate("PUBLIC", e, CacheMode.PARTITIONED.name(),
+ queryProcessor(client()).dynamicTableCreate("PUBLIC", e, CacheMode.PARTITIONED.name(), null,
CacheAtomicityMode.ATOMIC, 10, false);
return null;
@@ -427,6 +430,167 @@ public class H2DynamicTableSelfTest extends AbstractSchemaSelfTest {
}
/**
+ * @throws Exception if failed.
+ */
+ public void testAffinityKey() throws Exception {
+ executeDdl("CREATE TABLE \"City\" (\"name\" varchar primary key, \"code\" int) WITH \"affinityKey='name'\"");
+
+ assertAffinityCacheConfiguration("City", "name");
+
+ executeDdl("INSERT INTO \"City\" (\"name\", \"code\") values ('A', 1), ('B', 2), ('C', 3)");
+
+ List<String> cityNames = Arrays.asList("A", "B", "C");
+
+ List<Integer> cityCodes = Arrays.asList(1, 2, 3);
+
+ // We need unique name for this table to avoid conflicts with existing binary metadata.
+ executeDdl("CREATE TABLE \"Person2\" (\"id\" int, \"city\" varchar," +
+ " \"name\" varchar, \"surname\" varchar, \"age\" int, PRIMARY KEY (\"id\", \"city\")) WITH " +
+ "\"template=cache,affinityKey='city'\"");
+
+ assertAffinityCacheConfiguration("Person2", "city");
+
+ Random r = new Random();
+
+ Map<Integer, Integer> personId2cityCode = new HashMap<>();
+
+ for (int i = 0; i < 100; i++) {
+ int cityIdx = r.nextInt(3);
+
+ String cityName = cityNames.get(cityIdx);
+
+ int cityCode = cityCodes.get(cityIdx);
+
+ personId2cityCode.put(i, cityCode);
+
+ queryProcessor(client()).querySqlFieldsNoCache(new SqlFieldsQuery("insert into \"Person2\"(\"id\", " +
+ "\"city\") values (?, ?)").setArgs(i, cityName), true).getAll();
+ }
+
+ List<List<?>> res = queryProcessor(client()).querySqlFieldsNoCache(new SqlFieldsQuery("select \"id\", " +
+ "c.\"code\" from \"Person2\" p left join \"City\" c on p.\"city\" = c.\"name\" where c.\"name\" " +
+ "is not null"), true).getAll();
+
+ assertEquals(100, res.size());
+
+ for (int i = 0; i < 100; i++) {
+ assertNotNull(res.get(i).get(0));
+
+ assertNotNull(res.get(i).get(1));
+
+ int id = (Integer)res.get(i).get(0);
+
+ int code = (Integer)res.get(i).get(1);
+
+ assertEquals((int)personId2cityCode.get(id), code);
+ }
+ }
+
+ /**
+ * Test various cases of affinity key column specification.
+ */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ public void testAffinityKeyCaseSensitivity() {
+ executeDdl("CREATE TABLE \"A\" (\"name\" varchar primary key, \"code\" int) WITH \"affinityKey='name'\"");
+
+ assertAffinityCacheConfiguration("A", "name");
+
+ executeDdl("CREATE TABLE \"B\" (name varchar primary key, \"code\" int) WITH \"affinityKey=name\"");
+
+ assertAffinityCacheConfiguration("B", "NAME");
+
+ executeDdl("CREATE TABLE \"C\" (name varchar primary key, \"code\" int) WITH \"affinityKey=NamE\"");
+
+ assertAffinityCacheConfiguration("C", "NAME");
+
+ executeDdl("CREATE TABLE \"D\" (\"name\" varchar primary key, \"code\" int) WITH \"affinityKey=NAME\"");
+
+ assertAffinityCacheConfiguration("D", "name");
+
+ // Error arises because user has specified case sensitive affinity column name
+ GridTestUtils.assertThrows(null, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ executeDdl("CREATE TABLE \"E\" (name varchar primary key, \"code\" int) WITH \"affinityKey='Name'\"");
+
+ return null;
+ }
+ }, IgniteSQLException.class, "Affinity key column with given name not found: Name");
+
+ // Error arises because user declares case insensitive affinity column name while having two 'name'
+ // columns whose names are equal in ignore case.
+ GridTestUtils.assertThrows(null, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ executeDdl("CREATE TABLE \"E\" (\"name\" varchar, \"Name\" int, val int, primary key(\"name\", " +
+ "\"Name\")) WITH \"affinityKey=name\"");
+
+ return null;
+ }
+ }, IgniteSQLException.class, "Ambiguous affinity column name, use single quotes for case sensitivity: name");
+
+ executeDdl("CREATE TABLE \"E\" (\"name\" varchar, \"Name\" int, val int, primary key(\"name\", " +
+ "\"Name\")) WITH \"affinityKey='Name'\"");
+
+ assertAffinityCacheConfiguration("E", "Name");
+ }
+
+ /**
+ * Tests that attempting to specify an affinity key that actually is a value column yields an error.
+ */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ public void testAffinityKeyNotKeyColumn() {
+ // Error arises because user has specified case sensitive affinity column name
+ GridTestUtils.assertThrows(null, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ executeDdl("CREATE TABLE \"E\" (name varchar primary key, \"code\" int) WITH \"affinityKey=code\"");
+
+ return null;
+ }
+ }, IgniteSQLException.class, "Affinity key column must be one of key columns: code");
+ }
+
+ /**
+ * Tests that attempting to specify an affinity key that actually is a value column yields an error.
+ */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ public void testAffinityKeyNotFound() {
+ // Error arises because user has specified case sensitive affinity column name
+ GridTestUtils.assertThrows(null, new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ executeDdl("CREATE TABLE \"E\" (name varchar primary key, \"code\" int) WITH \"affinityKey=missing\"");
+
+ return null;
+ }
+ }, IgniteSQLException.class, "Affinity key column with given name not found: missing");
+ }
+
+ /**
+ * Check that dynamic cache created with {@code CREATE TABLE} is correctly configured affinity wise.
+ * @param cacheName Cache name to check.
+ * @param affKeyFieldName Expected affinity key field name.
+ */
+ private void assertAffinityCacheConfiguration(String cacheName, String affKeyFieldName) {
+ String actualCacheName = cacheName(cacheName);
+
+ Collection<GridQueryTypeDescriptor> types = client().context().query().types(actualCacheName);
+
+ assertEquals(1, types.size());
+
+ GridQueryTypeDescriptor type = types.iterator().next();
+
+ assertTrue(type.name().startsWith(actualCacheName));
+ assertEquals(cacheName, type.tableName());
+ assertEquals(affKeyFieldName, type.affinityKey());
+
+ GridH2Table tbl = ((IgniteH2Indexing)queryProcessor(client()).getIndexing()).dataTable("PUBLIC", cacheName);
+
+ assertNotNull(tbl);
+
+ assertNotNull(tbl.getAffinityKeyColumn());
+
+ assertEquals(affKeyFieldName, tbl.getAffinityKeyColumn().columnName);
+ }
+
+ /**
* Execute {@code CREATE TABLE} w/given params.
* @param params Engine parameters.
*/
[33/39] ignite git commit: ignite-5155 Added possibility to receive
diagnostic information from remote nodes for hanging cache futures
Posted by sb...@apache.org.
ignite-5155 Added possibility to receive diagnostic information from remote nodes for hanging cache futures
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5d98ccec
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5d98ccec
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5d98ccec
Branch: refs/heads/ignite-5272
Commit: 5d98ccecbd43ad155f1394356c5569604556f158
Parents: 3c5ffd1
Author: sboikov <sb...@gridgain.com>
Authored: Sat Jun 10 11:51:10 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Sat Jun 10 11:51:10 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 6 +
.../org/apache/ignite/internal/GridTopic.java | 6 +-
.../ignite/internal/IgniteDiagnosticAware.java | 28 ++
.../ignite/internal/IgniteDiagnosticInfo.java | 45 ++
.../internal/IgniteDiagnosticMessage.java | 467 +++++++++++++++++++
.../IgniteDiagnosticPrepareContext.java | 279 +++++++++++
.../apache/ignite/internal/IgniteKernal.java | 7 +-
.../managers/communication/GridIoManager.java | 2 +-
.../communication/GridIoMessageFactory.java | 8 +-
.../processors/GridProcessorAdapter.java | 10 +
.../processors/cache/GridCacheIoManager.java | 34 ++
.../GridCachePartitionExchangeManager.java | 136 ++++--
.../cache/GridCacheSharedManagerAdapter.java | 9 +
.../distributed/dht/GridDhtTxPrepareFuture.java | 31 +-
.../dht/GridPartitionedSingleGetFuture.java | 25 +-
.../colocated/GridDhtColocatedLockFuture.java | 45 +-
.../GridDhtPartitionsExchangeFuture.java | 48 +-
.../processors/cluster/ClusterProcessor.java | 305 +++++++++++-
.../ignite/internal/util/nio/GridNioServer.java | 212 ++++++---
.../communication/tcp/TcpCommunicationSpi.java | 185 +++++---
.../managers/IgniteDiagnosticMessagesTest.java | 255 ++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 6 +-
22 files changed, 1970 insertions(+), 179 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 84f3732..539f288 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -448,6 +448,12 @@ public final class IgniteSystemProperties {
/** If this property is set to {@code true} then Ignite will log thread dump in case of partition exchange timeout. */
public static final String IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT = "IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT";
+ /** */
+ public static final String IGNITE_IO_DUMP_ON_TIMEOUT = "IGNITE_IO_DUMP_ON_TIMEOUT";
+
+ /** */
+ public static final String IGNITE_DIAGNOSTIC_ENABLED = "IGNITE_DIAGNOSTIC_ENABLED";
+
/** Cache operations that take more time than value of this property will be output to log. Set to {@code 0} to disable. */
public static final String IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT = "IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT";
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
index c382999..abdbf95 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
@@ -96,6 +96,7 @@ public enum GridTopic {
/** */
TOPIC_TX,
+ /** */
TOPIC_SNAPSHOT,
/** */
@@ -111,7 +112,10 @@ public enum GridTopic {
TOPIC_METADATA_REQ,
/** */
- TOPIC_SCHEMA;
+ TOPIC_SCHEMA,
+
+ /** */
+ TOPIC_INTERNAL_DIAGNOSTIC;
/** Enum values. */
private static final GridTopic[] VALS = values();
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java
new file mode 100644
index 0000000..45a5f3a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticAware.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+/**
+ *
+ */
+public interface IgniteDiagnosticAware {
+ /**
+ * @param ctx Context.
+ */
+ public void addDiagnosticRequest(IgniteDiagnosticPrepareContext ctx);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticInfo.java
new file mode 100644
index 0000000..f82f600
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticInfo.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import java.io.Serializable;
+
+/**
+ *
+ */
+public class IgniteDiagnosticInfo implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private String msg;
+
+ /**
+ * @param msg Message.
+ */
+ public IgniteDiagnosticInfo(String msg) {
+ this.msg = msg;
+ }
+
+ /**
+ * @return Message.
+ */
+ public String message() {
+ return msg;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
new file mode 100644
index 0000000..4f37f53
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticMessage.java
@@ -0,0 +1,467 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import java.nio.ByteBuffer;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
+import org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTopologyFuture;
+import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.internal.util.typedef.T3;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiInClosure;
+import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
+import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public class IgniteDiagnosticMessage implements Message {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private static final int REQUEST_FLAG_MASK = 0x01;
+
+ /** */
+ private static final ThreadLocal<DateFormat> dateFormat = new ThreadLocal<DateFormat>() {
+ @Override protected DateFormat initialValue() {
+ return new SimpleDateFormat("HH:mm:ss.SSS");
+ }
+ };
+
+ /** */
+ private byte flags;
+
+ /** */
+ private long futId;
+
+ /** */
+ private byte[] bytes;
+
+ /**
+ * Required by {@link GridIoMessageFactory}.
+ */
+ public IgniteDiagnosticMessage() {
+ // No-op.
+ }
+
+ /**
+ * @param marsh Marshaller.
+ * @param c Closure to run.
+ * @param futId Future ID.
+ * @return Request message.
+ * @throws IgniteCheckedException If failed.
+ */
+ public static IgniteDiagnosticMessage createRequest(Marshaller marsh,
+ IgniteClosure<GridKernalContext, IgniteDiagnosticInfo> c,
+ long futId)
+ throws IgniteCheckedException
+ {
+ byte[] cBytes = U.marshal(marsh, c);
+
+ IgniteDiagnosticMessage msg = new IgniteDiagnosticMessage();
+
+ msg.futId = futId;
+ msg.bytes = cBytes;
+ msg.flags |= REQUEST_FLAG_MASK;
+
+ return msg;
+ }
+
+ /**
+ * @param resBytes Marshalled result.
+ * @param futId Future ID.
+ * @return Response message.
+ */
+ public static IgniteDiagnosticMessage createResponse(byte[] resBytes, long futId) {
+ IgniteDiagnosticMessage msg = new IgniteDiagnosticMessage();
+
+ msg.futId = futId;
+ msg.bytes = resBytes;
+
+ return msg;
+ }
+
+ /**
+ * @param marsh Marshaller.
+ * @return Unmarshalled payload.
+ * @throws IgniteCheckedException If failed.
+ */
+ @Nullable public <T> T unmarshal(Marshaller marsh)
+ throws IgniteCheckedException {
+ if (bytes == null)
+ return null;
+
+ return U.unmarshal(marsh, bytes, null);
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public long futureId() {
+ return futId;
+ }
+
+ /**
+ * @return {@code True} if this is request message.
+ */
+ public boolean request() {
+ return (flags & REQUEST_FLAG_MASK) != 0;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
+ writer.setBuffer(buf);
+
+ if (!writer.isHeaderWritten()) {
+ if (!writer.writeHeader(directType(), fieldsCount()))
+ return false;
+
+ writer.onHeaderWritten();
+ }
+
+ switch (writer.state()) {
+ case 0:
+ if (!writer.writeByteArray("bytes", bytes))
+ return false;
+
+ writer.incrementState();
+
+ case 1:
+ if (!writer.writeByte("flags", flags))
+ return false;
+
+ writer.incrementState();
+
+ case 2:
+ if (!writer.writeLong("futId", futId))
+ return false;
+
+ writer.incrementState();
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
+ reader.setBuffer(buf);
+
+ if (!reader.beforeMessageRead())
+ return false;
+
+ switch (reader.state()) {
+ case 0:
+ bytes = reader.readByteArray("bytes");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 1:
+ flags = reader.readByte("flags");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ case 2:
+ futId = reader.readLong("futId");
+
+ if (!reader.isLastRead())
+ return false;
+
+ reader.incrementState();
+
+ }
+
+ return reader.afterMessageRead(IgniteDiagnosticMessage.class);
+ }
+
+ /** {@inheritDoc} */
+ @Override public short directType() {
+ return -55;
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte fieldsCount() {
+ return 3;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onAckReceived() {
+ // No-op.
+ }
+
+ /**
+ *
+ */
+ public static abstract class DiagnosticBaseClosure implements IgniteBiInClosure<StringBuilder, GridKernalContext> {
+ /**
+ * @return Key to group similar messages.
+ */
+ public Object mergeKey() {
+ return getClass();
+ }
+
+ /**
+ * @param other Another closure of the same type.
+ */
+ public void merge(DiagnosticBaseClosure other) {
+ // No-op.
+ }
+ }
+
+ /**
+ *
+ */
+ public final static class TxEntriesInfoClosure extends DiagnosticBaseClosure {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private final int cacheId;
+
+ /** */
+ private final Set<KeyCacheObject> keys;
+
+ /**
+ * @param cacheId Cache ID.
+ * @param keys Keys.
+ */
+ TxEntriesInfoClosure(int cacheId, Collection<KeyCacheObject> keys) {
+ this.cacheId = cacheId;
+ this.keys = new HashSet<>(keys);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void apply(StringBuilder sb, GridKernalContext ctx) {
+ sb.append(U.nl());
+
+ GridCacheContext cctx = ctx.cache().context().cacheContext(cacheId);
+
+ if (cctx == null) {
+ sb.append("Failed to find cache with id: ").append(cacheId);
+
+ return;
+ }
+
+ try {
+ for (KeyCacheObject key : keys)
+ key.finishUnmarshal(cctx.cacheObjectContext(), null);
+ }
+ catch (IgniteCheckedException e) {
+ ctx.cluster().diagnosticLog().error("Failed to unmarshal key: " + e, e);
+
+ sb.append("Failed to unmarshal key: ").append(e).append(U.nl());
+ }
+
+ sb.append("Cache entries [cacheId=").append(cacheId)
+ .append(", cacheName=").append(cctx.name()).append("]: ");
+
+ for (KeyCacheObject key : keys) {
+ GridCacheMapEntry e = (GridCacheMapEntry)cctx.cache().peekEx(key);
+
+ sb.append(U.nl()).append(" Key [key=").append(key).append(", entry=").append(e).append("]");
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object mergeKey() {
+ return new T2<>(getClass(), cacheId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void merge(DiagnosticBaseClosure other) {
+ TxEntriesInfoClosure other0 = (TxEntriesInfoClosure)other;
+
+ assert other0 != null && cacheId == other0.cacheId : other;
+
+ this.keys.addAll(other0.keys);
+ }
+ }
+
+ /**
+ *
+ */
+ public final static class ExchangeInfoClosure extends DiagnosticBaseClosure {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private final AffinityTopologyVersion topVer;
+
+ /**
+ * @param topVer Exchange version.
+ */
+ ExchangeInfoClosure(AffinityTopologyVersion topVer) {
+ this.topVer = topVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void apply(StringBuilder sb, GridKernalContext ctx) {
+ sb.append(U.nl());
+
+ List<GridDhtPartitionsExchangeFuture> futs = ctx.cache().context().exchange().exchangeFutures();
+
+ for (GridDhtPartitionsExchangeFuture fut : futs) {
+ if (topVer.equals(fut.topologyVersion())) {
+ sb.append("Exchange future: ").append(fut);
+
+ return;
+ }
+ }
+
+ sb.append("Failed to find exchange future: ").append(topVer);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object mergeKey() {
+ return new T2<>(getClass(), topVer);
+ }
+ }
+
+ /**
+ *
+ */
+ public final static class TxInfoClosure extends DiagnosticBaseClosure {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private final GridCacheVersion dhtVer;
+
+ /** */
+ private final GridCacheVersion nearVer;
+
+ /**
+ * @param dhtVer Tx dht version.
+ * @param nearVer Tx near version.
+ */
+ TxInfoClosure(GridCacheVersion dhtVer, GridCacheVersion nearVer) {
+ this.dhtVer = dhtVer;
+ this.nearVer = nearVer;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void apply(StringBuilder sb, GridKernalContext ctx) {
+ sb.append(U.nl())
+ .append("Related transactions [dhtVer=").append(dhtVer)
+ .append(", nearVer=").append(nearVer).append("]: ");
+
+ boolean found = false;
+
+ for (IgniteInternalTx tx : ctx.cache().context().tm().activeTransactions()) {
+ if (dhtVer.equals(tx.xidVersion()) || nearVer.equals(tx.nearXidVersion())) {
+ sb.append(U.nl())
+ .append(" [ver=").append(tx.xidVersion())
+ .append(", nearVer=").append(tx.nearXidVersion())
+ .append(", topVer=").append(tx.topologyVersion())
+ .append(", state=").append(tx.state())
+ .append(", fullTx=").append(tx).append(']');
+
+ found = true;
+ }
+ }
+
+ if (!found)
+ sb.append(U.nl()).append("Failed to find related transactions.");
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object mergeKey() {
+ return new T3<>(getClass(), nearVer, dhtVer);
+ }
+ }
+
+ /**
+ *
+ * @param sb String builder.
+ * @param ctx Context.
+ */
+ static void dumpNodeBasicInfo(StringBuilder sb, GridKernalContext ctx) {
+ sb.append("General node info [id=").append(ctx.localNodeId())
+ .append(", client=").append(ctx.clientNode())
+ .append(", discoTopVer=").append(ctx.discovery().topologyVersionEx())
+ .append(", time=").append(formatTime(U.currentTimeMillis())).append(']');
+ }
+
+ /**
+ * @param sb String builder.
+ * @param ctx Context.
+ */
+ static void dumpExchangeInfo(StringBuilder sb, GridKernalContext ctx) {
+ GridCachePartitionExchangeManager exchMgr = ctx.cache().context().exchange();
+ GridDhtTopologyFuture fut = exchMgr.lastTopologyFuture();
+
+ sb.append("Partitions exchange info [readyVer=").append(exchMgr.readyAffinityVersion()).append(']').append(U.nl())
+ .append("Last initialized exchange future: ").append(fut);
+ }
+
+ /**
+ * @param ctx Context.
+ * @param nodeId Target node ID.
+ * @return Communication information future.
+ */
+ public static IgniteInternalFuture<String> dumpCommunicationInfo(GridKernalContext ctx, UUID nodeId) {
+ if (ctx.config().getCommunicationSpi() instanceof TcpCommunicationSpi)
+ return ((TcpCommunicationSpi) ctx.config().getCommunicationSpi()).dumpNodeStatistics(nodeId);
+ else
+ return new GridFinishedFuture<>("Unexpected communication SPI: " + ctx.config().getCommunicationSpi());
+ }
+
+ /**
+ * @param time Time.
+ * @return Time string.
+ */
+ private static String formatTime(long time) {
+ return dateFormat.get().format(new Date(time));
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(IgniteDiagnosticMessage.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
new file mode 100644
index 0000000..b55199a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteDiagnosticPrepareContext.java
@@ -0,0 +1,279 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.typedef.CI1;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.DiagnosticBaseClosure;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.ExchangeInfoClosure;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.TxEntriesInfoClosure;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.TxInfoClosure;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.dumpCommunicationInfo;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.dumpExchangeInfo;
+import static org.apache.ignite.internal.IgniteDiagnosticMessage.dumpNodeBasicInfo;
+
+/**
+ * Groups diagnostic closures by node/closure type.
+ */
+public class IgniteDiagnosticPrepareContext {
+ /** */
+ private final UUID locNodeId;
+
+ /** */
+ private final Map<UUID, CompoundInfoClosure> cls = new HashMap<>();
+
+ /**
+ * @param nodeId Local node ID.
+ */
+ public IgniteDiagnosticPrepareContext(UUID nodeId) {
+ locNodeId = nodeId;
+ }
+
+ /**
+ * @param nodeId Remote node ID.
+ * @param topVer Topology version.
+ * @param msg Initial message.
+ */
+ public void exchangeInfo(UUID nodeId, AffinityTopologyVersion topVer, String msg) {
+ closure(nodeId).add(msg, new ExchangeInfoClosure(topVer));
+ }
+
+ /**
+ * @param nodeId Remote node ID.
+ * @param cacheId Cache ID.
+ * @param keys Entry keys.
+ * @param msg Initial message.
+ */
+ public void txKeyInfo(UUID nodeId, int cacheId, Collection<KeyCacheObject> keys, String msg) {
+ closure(nodeId).add(msg, new TxEntriesInfoClosure(cacheId, keys));
+ }
+
+ /**
+ * @param nodeId Remote node ID.
+ * @param dhtVer Tx dht version.
+ * @param nearVer Tx near version.
+ * @param msg Initial message.
+ */
+ public void remoteTxInfo(UUID nodeId, GridCacheVersion dhtVer, GridCacheVersion nearVer, String msg) {
+ closure(nodeId).add(msg, new TxInfoClosure(dhtVer, nearVer));
+ }
+
+ /**
+ * @param nodeId Remote node ID.
+ * @param msg Initial message.
+ */
+ public void basicInfo(UUID nodeId, String msg) {
+ closure(nodeId).add(msg, null);
+ }
+
+ /**
+ * @param nodeId Remote node ID.
+ * @return Compound closure
+ */
+ private CompoundInfoClosure closure(UUID nodeId) {
+ CompoundInfoClosure cl = cls.get(nodeId);
+
+ if (cl == null)
+ cls.put(nodeId, cl = new CompoundInfoClosure(locNodeId));
+
+ return cl;
+ }
+
+ /**
+ * @return {@code True} if there are no added closures.
+ */
+ public boolean empty() {
+ return cls.isEmpty();
+ }
+
+ /**
+ * @param ctx Grid context.
+ * @param lsnr Optional listener (used in test).
+ */
+ public void send(GridKernalContext ctx, @Nullable IgniteInClosure<IgniteInternalFuture<String>> lsnr) {
+ for (Map.Entry<UUID, CompoundInfoClosure> entry : cls.entrySet()) {
+ UUID rmtNodeId = entry.getKey();
+
+ CompoundInfoClosure c = entry.getValue();
+
+ IgniteInternalFuture<String> fut =
+ ctx.cluster().requestDiagnosticInfo(rmtNodeId, c, c.message());
+
+ if (lsnr != null)
+ fut.listen(lsnr);
+
+ listenAndLog(ctx.cluster().diagnosticLog(), fut);
+ }
+ }
+
+ /**
+ * @param log Logger.
+ * @param fut Future.
+ */
+ private void listenAndLog(final IgniteLogger log, IgniteInternalFuture<String> fut) {
+ fut.listen(new CI1<IgniteInternalFuture<String>>() {
+ @Override public void apply(IgniteInternalFuture<String> fut) {
+ synchronized (IgniteDiagnosticPrepareContext.class) {
+ try {
+ log.info(fut.get());
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to dump diagnostic info: " + e, e);
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ *
+ */
+ private final static class CompoundInfoClosure implements IgniteClosure<GridKernalContext, IgniteDiagnosticInfo> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** ID of node sent closure. */
+ protected final UUID nodeId;
+
+ /** Closures to send on remote node. */
+ private Map<Object, IgniteDiagnosticMessage.DiagnosticBaseClosure> cls = new LinkedHashMap<>();
+
+ /** Local message related to remote closures. */
+ private transient Map<Object, List<String>> msgs = new LinkedHashMap<>();
+
+ /**
+ * @param nodeId Node sent closure.
+ */
+ CompoundInfoClosure(UUID nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public final IgniteDiagnosticInfo apply(GridKernalContext ctx) {
+ try {
+ IgniteInternalFuture<String> commInfo = dumpCommunicationInfo(ctx, nodeId);
+
+ StringBuilder sb = new StringBuilder();
+
+ dumpNodeBasicInfo(sb, ctx);
+
+ sb.append(U.nl());
+
+ dumpExchangeInfo(sb, ctx);
+
+ sb.append(U.nl());
+
+ sb.append(commInfo.get(10_000));
+
+ moreInfo(sb, ctx);
+
+ return new IgniteDiagnosticInfo(sb.toString());
+ }
+ catch (Exception e) {
+ ctx.cluster().diagnosticLog().error("Failed to execute diagnostic message closure: " + e, e);
+
+ return new IgniteDiagnosticInfo("Failed to execute diagnostic message closure: " + e);
+ }
+ }
+
+ /**
+ * @param sb String builder.
+ * @param ctx Grid context.
+ */
+ private void moreInfo(StringBuilder sb, GridKernalContext ctx) {
+ for (DiagnosticBaseClosure c : cls.values()) {
+ try {
+ c.apply(sb, ctx);
+ }
+ catch (Exception e) {
+ ctx.cluster().diagnosticLog().error(
+ "Failed to populate diagnostic with additional information: " + e, e);
+
+ sb.append(U.nl()).append("Failed to populate diagnostic with additional information: ").append(e);
+ }
+ }
+ }
+
+ /**
+ * @return Node ID.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @return Initial message.
+ */
+ public String message() {
+ StringBuilder sb = new StringBuilder();
+
+ for (List<String> msgs0 : msgs.values()) {
+ for (String msg : msgs0) {
+ if (sb.length() > 0)
+ sb.append('\n');
+
+ sb.append(msg);
+ }
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * @param msg Message.
+ * @param c Closure or {@code null} if only basic info is needed.
+ */
+ public void add(String msg, @Nullable DiagnosticBaseClosure c) {
+ Object key = c != null ? c.mergeKey() : getClass();
+
+ List<String> msgs0 = msgs.get(key);
+
+ if (msgs0 == null) {
+ msgs0 = new ArrayList<>();
+
+ msgs.put(key, msgs0);
+ }
+
+ msgs0.add(msg);
+
+ if (c != null) {
+ DiagnosticBaseClosure c0 = cls.get(c.mergeKey());
+
+ if (c0 == null)
+ cls.put(c.mergeKey(), c);
+ else
+ c0.merge(c);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 6d05147..fec1892 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -950,7 +950,12 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
// Start platform plugins.
if (ctx.config().getPlatformConfiguration() != null)
- startProcessor(new PlatformPluginProcessor(ctx));fillNodeAttributes(clusterProc.updateNotifierEnabled());}
+ startProcessor(new PlatformPluginProcessor(ctx));
+
+ ctx.cluster().initDiagnosticListeners();
+
+ fillNodeAttributes(clusterProc.updateNotifierEnabled());
+ }
catch (Throwable e) {
U.error(
log, "Exception during start processors, node will be stopped and close connections", e);
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
index 1efc4aa..81692da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java
@@ -2290,7 +2290,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
}
/**
- * Dumps SPI stats to logs in case TcpCommunicationSpi is used, no-op otherwise.
+ * Dumps SPI stats to diagnostic logs in case TcpCommunicationSpi is used, no-op otherwise.
*/
public void dumpStats() {
CommunicationSpi spi = getSpi();
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
index 753d8af..12f160b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessageFactory.java
@@ -26,6 +26,7 @@ import org.apache.ignite.internal.GridJobSiblingsRequest;
import org.apache.ignite.internal.GridJobSiblingsResponse;
import org.apache.ignite.internal.GridTaskCancelRequest;
import org.apache.ignite.internal.GridTaskSessionRequest;
+import org.apache.ignite.internal.IgniteDiagnosticMessage;
import org.apache.ignite.internal.binary.BinaryEnumObjectImpl;
import org.apache.ignite.internal.binary.BinaryObjectImpl;
import org.apache.ignite.internal.managers.checkpoint.GridCheckpointRequest;
@@ -178,6 +179,11 @@ public class GridIoMessageFactory implements MessageFactory {
Message msg = null;
switch (type) {
+ case -55:
+ msg = new IgniteDiagnosticMessage();
+
+ break;
+
// -54 is reserved for SQL.
case -53:
@@ -875,7 +881,7 @@ public class GridIoMessageFactory implements MessageFactory {
break;
- // [-3..119] [124..127] [-23..-27] [-36..-47]- this
+ // [-3..119] [124..127] [-23..-27] [-36..-55]- this
// [120..123] - DR
// [-4..-22, -30..-35] - SQL
default:
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
index cd97aea..b9d7260 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/GridProcessorAdapter.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -35,6 +36,9 @@ import org.jetbrains.annotations.Nullable;
* Advanced parent adapter for all processor.
*/
public abstract class GridProcessorAdapter implements GridProcessor {
+ /** */
+ private static final String DIAGNOSTIC_LOG_CATEGORY = "org.apache.ignite.internal.diagnostic";
+
/** Kernal context. */
@GridToStringExclude
protected final GridKernalContext ctx;
@@ -43,6 +47,10 @@ public abstract class GridProcessorAdapter implements GridProcessor {
@GridToStringExclude
protected final IgniteLogger log;
+ /** Diagnostic logger. */
+ @GridToStringExclude
+ protected final IgniteLogger diagnosticLog;
+
/**
* @param ctx Kernal context.
*/
@@ -52,6 +60,8 @@ public abstract class GridProcessorAdapter implements GridProcessor {
this.ctx = ctx;
log = ctx.log(getClass());
+
+ diagnosticLog = ctx.log(DIAGNOSTIC_LOG_CATEGORY);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index a251047..946d256 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -17,10 +17,12 @@
package org.apache.ignite.internal.processors.cache;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
@@ -104,6 +106,9 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
/** Message ID generator. */
private static final AtomicLong idGen = new AtomicLong();
+ /** */
+ private static final int MAX_STORED_PENDING_MESSAGES = 100;
+
/** Delay in milliseconds between retries. */
private long retryDelay;
@@ -126,6 +131,26 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
/** Deployment enabled. */
private boolean depEnabled;
+ /** */
+ private final List<GridCacheMessage> pendingMsgs = new ArrayList<>(MAX_STORED_PENDING_MESSAGES);
+
+ /**
+ *
+ */
+ public void dumpPendingMessages() {
+ synchronized (pendingMsgs) {
+ if (pendingMsgs.isEmpty())
+ return;
+
+ diagnosticLog.info("Pending cache messages waiting for exchange [" +
+ "readyVer=" + cctx.exchange().readyAffinityVersion() +
+ ", discoVer=" + cctx.discovery().topologyVersion() + ']');
+
+ for (GridCacheMessage msg : pendingMsgs)
+ diagnosticLog.info("Message [waitVer=" + msg.topologyVersion() + ", msg=" + msg + ']');
+ }
+ }
+
/** Message listener. */
private GridMessageListener lsnr = new GridMessageListener() {
@Override public void onMessage(final UUID nodeId, final Object msg) {
@@ -214,6 +239,11 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
}
if (fut != null && !fut.isDone()) {
+ synchronized (pendingMsgs) {
+ if (pendingMsgs.size() < MAX_STORED_PENDING_MESSAGES)
+ pendingMsgs.add(cacheMsg);
+ }
+
Thread curThread = Thread.currentThread();
final int stripe = curThread instanceof IgniteThread ? ((IgniteThread)curThread).stripe() : -1;
@@ -222,6 +252,10 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
@Override public void apply(IgniteInternalFuture<?> t) {
Runnable c = new Runnable() {
@Override public void run() {
+ synchronized (pendingMsgs) {
+ pendingMsgs.remove(cacheMsg);
+ }
+
IgniteLogger log = cacheMsg.messageLogger(cctx);
if (log.isDebugEnabled()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 2be4d0f..fdf8a2f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -49,6 +49,8 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
+import org.apache.ignite.internal.IgniteDiagnosticAware;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -101,6 +103,7 @@ import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_IO_DUMP_ON_TIMEOUT;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_PRELOAD_RESEND_TIMEOUT;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT;
import static org.apache.ignite.IgniteSystemProperties.getLong;
@@ -110,7 +113,7 @@ import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
import static org.apache.ignite.internal.GridTopic.TOPIC_CACHE;
import static org.apache.ignite.internal.events.DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
-import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.*;
+import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.nextDumpTimeout;
import static org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader.DFLT_PRELOAD_RESEND_TIMEOUT;
/**
@@ -1364,47 +1367,63 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
/**
- * @param exchTopVer Optional current exchange topology version.
+ * @param exchFut Optional current exchange future.
* @throws Exception If failed.
*/
- public void dumpDebugInfo(@Nullable AffinityTopologyVersion exchTopVer) throws Exception {
- U.warn(log, "Ready affinity version: " + readyTopVer.get());
+ public void dumpDebugInfo(@Nullable GridDhtPartitionsExchangeFuture exchFut) throws Exception {
+ AffinityTopologyVersion exchTopVer = exchFut != null ? exchFut.topologyVersion() : null;
- U.warn(log, "Last exchange future: " + lastInitializedFut);
+ U.warn(diagnosticLog, "Ready affinity version: " + readyTopVer.get());
+
+ U.warn(diagnosticLog, "Last exchange future: " + lastInitializedFut);
exchWorker.dumpExchangeDebugInfo();
if (!readyFuts.isEmpty()) {
- U.warn(log, "Pending affinity ready futures:");
+ U.warn(diagnosticLog, "Pending affinity ready futures:");
for (AffinityReadyFuture fut : readyFuts.values())
- U.warn(log, ">>> " + fut);
+ U.warn(diagnosticLog, ">>> " + fut);
}
+ IgniteDiagnosticPrepareContext diagCtx = cctx.kernalContext().cluster().diagnosticEnabled() ?
+ new IgniteDiagnosticPrepareContext(cctx.localNodeId()) : null;
+
+ if (diagCtx != null && exchFut != null)
+ exchFut.addDiagnosticRequest(diagCtx);
+
ExchangeFutureSet exchFuts = this.exchFuts;
if (exchFuts != null) {
- U.warn(log, "Last 10 exchange futures (total: " + exchFuts.size() + "):");
+ U.warn(diagnosticLog, "Last 10 exchange futures (total: " + exchFuts.size() + "):");
int cnt = 0;
for (GridDhtPartitionsExchangeFuture fut : exchFuts.values()) {
- U.warn(log, ">>> " + fut);
+ U.warn(diagnosticLog, ">>> " + fut.shortInfo());
if (++cnt == 10)
break;
}
}
- dumpPendingObjects(exchTopVer);
+ dumpPendingObjects(exchTopVer, diagCtx);
for (CacheGroupContext grp : cctx.cache().cacheGroups())
grp.preloader().dumpDebugInfo();
cctx.affinity().dumpDebugInfo();
- // Dump IO manager statistics.
- cctx.gridIO().dumpStats();
+ cctx.io().dumpPendingMessages();
+
+ if (IgniteSystemProperties.getBoolean(IGNITE_IO_DUMP_ON_TIMEOUT, false))
+ cctx.gridIO().dumpStats();
+
+ if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
+ U.dumpThreads(diagnosticLog);
+
+ if (diagCtx != null)
+ diagCtx.send(cctx.kernalContext(), null);
}
/**
@@ -1420,12 +1439,15 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
GridCacheMvccManager mvcc = cctx.mvcc();
+ final IgniteDiagnosticPrepareContext diagCtx = cctx.kernalContext().cluster().diagnosticEnabled() ?
+ new IgniteDiagnosticPrepareContext(cctx.localNodeId()) : null;
+
if (tm != null) {
for (IgniteInternalTx tx : tm.activeTransactions()) {
if (curTime - tx.startTime() > timeout) {
found = true;
- U.warn(log, "Found long running transaction [startTime=" + formatTime(tx.startTime()) +
+ U.warn(diagnosticLog, "Found long running transaction [startTime=" + formatTime(tx.startTime()) +
", curTime=" + formatTime(curTime) + ", tx=" + tx + ']');
}
}
@@ -1436,8 +1458,11 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (curTime - fut.startTime() > timeout) {
found = true;
- U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
+ U.warn(diagnosticLog, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
+
+ if (diagCtx != null && fut instanceof IgniteDiagnosticAware)
+ ((IgniteDiagnosticAware)fut).addDiagnosticRequest(diagCtx);
}
}
@@ -1445,12 +1470,28 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (curTime - fut.startTime() > timeout) {
found = true;
- U.warn(log, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
+ U.warn(diagnosticLog, "Found long running cache future [startTime=" + formatTime(fut.startTime()) +
", curTime=" + formatTime(curTime) + ", fut=" + fut + ']');
+
+ if (diagCtx != null && fut instanceof IgniteDiagnosticAware)
+ ((IgniteDiagnosticAware)fut).addDiagnosticRequest(diagCtx);
}
}
}
+ if (diagCtx != null && !diagCtx.empty()) {
+ try {
+ cctx.kernalContext().closure().runLocal(new Runnable() {
+ @Override public void run() {
+ diagCtx.send(cctx.kernalContext(), null);
+ }
+ }, SYSTEM_POOL);
+ }
+ catch (IgniteCheckedException e) {
+ U.error(diagnosticLog, "Failed to submit diagnostic closure: " + e, e);
+ }
+ }
+
return found;
}
@@ -1472,15 +1513,17 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
nextLongRunningOpsDumpTime = U.currentTimeMillis() + nextDumpTimeout(longRunningOpsDumpStep++, timeout);
if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false)) {
- U.warn(log, "Found long running cache operations, dump threads.");
+ U.warn(diagnosticLog, "Found long running cache operations, dump threads.");
- U.dumpThreads(log);
+ U.dumpThreads(diagnosticLog);
}
- U.warn(log, "Found long running cache operations, dump IO statistics.");
+ if (IgniteSystemProperties.getBoolean(IGNITE_IO_DUMP_ON_TIMEOUT, false)) {
+ U.warn(diagnosticLog, "Found long running cache operations, dump IO statistics.");
- // Dump IO manager statistics.
- cctx.gridIO().dumpStats();
+ // Dump IO manager statistics.
+ cctx.gridIO().dumpStats();
+ }
}
else {
nextLongRunningOpsDumpTime = 0;
@@ -1488,7 +1531,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
}
catch (Exception e) {
- U.error(log, "Failed to dump debug information: " + e, e);
+ U.error(diagnosticLog, "Failed to dump debug information: " + e, e);
}
}
@@ -1512,52 +1555,54 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
/**
* @param exchTopVer Exchange topology version.
+ * @param diagCtx Diagnostic request.
*/
- private void dumpPendingObjects(@Nullable AffinityTopologyVersion exchTopVer) {
+ private void dumpPendingObjects(@Nullable AffinityTopologyVersion exchTopVer,
+ @Nullable IgniteDiagnosticPrepareContext diagCtx) {
IgniteTxManager tm = cctx.tm();
if (tm != null) {
- U.warn(log, "Pending transactions:");
+ U.warn(diagnosticLog, "Pending transactions:");
for (IgniteInternalTx tx : tm.activeTransactions()) {
if (exchTopVer != null) {
- U.warn(log, ">>> [txVer=" + tx.topologyVersionSnapshot() +
+ U.warn(diagnosticLog, ">>> [txVer=" + tx.topologyVersionSnapshot() +
", exchWait=" + tm.needWaitTransaction(tx, exchTopVer) +
", tx=" + tx + ']');
}
else
- U.warn(log, ">>> [txVer=" + tx.topologyVersionSnapshot() + ", tx=" + tx + ']');
+ U.warn(diagnosticLog, ">>> [txVer=" + tx.topologyVersionSnapshot() + ", tx=" + tx + ']');
}
}
GridCacheMvccManager mvcc = cctx.mvcc();
if (mvcc != null) {
- U.warn(log, "Pending explicit locks:");
+ U.warn(diagnosticLog, "Pending explicit locks:");
for (GridCacheExplicitLockSpan lockSpan : mvcc.activeExplicitLocks())
- U.warn(log, ">>> " + lockSpan);
+ U.warn(diagnosticLog, ">>> " + lockSpan);
- U.warn(log, "Pending cache futures:");
+ U.warn(diagnosticLog, "Pending cache futures:");
for (GridCacheFuture<?> fut : mvcc.activeFutures())
- U.warn(log, ">>> " + fut);
+ dumpDiagnosticInfo(fut, diagCtx);
- U.warn(log, "Pending atomic cache futures:");
+ U.warn(diagnosticLog, "Pending atomic cache futures:");
for (GridCacheFuture<?> fut : mvcc.atomicFutures())
- U.warn(log, ">>> " + fut);
+ dumpDiagnosticInfo(fut, diagCtx);
- U.warn(log, "Pending data streamer futures:");
+ U.warn(diagnosticLog, "Pending data streamer futures:");
for (IgniteInternalFuture<?> fut : mvcc.dataStreamerFutures())
- U.warn(log, ">>> " + fut);
+ dumpDiagnosticInfo(fut, diagCtx);
if (tm != null) {
- U.warn(log, "Pending transaction deadlock detection futures:");
+ U.warn(diagnosticLog, "Pending transaction deadlock detection futures:");
for (IgniteInternalFuture<?> fut : tm.deadlockDetectionFutures())
- U.warn(log, ">>> " + fut);
+ dumpDiagnosticInfo(fut, diagCtx);
}
}
@@ -1578,6 +1623,20 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
}
/**
+ * Logs the future and add diagnostic info closure.
+ *
+ * @param fut Future.
+ * @param ctx Diagnostic prepare context.
+ */
+ private void dumpDiagnosticInfo(IgniteInternalFuture<?> fut,
+ @Nullable IgniteDiagnosticPrepareContext ctx) {
+ U.warn(diagnosticLog, ">>> " + fut);
+
+ if (ctx != null && fut instanceof IgniteDiagnosticAware)
+ ((IgniteDiagnosticAware)fut).addDiagnosticRequest(ctx);
+ }
+
+ /**
* @param deque Deque to poll from.
* @param time Time to wait.
* @param w Worker.
@@ -1698,7 +1757,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
for (CachePartitionExchangeWorkerTask task: futQ) {
if (isExchangeTask(task))
- U.warn(log, ">>> " + task);
+ U.warn(log, ">>> " + ((GridDhtPartitionsExchangeFuture)task).shortInfo());
}
}
@@ -1797,15 +1856,12 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
if (nextDumpTime <= U.currentTimeMillis()) {
try {
- dumpDebugInfo(exchFut.topologyVersion());
+ dumpDebugInfo(exchFut);
}
catch (Exception e) {
U.error(log, "Failed to dump debug information: " + e, e);
}
- if (IgniteSystemProperties.getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
- U.dumpThreads(log);
-
nextDumpTime = U.currentTimeMillis() + nextDumpTimeout(dumpCnt++, futTimeout);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManagerAdapter.java
index 3194ac6..c98a8f1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedManagerAdapter.java
@@ -27,12 +27,19 @@ import org.apache.ignite.lang.IgniteFuture;
* Convenience adapter for cache managers.
*/
public class GridCacheSharedManagerAdapter<K, V> implements GridCacheSharedManager<K, V> {
+
+ /** */
+ private static final String DIAGNOSTIC_LOG_CATEGORY = "org.apache.ignite.internal.diagnostic";
+
/** Context. */
protected GridCacheSharedContext<K, V> cctx;
/** Logger. */
protected IgniteLogger log;
+ /** Diagnostic logger. */
+ protected IgniteLogger diagnosticLog;
+
/** Starting flag. */
private final AtomicBoolean starting = new AtomicBoolean(false);
@@ -50,6 +57,8 @@ public class GridCacheSharedManagerAdapter<K, V> implements GridCacheSharedManag
log = cctx.logger(getClass());
+ diagnosticLog = cctx.logger(DIAGNOSTIC_LOG_CATEGORY);
+
start0();
if (log.isDebugEnabled())
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 75f8366..609e4cf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -36,6 +36,8 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteInterruptedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteDiagnosticAware;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
@@ -100,7 +102,7 @@ import static org.apache.ignite.transactions.TransactionState.PREPARED;
*/
@SuppressWarnings("unchecked")
public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<IgniteInternalTx, GridNearTxPrepareResponse>
- implements GridCacheMvccFuture<GridNearTxPrepareResponse> {
+ implements GridCacheMvccFuture<GridNearTxPrepareResponse>, IgniteDiagnosticAware {
/** */
private static final long serialVersionUID = 0L;
@@ -1567,6 +1569,33 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
}
/** {@inheritDoc} */
+ @Override public void addDiagnosticRequest(IgniteDiagnosticPrepareContext req) {
+ if (!isDone()) {
+ for (IgniteInternalFuture fut : futures()) {
+ if (!fut.isDone() && fut instanceof MiniFuture) {
+ MiniFuture f = (MiniFuture)fut;
+
+ if (!f.node().isLocal()) {
+ GridCacheVersion dhtVer = tx.xidVersion();
+ GridCacheVersion nearVer = tx.nearXidVersion();
+
+ req.remoteTxInfo(f.nodeId, dhtVer, nearVer, "GridDhtTxPrepareFuture " +
+ "waiting for response [node=" + f.nodeId +
+ ", topVer=" + tx.topologyVersion() +
+ ", dhtVer=" + dhtVer +
+ ", nearVer=" + nearVer +
+ ", futId=" + futId +
+ ", miniId=" + f.futId +
+ ", tx=" + tx + ']');
+
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() {
@Override public String apply(IgniteInternalFuture<?> f) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
index 3f612f7..d3bfb3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
@@ -26,6 +26,9 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteDiagnosticAware;
+import org.apache.ignite.internal.IgniteDiagnosticMessage;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
@@ -63,7 +66,7 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
*
*/
public class GridPartitionedSingleGetFuture extends GridCacheFutureAdapter<Object> implements GridCacheFuture<Object>,
- CacheGetFuture {
+ CacheGetFuture, IgniteDiagnosticAware {
/** Logger reference. */
private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
@@ -767,6 +770,26 @@ public class GridPartitionedSingleGetFuture extends GridCacheFutureAdapter<Objec
}
/** {@inheritDoc} */
+ @Override public void addDiagnosticRequest(IgniteDiagnosticPrepareContext ctx) {
+ if (!isDone()) {
+ UUID nodeId;
+ AffinityTopologyVersion topVer;
+
+ synchronized (this) {
+ nodeId = node != null ? node.id() : null;
+ topVer = this.topVer;
+ }
+
+ if (nodeId != null)
+ ctx.basicInfo(nodeId, "GridPartitionedSingleGetFuture waiting for " +
+ "response [node=" + nodeId +
+ ", key=" + key +
+ ", futId=" + futId +
+ ", topVer=" + topVer + ']');
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridPartitionedSingleGetFuture.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index 4442b3a..b88eb47 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -30,6 +30,8 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteDiagnosticAware;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
@@ -83,7 +85,7 @@ import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ;
* Colocated cache lock future.
*/
public final class GridDhtColocatedLockFuture extends GridCacheCompoundIdentityFuture<Boolean>
- implements GridCacheMvccFuture<Boolean> {
+ implements GridCacheMvccFuture<Boolean>, IgniteDiagnosticAware {
/** */
private static final long serialVersionUID = 0L;
@@ -596,13 +598,51 @@ public final class GridDhtColocatedLockFuture extends GridCacheCompoundIdentityF
}
/** {@inheritDoc} */
+ @Override public void addDiagnosticRequest(IgniteDiagnosticPrepareContext ctx) {
+ if (!isDone()) {
+ for (IgniteInternalFuture fut : futures()) {
+ if (!fut.isDone() && isMini(fut)) {
+ MiniFuture m = (MiniFuture)fut;
+
+ AffinityTopologyVersion topVer = null;
+ UUID rmtNodeId = null;
+
+ synchronized (m) {
+ if (!m.rcvRes && !m.node.isLocal()) {
+ rmtNodeId = m.node.id();
+
+ topVer = this.topVer;
+ }
+ }
+
+ if (rmtNodeId != null) {
+ ctx.txKeyInfo(rmtNodeId, cctx.cacheId(), m.keys,
+ "GridDhtColocatedLockFuture waiting for response [node=" + rmtNodeId +
+ ", cache=" + cctx.name() +
+ ", miniId=" + m.futId +
+ ", topVer=" + topVer +
+ ", keys=" + m.keys + ']');
+
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() {
@Override public String apply(IgniteInternalFuture<?> f) {
if (isMini(f)) {
MiniFuture m = (MiniFuture)f;
- return "[node=" + m.node().id() + ", loc=" + m.node().isLocal() + ", done=" + f.isDone() + "]";
+ synchronized (m) {
+ return "[node=" + m.node().id() +
+ ", rcvRes=" + m.rcvRes +
+ ", loc=" + m.node().isLocal() +
+ ", done=" + f.isDone() + "]";
+ }
}
else
return "[loc=true, done=" + f.isDone() + "]";
@@ -610,6 +650,7 @@ public final class GridDhtColocatedLockFuture extends GridCacheCompoundIdentityF
});
return S.toString(GridDhtColocatedLockFuture.class, this,
+ "topVer", topVer,
"innerFuts", futs,
"inTx", inTx(),
"super", super.toString());
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 26406c6..2271a85 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -42,6 +42,8 @@ import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
+import org.apache.ignite.internal.IgniteDiagnosticAware;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -108,7 +110,7 @@ import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYS
*/
@SuppressWarnings({"TypeMayBeWeakened", "unchecked"})
public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityTopologyVersion>
- implements Comparable<GridDhtPartitionsExchangeFuture>, GridDhtTopologyFuture, CachePartitionExchangeWorkerTask {
+ implements Comparable<GridDhtPartitionsExchangeFuture>, GridDhtTopologyFuture, CachePartitionExchangeWorkerTask, IgniteDiagnosticAware {
/** Dummy flag. */
private final boolean dummy;
@@ -1023,14 +1025,11 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
", node=" + cctx.localNodeId() + "]. Dumping pending objects that might be the cause: ");
try {
- cctx.exchange().dumpDebugInfo(topologyVersion());
+ cctx.exchange().dumpDebugInfo(this);
}
catch (Exception e) {
U.error(log, "Failed to dump debug information: " + e, e);
}
-
- if (getBoolean(IGNITE_THREAD_DUMP_ON_EXCHANGE_TIMEOUT, false))
- U.dumpThreads(log);
}
/**
@@ -2157,19 +2156,52 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
}
/** {@inheritDoc} */
+ @Override public void addDiagnosticRequest(IgniteDiagnosticPrepareContext diagCtx) {
+ if (!isDone()) {
+ ClusterNode crd;
+ Set<UUID> remaining;
+
+ synchronized (this) {
+ crd = this.crd;
+ remaining = new HashSet<>(this.remaining);
+ }
+
+ if (crd != null) {
+ if (!crd.isLocal()) {
+ diagCtx.exchangeInfo(crd.id(), topologyVersion(), "Exchange future waiting for coordinator " +
+ "response [crd=" + crd.id() + ", topVer=" + topologyVersion() + ']');
+ }
+ else if (!remaining.isEmpty()){
+ UUID nodeId = remaining.iterator().next();
+
+ diagCtx.exchangeInfo(crd.id(), topologyVersion(), "Exchange future on coordinator waiting for " +
+ "server response [node=" + nodeId + ", topVer=" + topologyVersion() + ']');
+ }
+ }
+ }
+ }
+
+ /**
+ * @return Short information string.
+ */
+ public String shortInfo() {
+ return "GridDhtPartitionsExchangeFuture [topVer=" + topologyVersion() +
+ ", evt=" + (discoEvt != null ? discoEvt.type() : -1) +
+ ", evtNode=" + (discoEvt != null ? discoEvt.eventNode() : null) +
+ ", done=" + isDone() + ']';
+ }
+
+ /** {@inheritDoc} */
@Override public String toString() {
Set<UUID> remaining;
- List<ClusterNode> srvNodes;
synchronized (this) {
remaining = new HashSet<>(this.remaining);
- srvNodes = this.srvNodes != null ? new ArrayList<>(this.srvNodes) : null;
}
return S.toString(GridDhtPartitionsExchangeFuture.class, this,
"evtLatch", evtLatch == null ? "null" : evtLatch.getCount(),
"remaining", remaining,
- "srvNodes", srvNodes,
"super", super.toString());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
index 542ee43..ed83650 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterProcessor.java
@@ -24,25 +24,47 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.events.Event;
import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteDiagnosticInfo;
+import org.apache.ignite.internal.IgniteDiagnosticMessage;
+import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.IgniteProperties;
+import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.cluster.IgniteClusterImpl;
+import org.apache.ignite.internal.managers.communication.GridIoPolicy;
+import org.apache.ignite.internal.managers.communication.GridMessageListener;
+import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.util.GridTimerTask;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.future.IgniteFinishedFutureImpl;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.CI1;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
import org.apache.ignite.spi.discovery.DiscoveryDataBag;
import org.apache.ignite.spi.discovery.DiscoveryDataBag.GridDiscoveryData;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_DIAGNOSTIC_ENABLED;
+import static org.apache.ignite.IgniteSystemProperties.getBoolean;
+import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
+import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
import static org.apache.ignite.internal.GridComponent.DiscoveryDataExchangeType.CLUSTER_PROC;
+import static org.apache.ignite.internal.GridTopic.TOPIC_INTERNAL_DIAGNOSTIC;
import static org.apache.ignite.internal.IgniteVersionUtils.VER_STR;
/**
@@ -72,6 +94,13 @@ public class ClusterProcessor extends GridProcessorAdapter {
@GridToStringExclude
private GridUpdateNotifier verChecker;
+ /** */
+ private final AtomicReference<ConcurrentHashMap<Long, InternalDiagnosticFuture>> diagnosticFutMap =
+ new AtomicReference<>();
+
+ /** */
+ private final AtomicLong diagFutId = new AtomicLong();
+
/**
* @param ctx Kernal context.
*/
@@ -82,6 +111,135 @@ public class ClusterProcessor extends GridProcessorAdapter {
}
/**
+ * @return Diagnostic flag.
+ */
+ public boolean diagnosticEnabled() {
+ return getBoolean(IGNITE_DIAGNOSTIC_ENABLED, true);
+ }
+
+ /** */
+ private final JdkMarshaller marsh = new JdkMarshaller();
+
+ /**
+ * @throws IgniteCheckedException If failed.
+ */
+ public void initDiagnosticListeners() throws IgniteCheckedException {
+ ctx.event().addLocalEventListener(new GridLocalEventListener() {
+ @Override public void onEvent(Event evt) {
+ assert evt instanceof DiscoveryEvent;
+ assert evt.type() == EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT;
+
+ DiscoveryEvent discoEvt = (DiscoveryEvent)evt;
+
+ UUID nodeId = discoEvt.eventNode().id();
+
+ ConcurrentHashMap<Long, InternalDiagnosticFuture> futs = diagnosticFutMap.get();
+
+ if (futs != null) {
+ for (InternalDiagnosticFuture fut : futs.values()) {
+ if (fut.nodeId.equals(nodeId))
+ fut.onDone(new IgniteDiagnosticInfo("Target node failed: " + nodeId));
+ }
+ }
+ }
+ },
+ EVT_NODE_FAILED, EVT_NODE_LEFT);
+
+ ctx.io().addMessageListener(TOPIC_INTERNAL_DIAGNOSTIC, new GridMessageListener() {
+ @Override public void onMessage(UUID nodeId, Object msg) {
+ if (msg instanceof IgniteDiagnosticMessage) {
+ IgniteDiagnosticMessage msg0 = (IgniteDiagnosticMessage)msg;
+
+ if (msg0.request()) {
+ ClusterNode node = ctx.discovery().node(nodeId);
+
+ if (node == null) {
+ if (diagnosticLog.isDebugEnabled()) {
+ diagnosticLog.debug("Skip diagnostic request, sender node left " +
+ "[node=" + nodeId + ", msg=" + msg + ']');
+ }
+
+ return;
+ }
+
+ byte[] diagRes;
+
+ IgniteClosure<GridKernalContext, IgniteDiagnosticInfo> c;
+
+ try {
+ c = msg0.unmarshal(marsh);
+
+ diagRes = marsh.marshal(c.apply(ctx));
+ }
+ catch (Exception e) {
+ U.error(diagnosticLog, "Failed to run diagnostic closure: " + e, e);
+
+ try {
+ IgniteDiagnosticInfo errInfo =
+ new IgniteDiagnosticInfo("Failed to run diagnostic closure: " + e);
+
+ diagRes = marsh.marshal(errInfo);
+ }
+ catch (Exception e0) {
+ U.error(diagnosticLog, "Failed to marshal diagnostic closure result: " + e, e);
+
+ diagRes = null;
+ }
+ }
+
+ IgniteDiagnosticMessage res = IgniteDiagnosticMessage.createResponse(diagRes, msg0.futureId());
+
+ try {
+ ctx.io().sendToGridTopic(node, TOPIC_INTERNAL_DIAGNOSTIC, res, GridIoPolicy.SYSTEM_POOL);
+ }
+ catch (ClusterTopologyCheckedException e) {
+ if (diagnosticLog.isDebugEnabled()) {
+ diagnosticLog.debug("Failed to send diagnostic response, node left " +
+ "[node=" + nodeId + ", msg=" + msg + ']');
+ }
+ }
+ catch (IgniteCheckedException e) {
+ U.error(diagnosticLog, "Failed to send diagnostic response [msg=" + msg0 + "]", e);
+ }
+ }
+ else {
+ InternalDiagnosticFuture fut = diagnosticFuturesMap().get(msg0.futureId());
+
+ if (fut != null) {
+ IgniteDiagnosticInfo res;
+
+ try {
+ res = msg0.unmarshal(marsh);
+
+ if (res == null)
+ res = new IgniteDiagnosticInfo("Remote node failed to marshal response.");
+ }
+ catch (Exception e) {
+ U.error(diagnosticLog, "Failed to unmarshal diagnostic response: " + e, e);
+
+ res = new IgniteDiagnosticInfo("Failed to unmarshal diagnostic response: " + e);
+ }
+
+ fut.onResponse(res);
+ }
+ else
+ U.warn(diagnosticLog, "Failed to find diagnostic message future [msg=" + msg0 + ']');
+ }
+ }
+ else
+ U.warn(diagnosticLog, "Received unexpected message: " + msg);
+ }
+ });
+ }
+
+ /**
+ * @return Logger for diagnostic category.
+ */
+ public IgniteLogger diagnosticLog() {
+ return diagnosticLog;
+ }
+
+ /**
* @return Cluster.
*/
public IgniteClusterImpl get() {
@@ -188,6 +346,7 @@ public class ClusterProcessor extends GridProcessorAdapter {
if (verChecker != null)
verChecker.stop();
+ ctx.io().removeMessageListener(TOPIC_INTERNAL_DIAGNOSTIC);
}
/**
@@ -212,6 +371,103 @@ public class ClusterProcessor extends GridProcessorAdapter {
}
/**
+ * Sends diagnostic message closure to remote node. When response received dumps
+ * remote message and local communication info about connection(s) with remote node.
+ *
+ * @param nodeId Target node ID.
+ * @param c Closure to send.
+ * @param baseMsg Local message to log.
+ * @return Message future.
+ */
+ public IgniteInternalFuture<String> requestDiagnosticInfo(final UUID nodeId,
+ IgniteClosure<GridKernalContext, IgniteDiagnosticInfo> c,
+ final String baseMsg) {
+ final GridFutureAdapter<String> infoFut = new GridFutureAdapter<>();
+
+ final IgniteInternalFuture<IgniteDiagnosticInfo> rmtFut = sendDiagnosticMessage(nodeId, c);
+
+ rmtFut.listen(new CI1<IgniteInternalFuture<IgniteDiagnosticInfo>>() {
+ @Override public void apply(IgniteInternalFuture<IgniteDiagnosticInfo> fut) {
+ String rmtMsg;
+
+ try {
+ rmtMsg = fut.get().message();
+ }
+ catch (Exception e) {
+ rmtMsg = "Diagnostic processing error: " + e;
+ }
+
+ final String rmtMsg0 = rmtMsg;
+
+ IgniteInternalFuture<String> locFut = IgniteDiagnosticMessage.dumpCommunicationInfo(ctx, nodeId);
+
+ locFut.listen(new CI1<IgniteInternalFuture<String>>() {
+ @Override public void apply(IgniteInternalFuture<String> locFut) {
+ String locMsg;
+
+ try {
+ locMsg = locFut.get();
+ }
+ catch (Exception e) {
+ locMsg = "Failed to get info for local node: " + e;
+ }
+
+ String msg = baseMsg + U.nl() +
+ "Remote node information:" + U.nl() + rmtMsg0 +
+ U.nl() + "Local communication statistics:" + U.nl() +
+ locMsg;
+
+ infoFut.onDone(msg);
+ }
+ });
+ }
+ });
+
+ return infoFut;
+ }
+
+ /**
+ * @param nodeId Target node ID.
+ * @param c Message closure.
+ * @return Message future.
+ */
+ private IgniteInternalFuture<IgniteDiagnosticInfo> sendDiagnosticMessage(UUID nodeId,
+ IgniteClosure<GridKernalContext, IgniteDiagnosticInfo> c) {
+ try {
+ IgniteDiagnosticMessage msg = IgniteDiagnosticMessage.createRequest(marsh,
+ c,
+ diagFutId.getAndIncrement());
+
+ InternalDiagnosticFuture fut = new InternalDiagnosticFuture(nodeId, msg.futureId());
+
+ diagnosticFuturesMap().put(msg.futureId(), fut);
+
+ ctx.io().sendToGridTopic(nodeId, TOPIC_INTERNAL_DIAGNOSTIC, msg, GridIoPolicy.SYSTEM_POOL);
+
+ return fut;
+ }
+ catch (Exception e) {
+ U.error(diagnosticLog, "Failed to send diagnostic message: " + e);
+
+ return new GridFinishedFuture<>(new IgniteDiagnosticInfo("Failed to send diagnostic message: " + e));
+ }
+ }
+
+ /**
+ * @return Diagnostic messages futures map.
+ */
+ private ConcurrentHashMap<Long, InternalDiagnosticFuture> diagnosticFuturesMap() {
+ ConcurrentHashMap<Long, InternalDiagnosticFuture> map = diagnosticFutMap.get();
+
+ if (map == null) {
+ if (!diagnosticFutMap.compareAndSet(null, map = new ConcurrentHashMap<>()))
+ map = diagnosticFutMap.get();
+ }
+
+ return map;
+ }
+
+ /**
* Update notifier timer task.
*/
private static class UpdateNotifierTimerTask extends GridTimerTask {
@@ -279,4 +535,47 @@ public class ClusterProcessor extends GridProcessorAdapter {
}
}
}
+
+ /**
+ *
+ */
+ class InternalDiagnosticFuture extends GridFutureAdapter<IgniteDiagnosticInfo> {
+ /** */
+ private final long id;
+
+ /** */
+ private final UUID nodeId;
+
+ /**
+ * @param nodeId Target node ID.
+ * @param id Future ID.
+ */
+ InternalDiagnosticFuture(UUID nodeId, long id) {
+ this.nodeId = nodeId;
+ this.id = id;
+ }
+
+ /**
+ * @param res Response.
+ */
+ public void onResponse(IgniteDiagnosticInfo res) {
+ onDone(res);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean onDone(@Nullable IgniteDiagnosticInfo res, @Nullable Throwable err) {
+ if (super.onDone(res, err)) {
+ diagnosticFuturesMap().remove(id);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(InternalDiagnosticFuture.class, this);
+ }
+ }
}
\ No newline at end of file
[32/39] ignite git commit: ignite-5155 Added possibility to receive
diagnostic information from remote nodes for hanging cache futures
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 66993ea..3591703 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -54,7 +54,9 @@ import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
+import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.nio.ssl.GridNioSslFilter;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.F;
@@ -66,6 +68,7 @@ import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.lang.IgniteReducer;
import org.apache.ignite.lang.IgniteRunnable;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
@@ -704,14 +707,57 @@ public class GridNioServer<T> {
}
/**
- *
+ * @return Future.
*/
- public void dumpStats() {
- U.warn(log, "NIO server statistics [readerSesBalanceCnt=" + readerMoveCnt.get() +
- ", writerSesBalanceCnt=" + writerMoveCnt.get() + ']');
+ public IgniteInternalFuture<String> dumpStats() {
+ String msg = "NIO server statistics [readerSesBalanceCnt=" + readerMoveCnt.get() +
+ ", writerSesBalanceCnt=" + writerMoveCnt.get() + ']';
- for (int i = 0; i < clientWorkers.size(); i++)
- clientWorkers.get(i).offer(new NioOperationFuture<Void>(null, NioOperation.DUMP_STATS));
+ return dumpStats(msg, null);
+ }
+
+ /**
+ * @param msg Message to add.
+ * @param p Session predicate.
+ * @return Future.
+ */
+ public IgniteInternalFuture<String> dumpStats(final String msg, IgnitePredicate<GridNioSession> p) {
+ GridCompoundFuture<String, String> fut = new GridCompoundFuture<>(new IgniteReducer<String, String>() {
+ private final StringBuilder sb = new StringBuilder(msg);
+
+ @Override public boolean collect(@Nullable String msg) {
+ if (!F.isEmpty(msg)) {
+ synchronized (sb) {
+ if (sb.length() > 0)
+ sb.append(U.nl());
+
+ sb.append(msg);
+ }
+ }
+
+ return true;
+ }
+
+ @Override public String reduce() {
+ synchronized (sb) {
+ return sb.toString();
+ }
+ }
+ });
+
+ for (int i = 0; i < clientWorkers.size(); i++) {
+ NioOperationFuture<String> opFut = new NioOperationFuture<>(null, NioOperation.DUMP_STATS);
+
+ opFut.msg = p;
+
+ clientWorkers.get(i).offer(opFut);
+
+ fut.add(opFut);
+ }
+
+ fut.markInitialized();
+
+ return fut;
}
/**
@@ -1812,12 +1858,16 @@ public class GridNioServer<T> {
case DUMP_STATS: {
NioOperationFuture req = (NioOperationFuture)req0;
+ IgnitePredicate<GridNioSession> p =
+ req.msg instanceof IgnitePredicate ? (IgnitePredicate<GridNioSession>)req.msg : null;
+
+ StringBuilder sb = new StringBuilder();
+
try {
- dumpStats();
+ dumpStats(sb, p, p!= null);
}
finally {
- // Complete the request just in case (none should wait on this future).
- req.onDone(true);
+ req.onDone(sb.toString());
}
}
}
@@ -1925,80 +1975,126 @@ public class GridNioServer<T> {
}
/**
- *
+ * @param sb Message builder.
+ * @param keys Keys.
*/
- private void dumpStats() {
- StringBuilder sb = new StringBuilder();
-
- Set<SelectionKey> keys = selector.keys();
-
- sb.append(U.nl())
- .append(">> Selector info [idx=").append(idx)
+ private void dumpSelectorInfo(StringBuilder sb, Set<SelectionKey> keys) {
+ sb.append(">> Selector info [idx=").append(idx)
.append(", keysCnt=").append(keys.size())
.append(", bytesRcvd=").append(bytesRcvd)
.append(", bytesRcvd0=").append(bytesRcvd0)
.append(", bytesSent=").append(bytesSent)
.append(", bytesSent0=").append(bytesSent0)
.append("]").append(U.nl());
+ }
+
+ /**
+ * @param sb Message builder.
+ * @param p Optional session predicate.
+ * @param shortInfo Short info flag.
+ */
+ private void dumpStats(StringBuilder sb,
+ @Nullable IgnitePredicate<GridNioSession> p,
+ boolean shortInfo) {
+ Set<SelectionKey> keys = selector.keys();
+
+ boolean selInfo = p == null;
+
+ if (selInfo)
+ dumpSelectorInfo(sb, keys);
for (SelectionKey key : keys) {
GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
- MessageWriter writer = ses.meta(MSG_WRITER.ordinal());
- MessageReader reader = ses.meta(GridDirectParser.READER_META_KEY);
+ boolean sesInfo = p == null || p.apply(ses);
- sb.append(" Connection info [")
- .append("in=").append(ses.accepted())
- .append(", rmtAddr=").append(ses.remoteAddress())
- .append(", locAddr=").append(ses.localAddress());
+ if (sesInfo) {
+ if (!selInfo) {
+ dumpSelectorInfo(sb, keys);
- GridNioRecoveryDescriptor outDesc = ses.outRecoveryDescriptor();
+ selInfo = true;
+ }
- if (outDesc != null) {
- sb.append(", msgsSent=").append(outDesc.sent())
- .append(", msgsAckedByRmt=").append(outDesc.acked())
- .append(", descIdHash=").append(System.identityHashCode(outDesc));
- }
- else
- sb.append(", outRecoveryDesc=null");
+ sb.append(" Connection info [")
+ .append("in=").append(ses.accepted())
+ .append(", rmtAddr=").append(ses.remoteAddress())
+ .append(", locAddr=").append(ses.localAddress());
- GridNioRecoveryDescriptor inDesc = ses.inRecoveryDescriptor();
+ GridNioRecoveryDescriptor outDesc = ses.outRecoveryDescriptor();
- if (inDesc != null) {
- sb.append(", msgsRcvd=").append(inDesc.received())
- .append(", lastAcked=").append(inDesc.lastAcknowledged())
- .append(", descIdHash=").append(System.identityHashCode(inDesc));
- }
- else
- sb.append(", inRecoveryDesc=null");
+ if (outDesc != null) {
+ sb.append(", msgsSent=").append(outDesc.sent())
+ .append(", msgsAckedByRmt=").append(outDesc.acked())
+ .append(", descIdHash=").append(System.identityHashCode(outDesc));
- sb.append(", bytesRcvd=").append(ses.bytesReceived())
- .append(", bytesRcvd0=").append(ses.bytesReceived0())
- .append(", bytesSent=").append(ses.bytesSent())
- .append(", bytesSent0=").append(ses.bytesSent0())
- .append(", opQueueSize=").append(ses.writeQueueSize())
- .append(", msgWriter=").append(writer != null ? writer.toString() : "null")
- .append(", msgReader=").append(reader != null ? reader.toString() : "null");
+ if (!outDesc.messagesRequests().isEmpty()) {
+ int cnt = 0;
- int cnt = 0;
+ sb.append(", unackedMsgs=[");
- for (SessionWriteRequest req : ses.writeQueue()) {
- if (cnt == 0)
- sb.append(",\n opQueue=[").append(req);
+ for (SessionWriteRequest req : outDesc.messagesRequests()) {
+ if (cnt != 0)
+ sb.append(", ");
+
+ Object msg = req.message();
+
+ if (shortInfo && msg instanceof GridIoMessage)
+ msg = ((GridIoMessage)msg).message().getClass().getSimpleName();
+
+ sb.append(msg);
+
+ if (++cnt == 5)
+ break;
+ }
+
+ sb.append(']');
+ }
+ }
else
- sb.append(',').append(req);
+ sb.append(", outRecoveryDesc=null");
- if (++cnt == 5) {
- sb.append(']');
+ GridNioRecoveryDescriptor inDesc = ses.inRecoveryDescriptor();
- break;
+ if (inDesc != null) {
+ sb.append(", msgsRcvd=").append(inDesc.received())
+ .append(", lastAcked=").append(inDesc.lastAcknowledged())
+ .append(", descIdHash=").append(System.identityHashCode(inDesc));
}
- }
+ else
+ sb.append(", inRecoveryDesc=null");
- sb.append("]").append(U.nl());
- }
+ sb.append(", bytesRcvd=").append(ses.bytesReceived())
+ .append(", bytesRcvd0=").append(ses.bytesReceived0())
+ .append(", bytesSent=").append(ses.bytesSent())
+ .append(", bytesSent0=").append(ses.bytesSent0())
+ .append(", opQueueSize=").append(ses.writeQueueSize());
+
+ if (!shortInfo) {
+ MessageWriter writer = ses.meta(MSG_WRITER.ordinal());
+ MessageReader reader = ses.meta(GridDirectParser.READER_META_KEY);
+
+ sb.append(", msgWriter=").append(writer != null ? writer.toString() : "null")
+ .append(", msgReader=").append(reader != null ? reader.toString() : "null");
+ }
+
+ int cnt = 0;
- U.warn(log, sb.toString());
+ for (SessionWriteRequest req : ses.writeQueue()) {
+ if (cnt == 0)
+ sb.append(",\n opQueue=[").append(req);
+ else
+ sb.append(',').append(req);
+
+ if (++cnt == 5) {
+ sb.append(']');
+
+ break;
+ }
+ }
+
+ sb.append("]");
+ }
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 2e35c6e..5d74a80 100755
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -46,7 +46,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLException;
import org.apache.ignite.Ignite;
@@ -67,6 +66,7 @@ import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.util.GridConcurrentFactory;
import org.apache.ignite.internal.util.GridSpinReadWriteLock;
+import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.ipc.IpcEndpoint;
import org.apache.ignite.internal.util.ipc.IpcToNioAdapter;
@@ -93,6 +93,7 @@ import org.apache.ignite.internal.util.nio.GridTcpNioCommunicationClient;
import org.apache.ignite.internal.util.nio.ssl.BlockingSslHandler;
import org.apache.ignite.internal.util.nio.ssl.GridNioSslFilter;
import org.apache.ignite.internal.util.nio.ssl.GridSslMeta;
+import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.CI2;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
@@ -934,6 +935,10 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
@LoggerResource
private IgniteLogger log;
+ /** Logger. */
+ @LoggerResource(categoryName = "org.apache.ignite.internal.diagnostic")
+ private IgniteLogger diagnosticLog;
+
/** Local IP address. */
private String locAddr;
@@ -1764,83 +1769,141 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
}
/**
+ * @param nodeId Target node ID.
+ * @return Future.
+ */
+ public IgniteInternalFuture<String> dumpNodeStatistics(final UUID nodeId) {
+ StringBuilder sb = new StringBuilder("Communication SPI statistics [rmtNode=").append(nodeId).append(']').append(U.nl());
+
+ dumpInfo(sb, nodeId);
+
+ GridNioServer<Message> nioSrvr = this.nioSrvr;
+
+ if (nioSrvr != null) {
+ sb.append("NIO sessions statistics:");
+
+ IgnitePredicate<GridNioSession> p = new IgnitePredicate<GridNioSession>() {
+ @Override public boolean apply(GridNioSession ses) {
+ ConnectionKey connId = ses.meta(CONN_IDX_META);
+
+ return connId != null && nodeId.equals(connId.nodeId());
+ }
+ };
+
+ return nioSrvr.dumpStats(sb.toString(), p);
+ }
+ else {
+ sb.append(U.nl()).append("GridNioServer is null.");
+
+ return new GridFinishedFuture<>(sb.toString());
+ }
+ }
+
+ /**
* Dumps SPI per-connection stats to logs.
*/
public void dumpStats() {
- IgniteLogger log = this.log;
+ final IgniteLogger log = this.diagnosticLog;
if (log != null) {
- StringBuilder sb = new StringBuilder("Communication SPI recovery descriptors: ").append(U.nl());
-
- for (Map.Entry<ConnectionKey, GridNioRecoveryDescriptor> entry : recoveryDescs.entrySet()) {
- GridNioRecoveryDescriptor desc = entry.getValue();
-
- sb.append(" [key=").append(entry.getKey())
- .append(", msgsSent=").append(desc.sent())
- .append(", msgsAckedByRmt=").append(desc.acked())
- .append(", msgsRcvd=").append(desc.received())
- .append(", lastAcked=").append(desc.lastAcknowledged())
- .append(", reserveCnt=").append(desc.reserveCount())
- .append(", descIdHash=").append(System.identityHashCode(desc))
- .append(']').append(U.nl());
- }
-
- for (Map.Entry<ConnectionKey, GridNioRecoveryDescriptor> entry : outRecDescs.entrySet()) {
- GridNioRecoveryDescriptor desc = entry.getValue();
-
- sb.append(" [key=").append(entry.getKey())
- .append(", msgsSent=").append(desc.sent())
- .append(", msgsAckedByRmt=").append(desc.acked())
- .append(", reserveCnt=").append(desc.reserveCount())
- .append(", connected=").append(desc.connected())
- .append(", reserved=").append(desc.reserved())
- .append(", descIdHash=").append(System.identityHashCode(desc))
- .append(']').append(U.nl());
- }
+ StringBuilder sb = new StringBuilder();
- for (Map.Entry<ConnectionKey, GridNioRecoveryDescriptor> entry : inRecDescs.entrySet()) {
- GridNioRecoveryDescriptor desc = entry.getValue();
-
- sb.append(" [key=").append(entry.getKey())
- .append(", msgsRcvd=").append(desc.received())
- .append(", lastAcked=").append(desc.lastAcknowledged())
- .append(", reserveCnt=").append(desc.reserveCount())
- .append(", connected=").append(desc.connected())
- .append(", reserved=").append(desc.reserved())
- .append(", handshakeIdx=").append(desc.handshakeIndex())
- .append(", descIdHash=").append(System.identityHashCode(desc))
- .append(']').append(U.nl());
- }
+ dumpInfo(sb, null);
- sb.append("Communication SPI clients: ").append(U.nl());
+ U.warn(log, sb.toString());
- for (Map.Entry<UUID, GridCommunicationClient[]> entry : clients.entrySet()) {
- UUID nodeId = entry.getKey();
- GridCommunicationClient[] clients0 = entry.getValue();
+ GridNioServer<Message> nioSrvr = this.nioSrvr;
- for (GridCommunicationClient client : clients0) {
- if (client != null) {
- sb.append(" [node=").append(nodeId)
- .append(", client=").append(client)
- .append(']').append(U.nl());
+ if (nioSrvr != null) {
+ nioSrvr.dumpStats().listen(new CI1<IgniteInternalFuture<String>>() {
+ @Override public void apply(IgniteInternalFuture<String> fut) {
+ try {
+ U.warn(log, fut.get());
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to dump NIO server statistics: " + e, e);
+ }
}
- }
+ });
}
+ }
+ }
- U.warn(log, sb.toString());
+ /**
+ * @param sb Message builder.
+ * @param dstNodeId Target node ID.
+ */
+ private void dumpInfo(StringBuilder sb, UUID dstNodeId) {
+ sb.append("Communication SPI recovery descriptors: ").append(U.nl());
+
+ for (Map.Entry<ConnectionKey, GridNioRecoveryDescriptor> entry : recoveryDescs.entrySet()) {
+ GridNioRecoveryDescriptor desc = entry.getValue();
+
+ if (dstNodeId != null && !dstNodeId.equals(entry.getKey().nodeId()))
+ continue;
+
+ sb.append(" [key=").append(entry.getKey())
+ .append(", msgsSent=").append(desc.sent())
+ .append(", msgsAckedByRmt=").append(desc.acked())
+ .append(", msgsRcvd=").append(desc.received())
+ .append(", lastAcked=").append(desc.lastAcknowledged())
+ .append(", reserveCnt=").append(desc.reserveCount())
+ .append(", descIdHash=").append(System.identityHashCode(desc))
+ .append(']').append(U.nl());
}
- GridNioServer<Message> nioSrvr = this.nioSrvr;
+ for (Map.Entry<ConnectionKey, GridNioRecoveryDescriptor> entry : outRecDescs.entrySet()) {
+ GridNioRecoveryDescriptor desc = entry.getValue();
- if (nioSrvr != null)
- nioSrvr.dumpStats();
- }
+ if (dstNodeId != null && !dstNodeId.equals(entry.getKey().nodeId()))
+ continue;
- /** */
- private final ThreadLocal<Integer> threadConnIdx = new ThreadLocal<>();
+ sb.append(" [key=").append(entry.getKey())
+ .append(", msgsSent=").append(desc.sent())
+ .append(", msgsAckedByRmt=").append(desc.acked())
+ .append(", reserveCnt=").append(desc.reserveCount())
+ .append(", connected=").append(desc.connected())
+ .append(", reserved=").append(desc.reserved())
+ .append(", descIdHash=").append(System.identityHashCode(desc))
+ .append(']').append(U.nl());
+ }
- /** */
- private final AtomicInteger connIdx = new AtomicInteger();
+ for (Map.Entry<ConnectionKey, GridNioRecoveryDescriptor> entry : inRecDescs.entrySet()) {
+ GridNioRecoveryDescriptor desc = entry.getValue();
+
+ if (dstNodeId != null && !dstNodeId.equals(entry.getKey().nodeId()))
+ continue;
+
+ sb.append(" [key=").append(entry.getKey())
+ .append(", msgsRcvd=").append(desc.received())
+ .append(", lastAcked=").append(desc.lastAcknowledged())
+ .append(", reserveCnt=").append(desc.reserveCount())
+ .append(", connected=").append(desc.connected())
+ .append(", reserved=").append(desc.reserved())
+ .append(", handshakeIdx=").append(desc.handshakeIndex())
+ .append(", descIdHash=").append(System.identityHashCode(desc))
+ .append(']').append(U.nl());
+ }
+
+ sb.append("Communication SPI clients: ").append(U.nl());
+
+ for (Map.Entry<UUID, GridCommunicationClient[]> entry : clients.entrySet()) {
+ UUID clientNodeId = entry.getKey();
+
+ if (dstNodeId != null && !dstNodeId.equals(clientNodeId))
+ continue;
+
+ GridCommunicationClient[] clients0 = entry.getValue();
+
+ for (GridCommunicationClient client : clients0) {
+ if (client != null) {
+ sb.append(" [node=").append(clientNodeId)
+ .append(", client=").append(client)
+ .append(']').append(U.nl());
+ }
+ }
+ }
+ }
/** {@inheritDoc} */
@Override public Map<String, Object> getNodeAttributes() throws IgniteSpiException {
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java
new file mode 100644
index 0000000..08dbc66
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/IgniteDiagnosticMessagesTest.java
@@ -0,0 +1,255 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.managers;
+
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteDiagnosticPrepareContext;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.TestRecordingCommunicationSpi;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetResponse;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridStringLogger;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheMode.REPLICATED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class IgniteDiagnosticMessagesTest extends GridCommonAbstractTest {
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private boolean client;
+
+ /** */
+ private Integer connectionsPerNode;
+
+ /** */
+ private boolean testSpi;
+
+ /** */
+ private GridStringLogger strLog;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ if (testSpi)
+ cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
+
+ if (connectionsPerNode != null)
+ ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setConnectionsPerNode(connectionsPerNode);
+
+ cfg.setClientMode(client);
+
+ if (strLog != null) {
+ cfg.setGridLogger(strLog);
+
+ strLog = null;
+ }
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDiagnosticMessages1() throws Exception {
+ checkBasicDiagnosticInfo();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDiagnosticMessages2() throws Exception {
+ connectionsPerNode = 5;
+
+ checkBasicDiagnosticInfo();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testLongRunning() throws Exception {
+ System.setProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, "3500");
+
+ try {
+ testSpi = true;
+
+ startGrid(0);
+
+ GridStringLogger strLog = this.strLog = new GridStringLogger();
+
+ startGrid(1);
+
+ awaitPartitionMapExchange();
+
+ CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setCacheMode(PARTITIONED);
+ ccfg.setAtomicityMode(TRANSACTIONAL);
+
+ final Ignite node0 = ignite(0);
+
+ node0.createCache(ccfg);
+
+ final Ignite node1 = ignite(1);
+
+ UUID id0 = node0.cluster().localNode().id();
+ UUID id1 = node1.cluster().localNode().id();
+
+ TestRecordingCommunicationSpi.spi(node0).blockMessages(GridNearSingleGetResponse.class, node1.name());
+
+ IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ Integer key = primaryKey(node0.cache(DEFAULT_CACHE_NAME));
+
+ node1.cache(DEFAULT_CACHE_NAME).get(key);
+
+ return null;
+ }
+ }, "get");
+
+ U.sleep(10_000);
+
+ assertFalse(fut.isDone());
+
+ TestRecordingCommunicationSpi.spi(node0).stopBlock();
+
+ fut.get();
+
+ String log = strLog.toString();
+
+ assertTrue(log.contains("GridPartitionedSingleGetFuture waiting for response [node=" + id0));
+ assertTrue(log.contains("General node info [id=" + id0));
+ }
+ finally {
+ System.clearProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT);
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void checkBasicDiagnosticInfo() throws Exception {
+ startGrids(3);
+
+ client = true;
+
+ startGrid(3);
+
+ startGrid(4);
+
+ CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setCacheMode(REPLICATED);
+ ccfg.setAtomicityMode(TRANSACTIONAL);
+
+ ignite(0).createCache(ccfg);
+
+ awaitPartitionMapExchange();
+
+ sendDiagnostic();
+
+ for (int i = 0; i < 5; i++) {
+ final IgniteCache<Object, Object> cache = ignite(i).cache(DEFAULT_CACHE_NAME);
+
+ // Put from multiple threads to create multiple connections.
+ GridTestUtils.runMultiThreaded(new Runnable() {
+ @Override public void run() {
+ for (int j = 0; j < 10; j++)
+ cache.put(ThreadLocalRandom.current().nextInt(), j);
+ }
+ }, 10, "cache-thread");
+ }
+
+ sendDiagnostic();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void sendDiagnostic() throws Exception {
+ for (int i = 0; i < 5; i++) {
+ IgniteKernal node = (IgniteKernal)ignite(i);
+
+ for (int j = 0; j < 5; j++) {
+ if (i != j) {
+ ClusterNode dstNode = ignite(j).cluster().localNode();
+
+ final GridFutureAdapter<String> fut = new GridFutureAdapter<>();
+
+ IgniteDiagnosticPrepareContext ctx = new IgniteDiagnosticPrepareContext(node.getLocalNodeId());
+
+ ctx.basicInfo(dstNode.id(), "Test diagnostic");
+
+ ctx.send(node.context(), new IgniteInClosure<IgniteInternalFuture<String>>() {
+ @Override public void apply(IgniteInternalFuture<String> diagFut) {
+ try {
+ fut.onDone(diagFut.get());
+ }
+ catch (Exception e) {
+ fut.onDone(e);
+ }
+ }
+ });
+
+ String msg = fut.get();
+
+ assertTrue("Unexpected message: " + msg,
+ msg.contains("Test diagnostic") &&
+ msg.contains("General node info [id=" + dstNode.id() + ", client=" + dstNode.isClient() + ", discoTopVer=AffinityTopologyVersion [topVer=5, minorTopVer=") &&
+ msg.contains("Partitions exchange info [readyVer=AffinityTopologyVersion [topVer=5, minorTopVer="));
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5d98ccec/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index 3305058..140b1a5 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -35,6 +35,7 @@ import org.apache.ignite.internal.GridStopWithCancelSelfTest;
import org.apache.ignite.internal.IgniteLocalNodeMapBeforeStartTest;
import org.apache.ignite.internal.IgniteSlowClientDetectionSelfTest;
import org.apache.ignite.internal.MarshallerContextLockingSelfTest;
+import org.apache.ignite.internal.managers.IgniteDiagnosticMessagesTest;
import org.apache.ignite.internal.processors.affinity.GridAffinityProcessorRendezvousSelfTest;
import org.apache.ignite.internal.processors.cache.GridLocalIgniteSerializationTest;
import org.apache.ignite.internal.processors.cache.GridProjectionForCachesOnDaemonNodeSelfTest;
@@ -52,8 +53,8 @@ import org.apache.ignite.internal.processors.database.BPlusTreeSelfTest;
import org.apache.ignite.internal.processors.database.FreeListImplSelfTest;
import org.apache.ignite.internal.processors.database.MemoryMetricsSelfTest;
import org.apache.ignite.internal.processors.database.MetadataStorageSelfTest;
-import org.apache.ignite.internal.processors.odbc.OdbcEscapeSequenceSelfTest;
import org.apache.ignite.internal.processors.odbc.OdbcConfigurationValidationSelfTest;
+import org.apache.ignite.internal.processors.odbc.OdbcEscapeSequenceSelfTest;
import org.apache.ignite.internal.processors.service.ClosureServiceClientsNodesTest;
import org.apache.ignite.internal.product.GridProductVersionSelfTest;
import org.apache.ignite.internal.util.nio.IgniteExceptionInNioWorkerSelfTest;
@@ -173,6 +174,9 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTestSuite(IgniteMarshallerCacheClassNameConflictTest.class);
suite.addTestSuite(IgniteMarshallerCacheClientRequestsMappingOnMissTest.class);
+
+ suite.addTestSuite(IgniteDiagnosticMessagesTest.class);
+
return suite;
}
}
[28/39] ignite git commit: Fixed GridH2IndexRangeRequest
serialization.
Posted by sb...@apache.org.
Fixed GridH2IndexRangeRequest serialization.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/03ec1075
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/03ec1075
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/03ec1075
Branch: refs/heads/ignite-5272
Commit: 03ec10757f62118753a7bfa02749c21c6eea3d51
Parents: 7ceb201
Author: devozerov <vo...@gridgain.com>
Authored: Fri Jun 9 14:41:52 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jun 9 14:41:52 2017 +0300
----------------------------------------------------------------------
.../processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/03ec1075/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
index b030632..7024884 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/msg/GridH2IndexRangeRequest.java
@@ -174,6 +174,8 @@ public class GridH2IndexRangeRequest implements Message {
if (!writer.writeInt("segmentId", segmentId))
return false;
+ writer.incrementState();
+
case 5:
if (!writer.writeInt("originSegId", originSegmentId))
return false;
[39/39] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5272
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-5272
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/721d5684
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/721d5684
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/721d5684
Branch: refs/heads/ignite-5272
Commit: 721d5684faa13b2fca1b493e8f1e07e60af828fc
Parents: 75ef7f3
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 13 10:46:14 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 13 10:46:14 2017 +0300
----------------------------------------------------------------------
.../processors/cache/CacheAffinitySharedManager.java | 13 +++----------
.../cache/ClientCacheChangeDummyDiscoveryMessage.java | 3 ++-
.../distributed/dht/GridDhtPartitionTopology.java | 2 +-
.../cache/distributed/dht/GridDhtTxLocalAdapter.java | 2 +-
.../GridNearAtomicAbstractSingleUpdateRequest.java | 2 --
.../atomic/GridNearAtomicAbstractUpdateRequest.java | 10 ----------
.../dht/atomic/GridNearAtomicFullUpdateRequest.java | 2 --
.../GridNearAtomicSingleUpdateFilterRequest.java | 2 --
.../dht/atomic/GridNearAtomicSingleUpdateFuture.java | 4 ----
.../GridNearAtomicSingleUpdateInvokeRequest.java | 2 --
.../dht/atomic/GridNearAtomicSingleUpdateRequest.java | 2 --
.../dht/atomic/GridNearAtomicUpdateFuture.java | 2 --
12 files changed, 7 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index 64ca70c..e74437c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -324,13 +324,6 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
}
/**
- * @param exchActions Cache change requests to execute on exchange.
- */
- private void updateCachesInfo(ExchangeActions exchActions) {
- caches.updateCachesInfo(exchActions);
- }
-
- /**
* @param reqId Request ID.
* @param startReqs Client cache start request.
* @return Descriptors for caches to start.
@@ -582,7 +575,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
{
assert exchActions != null && !exchActions.empty() : exchActions;
- updateCachesInfo(exchActions);
+ caches.updateCachesInfo(exchActions);
// Affinity did not change for existing caches.
forAllCacheGroups(crd && lateAffAssign, new IgniteInClosureX<GridAffinityAssignmentCache>() {
@@ -2074,10 +2067,10 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
*
*/
static class CachesInfo {
- /** Registered caches (updated from exchange thread). */
+ /** Registered cache groups (updated from exchange thread). */
private final ConcurrentHashMap<Integer, CacheGroupDescriptor> registeredGrps = new ConcurrentHashMap<>();
- /** */
+ /** Registered caches (updated from exchange thread). */
private final ConcurrentHashMap<String, DynamicCacheDescriptor> registeredCaches = new ConcurrentHashMap<>();
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDummyDiscoveryMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDummyDiscoveryMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDummyDiscoveryMessage.java
index d4e6d2d..c33ee67 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDummyDiscoveryMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClientCacheChangeDummyDiscoveryMessage.java
@@ -28,7 +28,8 @@ import org.jetbrains.annotations.Nullable;
/**
* Dummy discovery message which is not really sent via ring, it is just added in local discovery worker queue.
*/
-public class ClientCacheChangeDummyDiscoveryMessage implements DiscoveryCustomMessage, CachePartitionExchangeWorkerTask {
+public class ClientCacheChangeDummyDiscoveryMessage implements DiscoveryCustomMessage,
+ CachePartitionExchangeWorkerTask {
/** */
private final UUID reqId;
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
index 92a2981..acb822c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
@@ -252,7 +252,7 @@ public interface GridDhtPartitionTopology {
* This method should be called on topology coordinator after all partition messages are received.
*
* @param discoEvt Discovery event for which we detect lost partitions.
- * @return {@code True} if partitons state got updated.
+ * @return {@code True} if partitions state got updated.
*/
public boolean detectLostPartitions(DiscoveryEvent discoEvt);
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
index 1dc1681..c027ab9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
@@ -616,7 +616,7 @@ public abstract class GridDhtTxLocalAdapter extends IgniteTxLocalAdapter {
null,
skipStore,
keepBinary,
- CU.isNearEnabled(cacheCtx));
+ nearCache);
if (read)
txEntry.ttl(accessTtl);
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
index 899bc2a..7022561 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractSingleUpdateRequest.java
@@ -60,7 +60,6 @@ public abstract class GridNearAtomicAbstractSingleUpdateRequest extends GridNear
*/
protected GridNearAtomicAbstractSingleUpdateRequest(
int cacheId,
- boolean nearCache,
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
@@ -72,7 +71,6 @@ public abstract class GridNearAtomicAbstractSingleUpdateRequest extends GridNear
boolean addDepInfo
) {
super(cacheId,
- nearCache,
nodeId,
futId,
topVer,
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
index e910386..62618f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateRequest.java
@@ -125,7 +125,6 @@ public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheIdMes
*/
protected GridNearAtomicAbstractUpdateRequest(
int cacheId,
- boolean nearCache,
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
@@ -211,15 +210,6 @@ public abstract class GridNearAtomicAbstractUpdateRequest extends GridCacheIdMes
*/
public boolean nearCache() {
return isFlag(NEAR_CACHE_FLAG_MASK);
- if (nearCache)
- setFlag(true, NEAR_CACHE_FLAG_MASK);
- }
-
- /**
- * @return {@code True} if near cache is enabled on node initiated operation.
- */
- public boolean nearCache() {
- return isFlag(NEAR_CACHE_FLAG_MASK);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
index 3b260a1..4b9aef0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicFullUpdateRequest.java
@@ -135,7 +135,6 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
*/
GridNearAtomicFullUpdateRequest(
int cacheId,
- boolean nearCache,
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
@@ -151,7 +150,6 @@ public class GridNearAtomicFullUpdateRequest extends GridNearAtomicAbstractUpdat
int maxEntryCnt
) {
super(cacheId,
- nearCache,
nodeId,
futId,
topVer,
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
index 9bfa223..5c66bc4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFilterRequest.java
@@ -70,7 +70,6 @@ public class GridNearAtomicSingleUpdateFilterRequest extends GridNearAtomicSingl
*/
GridNearAtomicSingleUpdateFilterRequest(
int cacheId,
- boolean nearCache,
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
@@ -84,7 +83,6 @@ public class GridNearAtomicSingleUpdateFilterRequest extends GridNearAtomicSingl
) {
super(
cacheId,
- nearCache,
nodeId,
futId,
topVer,
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
index 9e4f5a9..60d94b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
@@ -574,7 +574,6 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
if (op == TRANSFORM) {
req = new GridNearAtomicSingleUpdateInvokeRequest(
cctx.cacheId(),
- nearEnabled,
primary.id(),
futId,
topVer,
@@ -590,7 +589,6 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
if (filter == null || filter.length == 0) {
req = new GridNearAtomicSingleUpdateRequest(
cctx.cacheId(),
- nearEnabled,
primary.id(),
futId,
topVer,
@@ -604,7 +602,6 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
else {
req = new GridNearAtomicSingleUpdateFilterRequest(
cctx.cacheId(),
- nearEnabled,
primary.id(),
futId,
topVer,
@@ -621,7 +618,6 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
else {
req = new GridNearAtomicFullUpdateRequest(
cctx.cacheId(),
- nearEnabled,
primary.id(),
futId,
topVer,
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
index 297de61..b1fb530 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateInvokeRequest.java
@@ -88,7 +88,6 @@ public class GridNearAtomicSingleUpdateInvokeRequest extends GridNearAtomicSingl
*/
GridNearAtomicSingleUpdateInvokeRequest(
int cacheId,
- boolean nearCache,
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
@@ -102,7 +101,6 @@ public class GridNearAtomicSingleUpdateInvokeRequest extends GridNearAtomicSingl
) {
super(
cacheId,
- nearCache,
nodeId,
futId,
topVer,
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
index 8357e74..dd3a7be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateRequest.java
@@ -80,7 +80,6 @@ public class GridNearAtomicSingleUpdateRequest extends GridNearAtomicAbstractSin
*/
GridNearAtomicSingleUpdateRequest(
int cacheId,
- boolean nearCache,
UUID nodeId,
long futId,
@NotNull AffinityTopologyVersion topVer,
@@ -92,7 +91,6 @@ public class GridNearAtomicSingleUpdateRequest extends GridNearAtomicAbstractSin
boolean addDepInfo
) {
super(cacheId,
- nearCache,
nodeId,
futId,
topVer,
http://git-wip-us.apache.org/repos/asf/ignite/blob/721d5684/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index dc39888..190ed3f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -1015,7 +1015,6 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
GridNearAtomicFullUpdateRequest req = new GridNearAtomicFullUpdateRequest(
cctx.cacheId(),
- nearEnabled,
nodeId,
futId,
topVer,
@@ -1126,7 +1125,6 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
GridNearAtomicFullUpdateRequest req = new GridNearAtomicFullUpdateRequest(
cctx.cacheId(),
- nearEnabled,
primary.id(),
futId,
topVer,
[27/39] ignite git commit: IGNITE-4431: Include date into the default
format of the ignite log. - Fixes #2109.
Posted by sb...@apache.org.
IGNITE-4431: Include date into the default format of the ignite log. - Fixes #2109.
Signed-off-by: shroman <rs...@yahoo.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7ceb2016
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7ceb2016
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7ceb2016
Branch: refs/heads/ignite-5272
Commit: 7ceb20169748c99116e21400ed12f426d0771e00
Parents: c63988a
Author: shroman <rs...@yahoo.com>
Authored: Fri Jun 9 17:36:01 2017 +0900
Committer: shroman <rs...@yahoo.com>
Committed: Fri Jun 9 17:36:01 2017 +0900
----------------------------------------------------------------------
config/ignite-log4j.xml | 6 +++---
config/ignite-log4j2.xml | 6 +++---
modules/clients/src/test/resources/log4j.xml | 2 +-
modules/core/src/test/config/log4j-test.xml | 6 +++---
modules/core/src/test/config/log4j2-test.xml | 6 +++---
modules/core/src/test/config/log4j2-verbose-test.xml | 4 ++--
.../org/apache/ignite/loadtest/GridSingleExecutionTest.java | 4 ++--
.../ignite/loadtests/cache/GridCacheAbstractLoadTest.java | 4 ++--
.../apache/ignite/testframework/junits/GridAbstractTest.java | 4 ++--
.../testframework/junits/logger/GridTestLog4jLogger.java | 4 ++--
.../main/java/org/apache/ignite/logger/log4j/Log4JLogger.java | 4 ++--
.../ignite/logger/log4j/GridLog4jCorrectFileNameTest.java | 2 +-
.../java/org/apache/ignite/logger/log4j2/Log4J2Logger.java | 2 +-
.../Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml | 2 +-
modules/visor-plugins/src/main/java/log4j.properties | 2 +-
.../web-console/web-agent/src/main/resources/log4j.properties | 6 +++---
16 files changed, 32 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/config/ignite-log4j.xml
----------------------------------------------------------------------
diff --git a/config/ignite-log4j.xml b/config/ignite-log4j.xml
index 9d4521a..7669af3 100644
--- a/config/ignite-log4j.xml
+++ b/config/ignite-log4j.xml
@@ -37,7 +37,7 @@
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
@@ -59,7 +59,7 @@
<!-- The default pattern: Date Priority [Category] Message\n -->
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
@@ -74,7 +74,7 @@
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/config/ignite-log4j2.xml
----------------------------------------------------------------------
diff --git a/config/ignite-log4j2.xml b/config/ignite-log4j2.xml
index c9c349e..2c88e57 100644
--- a/config/ignite-log4j2.xml
+++ b/config/ignite-log4j2.xml
@@ -20,12 +20,12 @@
<Configuration>
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
<ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="ACCEPT"/>
</Console>
<Console name="CONSOLE_ERR" target="SYSTEM_ERR">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</Console>
<Routing name="FILE">
@@ -33,7 +33,7 @@
<Route>
<RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="6" modulate="true" />
<SizeBasedTriggeringPolicy size="10 MB" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/clients/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/log4j.xml b/modules/clients/src/test/resources/log4j.xml
index 33a723c..5c19f0f 100644
--- a/modules/clients/src/test/resources/log4j.xml
+++ b/modules/clients/src/test/resources/log4j.xml
@@ -75,7 +75,7 @@
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/config/log4j-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j-test.xml b/modules/core/src/test/config/log4j-test.xml
index 638b260..1e88dfc 100644
--- a/modules/core/src/test/config/log4j-test.xml
+++ b/modules/core/src/test/config/log4j-test.xml
@@ -35,7 +35,7 @@
<!-- The default pattern: Date Priority [Category] Message\n -->
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
<!-- Do not log beyond INFO level. -->
@@ -57,7 +57,7 @@
<!-- The default pattern: Date Priority [Category] Message\n -->
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
@@ -71,7 +71,7 @@
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/config/log4j2-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j2-test.xml b/modules/core/src/test/config/log4j2-test.xml
index 30599cc..81b14a8 100644
--- a/modules/core/src/test/config/log4j2-test.xml
+++ b/modules/core/src/test/config/log4j2-test.xml
@@ -20,12 +20,12 @@
<Configuration>
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
<ThresholdFilter level="ERROR" onMatch="DENY" onMismatch="ACCEPT"/>
</Console>
<Console name="CONSOLE_ERR" target="SYSTEM_ERR">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</Console>
<Routing name="FILE">
@@ -33,7 +33,7 @@
<Route>
<RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="6" modulate="true" />
<SizeBasedTriggeringPolicy size="10 MB" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/config/log4j2-verbose-test.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/log4j2-verbose-test.xml b/modules/core/src/test/config/log4j2-verbose-test.xml
index b870dc8..50366d3 100644
--- a/modules/core/src/test/config/log4j2-verbose-test.xml
+++ b/modules/core/src/test/config/log4j2-verbose-test.xml
@@ -20,7 +20,7 @@
<Configuration>
<Appenders>
<Console name="CONSOLE_ERR" target="SYSTEM_ERR">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</Console>
<Routing name="FILE">
@@ -28,7 +28,7 @@
<Route>
<RollingFile name="Rolling-${sys:nodeId}" fileName="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}.log"
filePattern="${sys:IGNITE_HOME}/work/log/ignite-${sys:nodeId}-%i-%d{yyyy-MM-dd}.log.gz">
- <PatternLayout pattern="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <PatternLayout pattern="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="6" modulate="true" />
<SizeBasedTriggeringPolicy size="10 MB" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java b/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
index 559cfc9..59eb1ef 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
@@ -140,7 +140,7 @@ public final class GridSingleExecutionTest {
// Configure output that should go to System.out
RollingFileAppender fileApp;
- String fmt = "[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n";
+ String fmt = "[%d{ISO8601}][%-5p][%t][%c{1}] %m%n";
try {
fileApp = new RollingFileAppender(new PatternLayout(fmt), fileName);
@@ -338,4 +338,4 @@ public final class GridSingleExecutionTest {
return null;
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
index 8c351d7..8a94899 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
@@ -272,7 +272,7 @@ abstract class GridCacheAbstractLoadTest {
// Configure output that should go to System.out
RollingFileAppender fileApp;
- String fmt = "[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n";
+ String fmt = "[%d{ISO8601}][%-5p][%t][%c{1}] %m%n";
try {
fileApp = new RollingFileAppender(new PatternLayout(fmt), fileName);
@@ -391,4 +391,4 @@ abstract class GridCacheAbstractLoadTest {
return cfg;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index a5a2401..aea7a2f 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -335,7 +335,7 @@ public abstract class GridAbstractTest extends TestCase {
c.setName("CONSOLE_ERR");
c.setTarget("System.err");
c.setThreshold(Priority.WARN);
- c.setLayout(new PatternLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"));
+ c.setLayout(new PatternLayout("[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"));
c.activateOptions();
@@ -350,7 +350,7 @@ public abstract class GridAbstractTest extends TestCase {
file.setAppend(false);
file.setMaxFileSize("10MB");
file.setMaxBackupIndex(10);
- file.setLayout(new PatternLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"));
+ file.setLayout(new PatternLayout("[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"));
file.activateOptions();
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
index 6a46c7d..52813b9 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/logger/GridTestLog4jLogger.java
@@ -123,7 +123,7 @@ public class GridTestLog4jLogger implements IgniteLogger, LoggerNodeIdAware {
* log level.
*
* @param init If {@code true}, then a default console appender with
- * following pattern layout will be created: {@code %d{ABSOLUTE} %-5p [%c{1}] %m%n}.
+ * following pattern layout will be created: {@code %d{ISO8601} %-5p [%c{1}] %m%n}.
* If {@code false}, then no implicit initialization will take place,
* and {@code Log4j} should be configured prior to calling this
* constructor.
@@ -367,7 +367,7 @@ public class GridTestLog4jLogger implements IgniteLogger, LoggerNodeIdAware {
* @return New console appender.
*/
private Appender createConsoleAppender(Level maxLevel) {
- String fmt = "[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n";
+ String fmt = "[%d{ISO8601}][%-5p][%t][%c{1}] %m%n";
// Configure output that should go to System.out
Appender app = new ConsoleAppender(new PatternLayout(fmt), ConsoleAppender.SYSTEM_OUT);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
index d5b0f02..39a1008 100644
--- a/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
+++ b/modules/log4j/src/main/java/org/apache/ignite/logger/log4j/Log4JLogger.java
@@ -123,7 +123,7 @@ public class Log4JLogger implements IgniteLogger, LoggerNodeIdAware, Log4jFileAw
* log level.
*
* @param init If {@code true}, then a default console appender with
- * following pattern layout will be created: {@code %d{ABSOLUTE} %-5p [%c{1}] %m%n}.
+ * following pattern layout will be created: {@code %d{ISO8601} %-5p [%c{1}] %m%n}.
* If {@code false}, then no implicit initialization will take place,
* and {@code Log4j} should be configured prior to calling this
* constructor.
@@ -371,7 +371,7 @@ public class Log4JLogger implements IgniteLogger, LoggerNodeIdAware, Log4jFileAw
* @return New console appender.
*/
private Appender createConsoleAppender(Level maxLevel) {
- String fmt = "[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n";
+ String fmt = "[%d{ISO8601}][%-5p][%t][%c{1}] %m%n";
// Configure output that should go to System.out
Appender app = new ConsoleAppender(new PatternLayout(fmt), ConsoleAppender.SYSTEM_OUT);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
----------------------------------------------------------------------
diff --git a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
index 1c19751..4672963 100644
--- a/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
+++ b/modules/log4j/src/test/java/org/apache/ignite/logger/log4j/GridLog4jCorrectFileNameTest.java
@@ -120,7 +120,7 @@ public class GridLog4jCorrectFileNameTest extends TestCase {
private static Log4jRollingFileAppender createAppender() throws Exception {
Log4jRollingFileAppender appender = new Log4jRollingFileAppender();
- appender.setLayout(new PatternLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"));
+ appender.setLayout(new PatternLayout("[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"));
appender.setFile("work/log/ignite.log");
appender.setName(Log4jRollingFileAppender.class.getSimpleName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
index dff3179..46215e5 100644
--- a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
@@ -356,7 +356,7 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware {
PatternLayout.Builder builder = PatternLayout.newBuilder();
builder
- .withPattern("%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n")
+ .withPattern("%d{ISO8601}][%-5p][%t][%c{1}] %m%n")
.withCharset(Charset.defaultCharset())
.withAlwaysWriteExceptions(false)
.withNoConsoleNoAnsi(false);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml
index c8c62d7..9d6aefd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Log/dotnet-log4j.xml
@@ -75,7 +75,7 @@
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n"/>
+ <param name="ConversionPattern" value="[%d{ISO8601}][%-5p][%t][%c{1}] %m%n"/>
</layout>
</appender>
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/visor-plugins/src/main/java/log4j.properties
----------------------------------------------------------------------
diff --git a/modules/visor-plugins/src/main/java/log4j.properties b/modules/visor-plugins/src/main/java/log4j.properties
index 9f82cc4..092bf9f 100644
--- a/modules/visor-plugins/src/main/java/log4j.properties
+++ b/modules/visor-plugins/src/main/java/log4j.properties
@@ -22,4 +22,4 @@ log4j.logger.ro.fortsoft.pf4j=ERROR, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.err
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n
+log4j.appender.stdout.layout.ConversionPattern=[%d{ISO8601}][%-5p][%t][%c{1}] %m%n
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ceb2016/modules/web-console/web-agent/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/resources/log4j.properties b/modules/web-console/web-agent/src/main/resources/log4j.properties
index c4116ac..6e42699 100644
--- a/modules/web-console/web-agent/src/main/resources/log4j.properties
+++ b/modules/web-console/web-agent/src/main/resources/log4j.properties
@@ -25,12 +25,12 @@ log4j.logger.sun.net.www.protocol.http=WARN
log4j.appender.console_err=org.apache.log4j.ConsoleAppender
log4j.appender.console_err.Threshold=WARN
log4j.appender.console_err.layout=org.apache.log4j.PatternLayout
-log4j.appender.console_err.layout.ConversionPattern=[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n
+log4j.appender.console_err.layout.ConversionPattern=[%d{ISO8601}][%-5p][%t][%c{1}] %m%n
# Configure console appender.
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n
+log4j.appender.console.layout.ConversionPattern=[%d{ISO8601}][%-5p][%t][%c{1}] %m%n
log4j.appender.console.filter.a=org.apache.log4j.varia.LevelMatchFilter
log4j.appender.console.filter.a.LevelToMatch=INFO
log4j.appender.console.filter.a.AcceptOnMatch=true
@@ -49,4 +49,4 @@ log4j.appender.file.File=logs/ignite-web-agent.log
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n
+log4j.appender.file.layout.ConversionPattern=[%d{ISO8601}][%-5p][%t][%c{1}] %m%n
[37/39] ignite git commit: IGNITE-5460 Added cache group name.
Posted by sb...@apache.org.
IGNITE-5460 Added cache group name.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b843f078
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b843f078
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b843f078
Branch: refs/heads/ignite-5272
Commit: b843f078fa97c6a34dd4bb375c534bfa798bcda2
Parents: 0879ca8
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Tue Jun 13 09:50:33 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Jun 13 09:50:33 2017 +0700
----------------------------------------------------------------------
.../internal/visor/cache/VisorCacheConfiguration.java | 13 +++++++++++++
.../visor/commands/cache/VisorCacheCommand.scala | 1 +
modules/web-console/backend/app/mongo.js | 1 +
.../configuration/generator/ConfigurationGenerator.js | 8 ++++++--
.../modules/states/configuration/caches/general.pug | 4 ++++
5 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b843f078/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index f40df80..f7330f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -48,6 +48,9 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
/** Cache name. */
private String name;
+ /** Cache group name. */
+ private String grpName;
+
/** Cache mode. */
private CacheMode mode;
@@ -174,6 +177,7 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
*/
public VisorCacheConfiguration(IgniteEx ignite, CacheConfiguration ccfg) {
name = ccfg.getName();
+ grpName = ccfg.getGroupName();
mode = ccfg.getCacheMode();
atomicityMode = ccfg.getAtomicityMode();
eagerTtl = ccfg.isEagerTtl();
@@ -226,6 +230,13 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
}
/**
+ * @return Cache group name.
+ */
+ @Nullable public String getGroupName() {
+ return grpName;
+ }
+
+ /**
* @return Cache mode.
*/
public CacheMode getMode() {
@@ -503,6 +514,7 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
U.writeString(out, name);
+ U.writeString(out, grpName);
U.writeEnum(out, mode);
U.writeEnum(out, atomicityMode);
out.writeBoolean(eagerTtl);
@@ -545,6 +557,7 @@ public class VisorCacheConfiguration extends VisorDataTransferObject {
/** {@inheritDoc} */
@Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
name = U.readString(in);
+ grpName = U.readString(in);
mode = CacheMode.fromOrdinal(in.readByte());
atomicityMode = CacheAtomicityMode.fromOrdinal(in.readByte());
eagerTtl = in.readBoolean();
http://git-wip-us.apache.org/repos/asf/ignite/blob/b843f078/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 680522f..10350f2 100755
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -837,6 +837,7 @@ object VisorCacheCommand {
cacheT #= ("Name", "Value")
+ cacheT += ("Group", cfg.getGroupName)
cacheT += ("Mode", cfg.getMode)
cacheT += ("Atomicity Mode", safe(cfg.getAtomicityMode))
cacheT += ("Statistic Enabled", bool2Str(cfg.isStatisticsEnabled))
http://git-wip-us.apache.org/repos/asf/ignite/blob/b843f078/modules/web-console/backend/app/mongo.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/mongo.js b/modules/web-console/backend/app/mongo.js
index 8e75719..e3ae30d 100644
--- a/modules/web-console/backend/app/mongo.js
+++ b/modules/web-console/backend/app/mongo.js
@@ -141,6 +141,7 @@ module.exports.factory = function(passportMongo, settings, pluginMongo, mongoose
const CacheSchema = new Schema({
space: {type: ObjectId, ref: 'Space', index: true, required: true},
name: {type: String},
+ groupName: {type: String},
clusters: [{type: ObjectId, ref: 'Cluster'}],
domains: [{type: ObjectId, ref: 'DomainModel'}],
cacheMode: {type: String, enum: ['PARTITIONED', 'REPLICATED', 'LOCAL']},
http://git-wip-us.apache.org/repos/asf/ignite/blob/b843f078/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index a55fdf1..dc29751 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -1717,8 +1717,12 @@ export default class IgniteConfigurationGenerator {
// Generate cache general group.
static cacheGeneral(cache, available, ccfg = this.cacheConfigurationBean(cache)) {
- ccfg.stringProperty('name')
- .enumProperty('cacheMode')
+ ccfg.stringProperty('name');
+
+ if (available('2.1.0'))
+ ccfg.stringProperty('groupName');
+
+ ccfg.enumProperty('cacheMode')
.enumProperty('atomicityMode');
if (ccfg.valueOf('cacheMode') === 'PARTITIONED' && ccfg.valueOf('backups')) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/b843f078/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug b/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
index 8eda4a1..91af451 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/caches/general.pug
@@ -32,6 +32,10 @@ include /app/helpers/jade/mixins
.col-sm-6
.settings-row
+text('Name:', `${model}.name`, '"cacheName"', 'true', 'Input name', 'Cache name')
+ .settings-row(ng-if='$ctrl.available("2.1.0")')
+ +text('Group:', `${model}.groupName`, '"groupName"', 'false', 'Input group name',
+ 'Cache group name.<br/>\
+ Caches with the same group name share single underlying "physical" cache (partition set), but are logically isolated.')
.settings-row
+clusters(model, 'Associate clusters with the current cache')
.settings-row
[04/39] ignite git commit: IGNITE-5397: JDBC thin driver: avoid
sending JdbcQueryCloseRequest message whenever possible. This closes #2095.
Posted by sb...@apache.org.
IGNITE-5397: JDBC thin driver: avoid sending JdbcQueryCloseRequest message whenever possible. This closes #2095.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ecba1acc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ecba1acc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ecba1acc
Branch: refs/heads/ignite-5272
Commit: ecba1acc80ec395d312d7e70be53fdafb3ff6fc5
Parents: 5120a24
Author: Sergey Kalashnikov <sk...@gridgain.com>
Authored: Wed Jun 7 15:29:28 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Jun 7 15:29:28 2017 +0300
----------------------------------------------------------------------
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 2 +
.../thin/JdbcThinAutoCloseServerCursorTest.java | 359 +++++++++++++++++++
.../jdbc/thin/JdbcThinConnectionSelfTest.java | 36 ++
.../internal/jdbc/thin/JdbcThinConnection.java | 4 +-
.../internal/jdbc/thin/JdbcThinResultSet.java | 18 +-
.../internal/jdbc/thin/JdbcThinStatement.java | 2 +-
.../internal/jdbc/thin/JdbcThinTcpIo.java | 17 +-
.../internal/jdbc/thin/JdbcThinUtils.java | 7 +-
.../processors/odbc/SqlListenerNioListener.java | 3 +-
.../processors/odbc/jdbc/JdbcQueryCursor.java | 9 +-
.../odbc/jdbc/JdbcRequestHandler.java | 21 +-
11 files changed, 462 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index 121b8df..9ca3582 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -31,6 +31,7 @@ import org.apache.ignite.jdbc.JdbcPojoQuerySelfTest;
import org.apache.ignite.jdbc.JdbcPreparedStatementSelfTest;
import org.apache.ignite.jdbc.JdbcResultSetSelfTest;
import org.apache.ignite.jdbc.JdbcStatementSelfTest;
+import org.apache.ignite.jdbc.thin.JdbcThinAutoCloseServerCursorTest;
import org.apache.ignite.jdbc.thin.JdbcThinComplexQuerySelfTest;
import org.apache.ignite.jdbc.thin.JdbcThinDeleteStatementSelfTest;
import org.apache.ignite.jdbc.thin.JdbcThinDynamicIndexAtomicPartitionedNearSelfTest;
@@ -116,6 +117,7 @@ public class IgniteJdbcDriverTestSuite extends TestSuite {
suite.addTest(new TestSuite(JdbcThinUpdateStatementSelfTest.class));
suite.addTest(new TestSuite(JdbcThinMergeStatementSelfTest.class));
suite.addTest(new TestSuite(JdbcThinDeleteStatementSelfTest.class));
+ suite.addTest(new TestSuite(JdbcThinAutoCloseServerCursorTest.class));
// New thin JDBC driver, DDL tests
suite.addTest(new TestSuite(JdbcThinDynamicIndexAtomicPartitionedNearSelfTest.class));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java
new file mode 100644
index 0000000..eff504b
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinAutoCloseServerCursorTest.java
@@ -0,0 +1,359 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.jdbc.thin;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.concurrent.Callable;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.jdbc.thin.JdbcThinUtils;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Tests an optional optimization that server cursor is closed automatically
+ * when last result set page is transmitted.
+ */
+public class JdbcThinAutoCloseServerCursorTest extends JdbcThinAbstractSelfTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Cache name. */
+ private static final String CACHE_NAME = "cache";
+
+ /** URL. */
+ private static final String URL = "jdbc:ignite:thin://127.0.0.1/?" +
+ JdbcThinUtils.PARAM_AUTO_CLOSE_SERVER_CURSOR + "=true";
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ CacheConfiguration cache = defaultCacheConfiguration();
+
+ cache.setName(CACHE_NAME);
+ cache.setCacheMode(PARTITIONED);
+ cache.setBackups(1);
+ cache.setWriteSynchronizationMode(FULL_SYNC);
+ cache.setIndexedTypes(Integer.class, Person.class);
+
+ cfg.setCacheConfiguration(cache);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(disco);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGridsMultiThreaded(3);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME);
+
+ cache.clear();
+ }
+
+ /**
+ * Ensure that server cursor is implicitly closed on last page.
+ *
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ public void testQuery() throws Exception {
+ IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME);
+
+ Person persons[] = new Person[] {
+ new Person(1, "John", 25),
+ new Person(2, "Mary", 23)
+ };
+
+ for (Person person: persons)
+ cache.put(person.id, person);
+
+ try (Connection conn = DriverManager.getConnection(URL)) {
+ conn.setSchema(CACHE_NAME);
+
+ String sqlText = "select * from Person";
+
+ try (Statement stmt = conn.createStatement()) {
+ // Ensure that result set fits into one page
+ stmt.setFetchSize(2);
+
+ try (ResultSet rs = stmt.executeQuery(sqlText)) {
+ // Attempt to get query metadata when server cursor is already closed
+ GridTestUtils.assertThrows(log(), new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ return rs.getMetaData();
+ }
+ },
+ SQLException.class,
+ "Server cursor is already closed"
+ );
+
+ GridTestUtils.assertThrows(log(), new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ return rs.findColumn("id");
+ }
+ },
+ SQLException.class,
+ "Server cursor is already closed"
+ );
+
+ checkResultSet(rs, persons);
+ }
+ }
+
+ try (Statement stmt = conn.createStatement()) {
+ // Ensure multiple page result set
+ stmt.setFetchSize(1);
+
+ try (ResultSet rs = stmt.executeQuery(sqlText)) {
+ // Getting result set metadata is OK here
+ assertEquals(3, rs.getMetaData().getColumnCount());
+
+ assertEquals(1, rs.findColumn("id"));
+
+ checkResultSet(rs, persons);
+ }
+ }
+
+ try (Statement stmt = conn.createStatement()) {
+ // Ensure multiple page result set
+ stmt.setFetchSize(1);
+
+ try (ResultSet rs = stmt.executeQuery(sqlText)) {
+ checkResultSet(rs, persons);
+
+ // Server cursor is closed now
+ GridTestUtils.assertThrows(log(), new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ return rs.getMetaData();
+ }
+ },
+ SQLException.class,
+ "Server cursor is already closed"
+ );
+
+ GridTestUtils.assertThrows(log(), new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ return rs.findColumn("id");
+ }
+ },
+ SQLException.class,
+ "Server cursor is already closed"
+ );
+ }
+ }
+ }
+ }
+
+ /**
+ * Ensure that insert works when auto close of server cursor is enabled.
+ *
+ * @throws Exception If failed.
+ */
+ public void testInsert() throws Exception {
+ try (Connection conn = DriverManager.getConnection(URL)) {
+ conn.setSchema(CACHE_NAME);
+
+ String sqlText = "insert into Person (_key, id, name, age) values (?, ?, ?, ?)";
+
+ Person p = new Person(1, "John", 25);
+
+ try (PreparedStatement prepared = conn.prepareStatement(sqlText)) {
+ prepared.setInt(1, p.id);
+ prepared.setInt(2, p.id);
+ prepared.setString(3, p.name);
+ prepared.setInt(4, p.age);
+
+ assertFalse(prepared.execute());
+ assertEquals(1, prepared.getUpdateCount());
+ }
+
+ IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME);
+
+ assertEquals(p, cache.get(1));
+ }
+ }
+
+ /**
+ * Ensure that update works when auto close of server cursor is enabled.
+ *
+ * @throws Exception If failed.
+ */
+ public void testUpdate() throws Exception {
+ IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME);
+
+ Person p = new Person(1, "John", 25);
+
+ cache.put(1, p);
+
+ try (Connection conn = DriverManager.getConnection(URL)) {
+ conn.setSchema(CACHE_NAME);
+
+ String sqlText = "update Person set age = age + 1";
+
+ try (Statement stmt = conn.createStatement()) {
+ assertEquals(1, stmt.executeUpdate(sqlText));
+ }
+
+ assertEquals(p.age + 1, cache.get(1).age);
+ }
+ }
+
+ /**
+ * Ensure that delete works when auto close of server cursor is enabled.
+ *
+ * @throws Exception If failed.
+ */
+ public void testDelete() throws Exception {
+ IgniteCache<Integer, Person> cache = grid(0).cache(CACHE_NAME);
+
+ Person p = new Person(1, "John", 25);
+
+ cache.put(1, p);
+
+ try (Connection conn = DriverManager.getConnection(URL)) {
+ conn.setSchema(CACHE_NAME);
+
+ String sqlText = "delete Person where age = ?";
+
+ try (PreparedStatement prepared = conn.prepareStatement(sqlText)) {
+ prepared.setInt(1, p.age);
+
+ assertEquals(1, prepared.executeUpdate());
+ }
+
+ assertNull(cache.get(1));
+ }
+ }
+
+ /**
+ * Checks result set against array of Person.
+ *
+ * @param rs Result set.
+ * @param persons Array of Person.
+ * @throws Exception If failed.
+ */
+ private void checkResultSet(ResultSet rs, Person[] persons) throws Exception {
+ while (rs.next()) {
+ Person p = new Person(
+ rs.getInt(1),
+ rs.getString(2),
+ rs.getInt(3));
+
+ assert p.id > 0 && p.id <= persons.length;
+
+ assertEquals(persons[p.id - 1], p);
+ }
+ }
+
+ /**
+ * Person.
+ */
+ @SuppressWarnings("UnusedDeclaration")
+ static class Person implements Serializable {
+ /** ID. */
+ @QuerySqlField
+ private final int id;
+
+ /** First name. */
+ @QuerySqlField
+ private final String name;
+
+ /** Last name. */
+ @QuerySqlField
+ private final int age;
+
+ /**
+ * @param id ID.
+ * @param name Name.
+ * @param age Age.
+ */
+ Person(int id, String name, int age) {
+ assert !F.isEmpty(name);
+ assert age > 0;
+
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("SimplifiableIfStatement")
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ Person person = (Person) o;
+
+ if (id != person.id)
+ return false;
+
+ if (name == null ^ person.name == null)
+ return false;
+
+ if (name != null && !name.equals(person.name))
+ return false;
+
+ return age == person.age;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ int result = id;
+
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + age;
+
+ return result;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
index 7ea22d5..8f1285b 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java
@@ -237,6 +237,42 @@ public class JdbcThinConnectionSelfTest extends JdbcThinAbstractSelfTest {
}
/**
+ * Test autoCloseServerCursor property handling.
+ *
+ * @throws Exception If failed.
+ */
+ public void testAutoCloseServerCursorProperty() throws Exception {
+ String url = "jdbc:ignite:thin://127.0.0.1?" + JdbcThinUtils.PARAM_AUTO_CLOSE_SERVER_CURSOR;
+
+ String err = "Failed to parse boolean property [name=" + JdbcThinUtils.PARAM_AUTO_CLOSE_SERVER_CURSOR;
+
+ assertInvalid(url + "=0", err);
+ assertInvalid(url + "=1", err);
+ assertInvalid(url + "=false1", err);
+ assertInvalid(url + "=true1", err);
+
+ try (Connection conn = DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1")) {
+ assertFalse(io(conn).autoCloseServerCursor());
+ }
+
+ try (Connection conn = DriverManager.getConnection(url + "=true")) {
+ assertTrue(io(conn).autoCloseServerCursor());
+ }
+
+ try (Connection conn = DriverManager.getConnection(url + "=True")) {
+ assertTrue(io(conn).autoCloseServerCursor());
+ }
+
+ try (Connection conn = DriverManager.getConnection(url + "=false")) {
+ assertFalse(io(conn).autoCloseServerCursor());
+ }
+
+ try (Connection conn = DriverManager.getConnection(url + "=False")) {
+ assertFalse(io(conn).autoCloseServerCursor());
+ }
+ }
+
+ /**
* Get client socket for connection.
*
* @param conn Connection.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
index b372085..14c34ee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java
@@ -44,6 +44,7 @@ import static java.sql.ResultSet.CONCUR_READ_ONLY;
import static java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
import static java.sql.ResultSet.TYPE_FORWARD_ONLY;
+import static org.apache.ignite.internal.jdbc.thin.JdbcThinUtils.PROP_AUTO_CLOSE_SERVER_CURSORS;
import static org.apache.ignite.internal.jdbc.thin.JdbcThinUtils.PROP_HOST;
import static org.apache.ignite.internal.jdbc.thin.JdbcThinUtils.PROP_PORT;
import static org.apache.ignite.internal.jdbc.thin.JdbcThinUtils.PROP_DISTRIBUTED_JOINS;
@@ -106,6 +107,7 @@ public class JdbcThinConnection implements Connection {
boolean enforceJoinOrder = extractBoolean(props, PROP_ENFORCE_JOIN_ORDER, false);
boolean collocated = extractBoolean(props, PROP_COLLOCATED, false);
boolean replicatedOnly = extractBoolean(props, PROP_REPLICATED_ONLY, false);
+ boolean autoCloseServerCursor = extractBoolean(props, PROP_AUTO_CLOSE_SERVER_CURSORS, false);
int sockSndBuf = extractIntNonNegative(props, PROP_SOCK_SND_BUF, 0);
int sockRcvBuf = extractIntNonNegative(props, PROP_SOCK_RCV_BUF, 0);
@@ -114,7 +116,7 @@ public class JdbcThinConnection implements Connection {
try {
cliIo = new JdbcThinTcpIo(host, port, distributedJoins, enforceJoinOrder, collocated, replicatedOnly,
- sockSndBuf, sockRcvBuf, tcpNoDelay);
+ autoCloseServerCursor, sockSndBuf, sockRcvBuf, tcpNoDelay);
cliIo.start();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
index 87bc526..5c61e23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinResultSet.java
@@ -94,6 +94,9 @@ public class JdbcThinResultSet implements ResultSet {
/** Is query flag. */
private boolean isQuery;
+ /** Auto close server cursors flag. */
+ private boolean autoClose;
+
/** Update count. */
private long updCnt;
@@ -105,11 +108,13 @@ public class JdbcThinResultSet implements ResultSet {
* @param fetchSize Fetch size.
* @param finished Finished flag.
* @param rows Rows.
- * @param isQuery Is Result ser for Select query
+ * @param isQuery Is Result ser for Select query.
+ * @param autoClose Is automatic close of server cursors enabled.
+ * @param updCnt Update count.
*/
@SuppressWarnings("OverlyStrongTypeCast")
JdbcThinResultSet(JdbcThinStatement stmt, long qryId, int fetchSize, boolean finished,
- List<List<Object>> rows, boolean isQuery, long updCnt) {
+ List<List<Object>> rows, boolean isQuery, boolean autoClose, long updCnt) {
assert stmt != null;
assert fetchSize > 0;
@@ -118,6 +123,7 @@ public class JdbcThinResultSet implements ResultSet {
this.fetchSize = fetchSize;
this.finished = finished;
this.isQuery = isQuery;
+ this.autoClose = autoClose;
if (isQuery) {
this.fetchSize = fetchSize;
@@ -134,7 +140,7 @@ public class JdbcThinResultSet implements ResultSet {
@Override public boolean next() throws SQLException {
ensureNotClosed();
- if (rowsIter == null && !finished) {
+ if ((rowsIter == null || !rowsIter.hasNext()) && !finished) {
try {
JdbcQueryFetchResult res = stmt.connection().io().queryFetch(qryId, fetchSize);
@@ -178,7 +184,8 @@ public class JdbcThinResultSet implements ResultSet {
return;
try {
- stmt.connection().io().queryClose(qryId);
+ if (!finished || (isQuery && !autoClose))
+ stmt.connection().io().queryClose(qryId);
closed = true;
}
@@ -1616,6 +1623,9 @@ public class JdbcThinResultSet implements ResultSet {
* @throws SQLException On error.
*/
private List<JdbcColumnMeta> meta() throws SQLException {
+ if (finished && (!isQuery || autoClose))
+ throw new SQLException("Server cursor is already closed.");
+
if (!metaInit) {
try {
JdbcQueryMetadataResult res = stmt.connection().io().queryMeta(qryId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
index a0b7ee6..2cad223 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinStatement.java
@@ -112,7 +112,7 @@ public class JdbcThinStatement implements Statement {
assert res != null;
rs = new JdbcThinResultSet(this, res.getQueryId(), pageSize, res.last(), res.items(),
- res.isQuery(), res.updateCount());
+ res.isQuery(), conn.io().autoCloseServerCursor(), res.updateCount());
}
catch (IOException e) {
conn.close();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
index 1905ea4..be62a8d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinTcpIo.java
@@ -53,7 +53,7 @@ public class JdbcThinTcpIo {
private static final SqlListenerProtocolVersion CURRENT_VER = SqlListenerProtocolVersion.create(2, 1, 0);
/** Initial output stream capacity for handshake. */
- private static final int HANDSHAKE_MSG_SIZE = 12;
+ private static final int HANDSHAKE_MSG_SIZE = 13;
/** Initial output for query message. */
private static final int QUERY_EXEC_MSG_INIT_CAP = 256;
@@ -85,6 +85,9 @@ public class JdbcThinTcpIo {
/** Replicated only flag. */
private final boolean replicatedOnly;
+ /** Flag to automatically close server cursor. */
+ private final boolean autoCloseServerCursor;
+
/** Socket send buffer. */
private final int sockSndBuf;
@@ -115,18 +118,20 @@ public class JdbcThinTcpIo {
* @param enforceJoinOrder Enforce join order flag.
* @param collocated Collocated flag.
* @param replicatedOnly Replicated only flag.
+ * @param autoCloseServerCursor Flag to automatically close server cursors.
* @param sockSndBuf Socket send buffer.
* @param sockRcvBuf Socket receive buffer.
* @param tcpNoDelay TCP no delay flag.
*/
JdbcThinTcpIo(String host, int port, boolean distributedJoins, boolean enforceJoinOrder, boolean collocated,
- boolean replicatedOnly, int sockSndBuf, int sockRcvBuf, boolean tcpNoDelay) {
+ boolean replicatedOnly, boolean autoCloseServerCursor, int sockSndBuf, int sockRcvBuf, boolean tcpNoDelay) {
this.host = host;
this.port = port;
this.distributedJoins = distributedJoins;
this.enforceJoinOrder = enforceJoinOrder;
this.collocated = collocated;
this.replicatedOnly = replicatedOnly;
+ this.autoCloseServerCursor = autoCloseServerCursor;
this.sockSndBuf = sockSndBuf;
this.sockRcvBuf = sockRcvBuf;
this.tcpNoDelay = tcpNoDelay;
@@ -182,6 +187,7 @@ public class JdbcThinTcpIo {
writer.writeBoolean(enforceJoinOrder);
writer.writeBoolean(collocated);
writer.writeBoolean(replicatedOnly);
+ writer.writeBoolean(autoCloseServerCursor);
send(writer.array());
@@ -382,6 +388,13 @@ public class JdbcThinTcpIo {
}
/**
+ * @return Auto close server cursors flag.
+ */
+ public boolean autoCloseServerCursor() {
+ return autoCloseServerCursor;
+ }
+
+ /**
* @return Socket send buffer size.
*/
public int socketSendBuffer() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
index aa9b011..78e8c8f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinUtils.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.jdbc.thin;
-import org.apache.ignite.configuration.OdbcConfiguration;
import org.apache.ignite.configuration.SqlConnectorConfiguration;
import java.sql.Time;
@@ -76,6 +75,9 @@ public class JdbcThinUtils {
/** Parameter: TCP no-delay flag. */
public static final String PARAM_TCP_NO_DELAY = "tcpNoDelay";
+ /** Parameter: Automatically close server cursor. */
+ public static final String PARAM_AUTO_CLOSE_SERVER_CURSOR = "autoCloseServerCursor";
+
/** Distributed joins property name. */
public static final String PROP_DISTRIBUTED_JOINS = PROP_PREFIX + PARAM_DISTRIBUTED_JOINS;
@@ -97,6 +99,9 @@ public class JdbcThinUtils {
/** TCP no delay property name. */
public static final String PROP_TCP_NO_DELAY = PROP_PREFIX + PARAM_TCP_NO_DELAY;
+ /** Automatically close server cursor. */
+ public static final String PROP_AUTO_CLOSE_SERVER_CURSORS = PROP_PREFIX + PARAM_AUTO_CLOSE_SERVER_CURSOR;
+
/** Default port. */
public static final int DFLT_PORT = SqlConnectorConfiguration.DFLT_PORT;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
index bff5519..6bb4e29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerNioListener.java
@@ -252,9 +252,10 @@ public class SqlListenerNioListener extends GridNioServerListenerAdapter<byte[]>
boolean enforceJoinOrder = reader.readBoolean();
boolean collocated = reader.readBoolean();
boolean replicatedOnly = reader.readBoolean();
+ boolean autoCloseCursors = reader.readBoolean();
SqlListenerRequestHandler handler = new JdbcRequestHandler(ctx, busyLock, maxCursors, distributedJoins,
- enforceJoinOrder, collocated, replicatedOnly);
+ enforceJoinOrder, collocated, replicatedOnly, autoCloseCursors);
SqlListenerMessageParser parser = new JdbcMessageParser(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcQueryCursor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcQueryCursor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcQueryCursor.java
index b8edb8d..830daea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcQueryCursor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcQueryCursor.java
@@ -65,13 +65,16 @@ class JdbcQueryCursor {
* @return List of the rows.
*/
List<List<Object>> fetchRows() {
- List<List<Object>> items = new ArrayList<>();
+ int fetchSize = (maxRows > 0) ? (int)Math.min(pageSize, maxRows - fetched) : pageSize;
- int fetchSize0 = (maxRows > 0) ? (int)Math.min(pageSize, maxRows - fetched) : pageSize;
+ List<List<Object>> items = new ArrayList<>(fetchSize);
- for (; fetched < fetchSize0 && iter.hasNext(); ++fetched)
+ for (int i = 0; i < fetchSize && iter.hasNext(); i++) {
items.add(iter.next());
+ fetched++;
+ }
+
return items;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ecba1acc/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
index 0796cfc..94ac433 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
@@ -74,6 +74,9 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
/** Replicated only flag. */
private final boolean replicatedOnly;
+ /** Automatic close of cursors. */
+ private final boolean autoCloseCursors;
+
/**
* Constructor.
*
@@ -84,9 +87,11 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
* @param enforceJoinOrder Enforce join order flag.
* @param collocated Collocated flag.
* @param replicatedOnly Replicated only flag.
+ * @param autoCloseCursors Flag to automatically close server cursors.
*/
public JdbcRequestHandler(GridKernalContext ctx, GridSpinBusyLock busyLock, int maxCursors,
- boolean distributedJoins, boolean enforceJoinOrder, boolean collocated, boolean replicatedOnly) {
+ boolean distributedJoins, boolean enforceJoinOrder, boolean collocated, boolean replicatedOnly,
+ boolean autoCloseCursors) {
this.ctx = ctx;
this.busyLock = busyLock;
this.maxCursors = maxCursors;
@@ -94,6 +99,7 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
this.enforceJoinOrder = enforceJoinOrder;
this.collocated = collocated;
this.replicatedOnly = replicatedOnly;
+ this.autoCloseCursors = autoCloseCursors;
log = ctx.log(getClass());
}
@@ -183,8 +189,6 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
JdbcQueryCursor cur = new JdbcQueryCursor(qryId, req.pageSize(), req.maxRows(), (QueryCursorImpl)qryCur);
- qryCursors.put(qryId, cur);
-
JdbcQueryExecuteResult res;
if (cur.isQuery())
@@ -200,6 +204,11 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
res = new JdbcQueryExecuteResult(qryId, (Long)items.get(0).get(0));
}
+ if (res.last() && (!res.isQuery() || autoCloseCursors))
+ cur.close();
+ else
+ qryCursors.put(qryId, cur);
+
return new JdbcResponse(res);
}
catch (Exception e) {
@@ -260,6 +269,12 @@ public class JdbcRequestHandler implements SqlListenerRequestHandler {
JdbcQueryFetchResult res = new JdbcQueryFetchResult(cur.fetchRows(), !cur.hasNext());
+ if (res.last() && (!cur.isQuery() || autoCloseCursors)) {
+ qryCursors.remove(req.queryId());
+
+ cur.close();
+ }
+
return new JdbcResponse(res);
}
catch (Exception e) {
[13/39] ignite git commit: IGNITE-5372 .NET:
IgniteConfiguration.LongQueryWarningTimeout
Posted by sb...@apache.org.
IGNITE-5372 .NET: IgniteConfiguration.LongQueryWarningTimeout
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d5ecf0a7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d5ecf0a7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d5ecf0a7
Branch: refs/heads/ignite-5272
Commit: d5ecf0a7e1683a060cd5c0b1dd2ba0d49c678947
Parents: 45bb5b3
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Jun 8 13:29:21 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Jun 8 13:29:21 2017 +0300
----------------------------------------------------------------------
.../utils/PlatformConfigurationUtils.java | 6 ++++++
.../Cache/CacheConfigurationTest.cs | 8 ++++++++
.../IgniteConfigurationSerializerTest.cs | 5 +++--
.../IgniteConfigurationTest.cs | 4 ++++
.../Cache/Configuration/CacheConfiguration.cs | 9 +++++++++
.../Apache.Ignite.Core/IgniteConfiguration.cs | 20 ++++++++++++++++++++
.../IgniteConfigurationSection.xsd | 7 +++++++
7 files changed, 57 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 176d77b..575dead 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -151,6 +151,7 @@ public class PlatformConfigurationUtils {
ccfg.setStoreKeepBinary(in.readBoolean());
ccfg.setLoadPreviousValue(in.readBoolean());
ccfg.setDefaultLockTimeout(in.readLong());
+ //noinspection deprecation
ccfg.setLongQueryWarningTimeout(in.readLong());
ccfg.setMaxConcurrentAsyncOperations(in.readInt());
ccfg.setName(in.readString());
@@ -563,6 +564,8 @@ public class PlatformConfigurationUtils {
cfg.setFailureDetectionTimeout(in.readLong());
if (in.readBoolean())
cfg.setClientFailureDetectionTimeout(in.readLong());
+ if (in.readBoolean())
+ cfg.setLongQueryWarningTimeout(in.readLong());
// Thread pools.
if (in.readBoolean())
@@ -808,6 +811,7 @@ public class PlatformConfigurationUtils {
writer.writeBoolean(ccfg.isStoreKeepBinary());
writer.writeBoolean(ccfg.isLoadPreviousValue());
writer.writeLong(ccfg.getDefaultLockTimeout());
+ //noinspection deprecation
writer.writeLong(ccfg.getLongQueryWarningTimeout());
writer.writeInt(ccfg.getMaxConcurrentAsyncOperations());
writer.writeString(ccfg.getName());
@@ -1003,6 +1007,8 @@ public class PlatformConfigurationUtils {
w.writeLong(cfg.getFailureDetectionTimeout());
w.writeBoolean(true);
w.writeLong(cfg.getClientFailureDetectionTimeout());
+ w.writeBoolean(true);
+ w.writeLong(cfg.getLongQueryWarningTimeout());
// Thread pools.
w.writeBoolean(true);
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
index b674b0e..1f6dbcf 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -203,7 +203,9 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(CacheConfiguration.DefaultKeepVinaryInStore, cfg.KeepBinaryInStore);
Assert.AreEqual(CacheConfiguration.DefaultLoadPreviousValue, cfg.LoadPreviousValue);
Assert.AreEqual(CacheConfiguration.DefaultLockTimeout, cfg.LockTimeout);
+#pragma warning disable 618
Assert.AreEqual(CacheConfiguration.DefaultLongQueryWarningTimeout, cfg.LongQueryWarningTimeout);
+#pragma warning restore 618
Assert.AreEqual(CacheConfiguration.DefaultMaxConcurrentAsyncOperations, cfg.MaxConcurrentAsyncOperations);
Assert.AreEqual(CacheConfiguration.DefaultReadFromBackup, cfg.ReadFromBackup);
Assert.AreEqual(CacheConfiguration.DefaultRebalanceBatchSize, cfg.RebalanceBatchSize);
@@ -233,7 +235,9 @@ namespace Apache.Ignite.Core.Tests.Cache
Assert.AreEqual(x.KeepBinaryInStore, y.KeepBinaryInStore);
Assert.AreEqual(x.LoadPreviousValue, y.LoadPreviousValue);
Assert.AreEqual(x.LockTimeout, y.LockTimeout);
+#pragma warning disable 618
Assert.AreEqual(x.LongQueryWarningTimeout, y.LongQueryWarningTimeout);
+#pragma warning restore 618
Assert.AreEqual(x.MaxConcurrentAsyncOperations, y.MaxConcurrentAsyncOperations);
Assert.AreEqual(x.ReadFromBackup, y.ReadFromBackup);
Assert.AreEqual(x.RebalanceBatchSize, y.RebalanceBatchSize);
@@ -487,7 +491,9 @@ namespace Apache.Ignite.Core.Tests.Cache
Name = name ?? CacheName,
MaxConcurrentAsyncOperations = 3,
WriteBehindFlushThreadCount = 4,
+#pragma warning disable 618
LongQueryWarningTimeout = TimeSpan.FromSeconds(5),
+#pragma warning restore 618
LoadPreviousValue = true,
CopyOnRead = true,
WriteBehindFlushFrequency = TimeSpan.FromSeconds(6),
@@ -577,7 +583,9 @@ namespace Apache.Ignite.Core.Tests.Cache
Name = name ?? CacheName2,
MaxConcurrentAsyncOperations = 3,
WriteBehindFlushThreadCount = 4,
+#pragma warning disable 618
LongQueryWarningTimeout = TimeSpan.FromSeconds(5),
+#pragma warning restore 618
LoadPreviousValue = true,
CopyOnRead = true,
WriteBehindFlushFrequency = TimeSpan.FromSeconds(6),
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 3229de9..2a8e907 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -67,7 +67,7 @@ namespace Apache.Ignite.Core.Tests
[Test]
public void TestPredefinedXml()
{
- var xml = @"<igniteConfig workDirectory='c:' JvmMaxMemoryMb='1024' MetricsLogFrequency='0:0:10' isDaemon='true' isLateAffinityAssignment='false' springConfigUrl='c:\myconfig.xml' autoGenerateIgniteInstanceName='true' peerAssemblyLoadingMode='CurrentAppDomain'>
+ var xml = @"<igniteConfig workDirectory='c:' JvmMaxMemoryMb='1024' MetricsLogFrequency='0:0:10' isDaemon='true' isLateAffinityAssignment='false' springConfigUrl='c:\myconfig.xml' autoGenerateIgniteInstanceName='true' peerAssemblyLoadingMode='CurrentAppDomain' longQueryWarningTimeout='1:2:3'>
<localhost>127.1.1.1</localhost>
<binaryConfiguration compactFooter='false' keepDeserialized='true'>
<nameMapper type='Apache.Ignite.Core.Tests.IgniteConfigurationSerializerTest+NameMapper' bar='testBar' />
@@ -167,6 +167,7 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(new[] {42, EventType.TaskFailed, EventType.JobFinished}, cfg.IncludedEventTypes);
Assert.AreEqual(@"c:\myconfig.xml", cfg.SpringConfigUrl);
Assert.IsTrue(cfg.AutoGenerateIgniteInstanceName);
+ Assert.AreEqual(new TimeSpan(1, 2, 3), cfg.LongQueryWarningTimeout);
Assert.AreEqual("secondCache", cfg.CacheConfiguration.Last().Name);
@@ -663,7 +664,6 @@ namespace Apache.Ignite.Core.Tests
KeepBinaryInStore = true,
LoadPreviousValue = true,
LockTimeout = TimeSpan.FromSeconds(56),
- LongQueryWarningTimeout = TimeSpan.FromSeconds(99),
MaxConcurrentAsyncOperations = 24,
QueryEntities = new[]
{
@@ -816,6 +816,7 @@ namespace Apache.Ignite.Core.Tests
Logger = new IgniteNLogLogger(),
FailureDetectionTimeout = TimeSpan.FromMinutes(2),
ClientFailureDetectionTimeout = TimeSpan.FromMinutes(3),
+ LongQueryWarningTimeout = TimeSpan.FromDays(4),
PluginConfigurations = new[] {new TestIgnitePluginConfiguration() },
EventStorageSpi = new MemoryEventStorageSpi
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index 9d19a23..9341c95 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -174,6 +174,7 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(cfg.FailureDetectionTimeout, resCfg.FailureDetectionTimeout);
Assert.AreEqual(cfg.ClientFailureDetectionTimeout, resCfg.ClientFailureDetectionTimeout);
+ Assert.AreEqual(cfg.LongQueryWarningTimeout, resCfg.LongQueryWarningTimeout);
Assert.AreEqual(cfg.PublicThreadPoolSize, resCfg.PublicThreadPoolSize);
Assert.AreEqual(cfg.StripedThreadPoolSize, resCfg.StripedThreadPoolSize);
@@ -479,6 +480,8 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual(IgniteConfiguration.DefaultFailureDetectionTimeout, cfg.FailureDetectionTimeout);
Assert.AreEqual(IgniteConfiguration.DefaultClientFailureDetectionTimeout,
cfg.ClientFailureDetectionTimeout);
+ Assert.AreEqual(IgniteConfiguration.DefaultLongQueryWarningTimeout, cfg.LongQueryWarningTimeout);
+ Assert.AreEqual(IgniteConfiguration.DefaultIsLateAffinityAssignment, cfg.IsLateAffinityAssignment);
// Thread pools.
Assert.AreEqual(IgniteConfiguration.DefaultManagementThreadPoolSize, cfg.ManagementThreadPoolSize);
@@ -599,6 +602,7 @@ namespace Apache.Ignite.Core.Tests
},
FailureDetectionTimeout = TimeSpan.FromSeconds(3.5),
ClientFailureDetectionTimeout = TimeSpan.FromMinutes(12.3),
+ LongQueryWarningTimeout = TimeSpan.FromMinutes(1.23),
BinaryConfiguration = new BinaryConfiguration
{
CompactFooter = false,
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index 04198dd..ec0ac40 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -156,7 +156,9 @@ namespace Apache.Ignite.Core.Cache.Configuration
KeepBinaryInStore = DefaultKeepVinaryInStore;
LoadPreviousValue = DefaultLoadPreviousValue;
LockTimeout = DefaultLockTimeout;
+#pragma warning disable 618
LongQueryWarningTimeout = DefaultLongQueryWarningTimeout;
+#pragma warning restore 618
MaxConcurrentAsyncOperations = DefaultMaxConcurrentAsyncOperations;
ReadFromBackup = DefaultReadFromBackup;
RebalanceBatchSize = DefaultRebalanceBatchSize;
@@ -214,7 +216,9 @@ namespace Apache.Ignite.Core.Cache.Configuration
KeepBinaryInStore = reader.ReadBoolean();
LoadPreviousValue = reader.ReadBoolean();
LockTimeout = reader.ReadLongAsTimespan();
+#pragma warning disable 618
LongQueryWarningTimeout = reader.ReadLongAsTimespan();
+#pragma warning restore 618
MaxConcurrentAsyncOperations = reader.ReadInt();
Name = reader.ReadString();
ReadFromBackup = reader.ReadBoolean();
@@ -272,7 +276,9 @@ namespace Apache.Ignite.Core.Cache.Configuration
writer.WriteBoolean(KeepBinaryInStore);
writer.WriteBoolean(LoadPreviousValue);
writer.WriteLong((long) LockTimeout.TotalMilliseconds);
+#pragma warning disable 618
writer.WriteLong((long) LongQueryWarningTimeout.TotalMilliseconds);
+#pragma warning restore 618
writer.WriteInt(MaxConcurrentAsyncOperations);
writer.WriteString(Name);
writer.WriteBoolean(ReadFromBackup);
@@ -538,8 +544,11 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// <summary>
/// Gets or sets the timeout after which long query warning will be printed.
+ /// <para />
+ /// This property is obsolete, use <see cref="IgniteConfiguration.LongQueryWarningTimeout"/> instead.
/// </summary>
[DefaultValue(typeof(TimeSpan), "00:00:03")]
+ [Obsolete("Use IgniteConfiguration.LongQueryWarningTimeout instead.")]
public TimeSpan LongQueryWarningTimeout { get; set; }
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 40bab15..4c141da 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -114,6 +114,11 @@ namespace Apache.Ignite.Core
/// </summary>
public const int DefaultManagementThreadPoolSize = 4;
+ /// <summary>
+ /// Default timeout after which long query warning will be printed.
+ /// </summary>
+ public static readonly TimeSpan DefaultLongQueryWarningTimeout = TimeSpan.FromMilliseconds(3000);
+
/** */
private TimeSpan? _metricsExpireTime;
@@ -177,6 +182,9 @@ namespace Apache.Ignite.Core
/** */
private int? _queryThreadPoolSize;
+ /** */
+ private TimeSpan? _longQueryWarningTimeout;
+
/// <summary>
/// Default network retry count.
/// </summary>
@@ -259,6 +267,7 @@ namespace Apache.Ignite.Core
writer.WriteBooleanNullable(_isLateAffinityAssignment);
writer.WriteTimeSpanAsLongNullable(_failureDetectionTimeout);
writer.WriteTimeSpanAsLongNullable(_clientFailureDetectionTimeout);
+ writer.WriteTimeSpanAsLongNullable(_longQueryWarningTimeout);
// Thread pools
writer.WriteIntNullable(_publicThreadPoolSize);
@@ -497,6 +506,7 @@ namespace Apache.Ignite.Core
_isLateAffinityAssignment = r.ReadBooleanNullable();
_failureDetectionTimeout = r.ReadTimeSpanNullable();
_clientFailureDetectionTimeout = r.ReadTimeSpanNullable();
+ _longQueryWarningTimeout = r.ReadTimeSpanNullable();
// Thread pools
_publicThreadPoolSize = r.ReadIntNullable();
@@ -1159,5 +1169,15 @@ namespace Apache.Ignite.Core
/// Gets or sets the SQL connector configuration (for JDBC and ODBC).
/// </summary>
public SqlConnectorConfiguration SqlConnectorConfiguration { get; set; }
+
+ /// <summary>
+ /// Gets or sets the timeout after which long query warning will be printed.
+ /// </summary>
+ [DefaultValue(typeof(TimeSpan), "00:00:03")]
+ public TimeSpan LongQueryWarningTimeout
+ {
+ get { return _longQueryWarningTimeout ?? DefaultLongQueryWarningTimeout; }
+ set { _longQueryWarningTimeout = value; }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d5ecf0a7/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index f0b7f44..864ff9e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -1480,6 +1480,13 @@
</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="longQueryWarningTimeout" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ Timeout after which long query warning will be printed.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
<xs:attribute name="peerAssemblyLoadingMode" type="peerAssemblyLoadingMode">
<xs:annotation>
<xs:documentation>Indicates whether user assemblies should be loaded on remote nodes automatically.</xs:documentation>
[20/39] ignite git commit: Remove unused imports
Posted by sb...@apache.org.
Remove unused imports
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a1e6edcf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a1e6edcf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a1e6edcf
Branch: refs/heads/ignite-5272
Commit: a1e6edcf425d59e2e300b92b538021c9feff106f
Parents: f03ecba
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Jun 8 17:35:44 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Jun 8 17:35:44 2017 +0300
----------------------------------------------------------------------
.../platform/dotnet/PlatformDotNetConfigurationClosure.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a1e6edcf/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
index b0daf35..5b4f1cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
@@ -18,10 +18,6 @@
package org.apache.ignite.internal.processors.platform.dotnet;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.binary.BinaryBasicIdMapper;
-import org.apache.ignite.binary.BinaryBasicNameMapper;
-import org.apache.ignite.binary.BinaryIdMapper;
-import org.apache.ignite.binary.BinaryNameMapper;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -118,7 +114,7 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
* Sets binary config.
*
* @param igniteCfg Ignite config.
- * @param dotNetCfg Dotnet config.
+ * @param dotNetCfg .NET config.
*/
private void setBinaryConfiguration(IgniteConfiguration igniteCfg, PlatformDotNetConfigurationEx dotNetCfg) {
// Check marshaller.
@@ -166,7 +162,7 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
writer.writeMap(bean.getProperties());
}
- // Write .NET affinity funcs
+ // Write .NET affinity functions
List<PlatformDotNetAffinityFunction> affFuncs = affinityFunctions(igniteCfg);
writer.writeInt(affFuncs.size());
[22/39] ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/ignite
Posted by sb...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4b0998e5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4b0998e5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4b0998e5
Branch: refs/heads/ignite-5272
Commit: 4b0998e5d22a94f56db5ddc65ad7fc274a1e3199
Parents: e3ff16a a1e6edc
Author: Sergi Vladykin <se...@gmail.com>
Authored: Thu Jun 8 20:39:13 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Thu Jun 8 20:39:13 2017 +0300
----------------------------------------------------------------------
.../ClientTcpUnreachableMultiNodeSelfTest.java | 6 +-
.../configuration/CacheConfiguration.java | 24 +++
.../ignite/internal/binary/BinaryContext.java | 1 -
.../ignite/internal/binary/BinaryFieldEx.java | 5 +
.../ignite/internal/binary/BinaryFieldImpl.java | 5 +
.../ignite/internal/client/GridClientNode.java | 9 +-
.../client/impl/GridClientNodeImpl.java | 22 +-
.../connection/GridClientNioTcpConnection.java | 3 +-
.../PlatformDotNetConfigurationClosure.java | 8 +-
.../utils/PlatformConfigurationUtils.java | 8 +
.../query/DynamicTableAffinityKeyMapper.java | 92 ++++++++
.../processors/query/GridQueryProcessor.java | 59 +++---
.../internal/processors/query/QueryUtils.java | 19 +-
.../rest/client/message/GridClientNodeBean.java | 25 +++
.../top/GridTopologyCommandHandler.java | 1 +
.../query/h2/ddl/DdlStatementsProcessor.java | 5 +-
.../processors/query/h2/opt/GridH2Table.java | 5 +-
.../query/h2/sql/GridSqlCreateTable.java | 37 +++-
.../query/h2/sql/GridSqlQueryParser.java | 54 +++++
.../cache/index/H2DynamicTableSelfTest.java | 209 +++++++++++++++++--
.../Cache/CacheConfigurationTest.cs | 10 +
.../IgniteConfigurationSerializerTest.cs | 11 +-
.../IgniteConfigurationTest.cs | 4 +
.../Cache/Configuration/CacheConfiguration.cs | 23 ++
.../Datastream/IDataStreamer.cs | 8 +-
.../Apache.Ignite.Core/IgniteConfiguration.cs | 20 ++
.../IgniteConfigurationSection.xsd | 12 ++
modules/web-console/backend/.gitignore | 1 +
modules/web-console/frontend/.gitignore | 1 +
.../yardstick/cache/load/model/ModelUtil.java | 1 +
30 files changed, 621 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
[03/39] ignite git commit: ignite-5196 JDBC Driver fix
Posted by sb...@apache.org.
ignite-5196 JDBC Driver fix
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5120a245
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5120a245
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5120a245
Branch: refs/heads/ignite-5272
Commit: 5120a245ee5819ee3602b659e4146362cd38adc0
Parents: 8555e21
Author: Igor Seliverstov <gv...@gmail.com>
Authored: Wed Jun 7 15:00:16 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jun 7 15:00:16 2017 +0300
----------------------------------------------------------------------
.../processors/cache/query/jdbc/GridCacheQueryJdbcTask.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5120a245/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
index 4ae8a8a..ba87cff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
@@ -106,9 +106,9 @@ public class GridCacheQueryJdbcTask extends ComputeTaskAdapter<byte[], byte[]> {
else {
String cache = (String)args.get("cache");
- Map<? extends ComputeJob, ClusterNode> node = mapToNode(subgrid, args, first, cache);
+ Map<? extends ComputeJob, ClusterNode> node = null;
- if (node == null && cache == null) {
+ if (cache == null) {
boolean start = ignite.configuration().isClientMode();
IgniteCache<?, ?> cache0 =
@@ -117,6 +117,8 @@ public class GridCacheQueryJdbcTask extends ComputeTaskAdapter<byte[], byte[]> {
if (cache0 != null)
node = mapToNode(subgrid, args, first, cache0.getName());
}
+ else
+ node = mapToNode(subgrid, args, first, cache);
if (node != null)
return node;