You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dm...@apache.org on 2016/03/24 12:41:03 UTC
[01/25] ignite git commit: IGNITE-1957: .NET: Binary marshaller now
use handles for arrays, collections and dictionaries. This closes #302.
Repository: ignite
Updated Branches:
refs/heads/ignite-2849 031c915f7 -> 8fa876993
IGNITE-1957: .NET: Binary marshaller now use handles for arrays, collections and dictionaries. This closes #302.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cadc61fa
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cadc61fa
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cadc61fa
Branch: refs/heads/ignite-2849
Commit: cadc61fa89df00d0c632328d0678e2b19d525e42
Parents: 69f526a
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Mon Mar 21 15:23:47 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Mar 21 15:23:47 2016 +0300
----------------------------------------------------------------------
.../Binary/BinarySelfTest.cs | 113 ++++++++++++++++
.../Apache.Ignite.Core.csproj | 1 +
.../Impl/Binary/BinaryHandleDictionary.cs | 32 +++--
.../Impl/Binary/BinaryReader.cs | 61 ++++-----
.../Impl/Binary/BinaryReaderHandleDictionary.cs | 2 +-
.../Impl/Binary/BinarySystemHandlers.cs | 132 ++++++++++---------
.../Impl/Binary/BinaryUtils.cs | 12 ++
.../Impl/Binary/BinaryWriter.cs | 24 ++--
.../Impl/Binary/ReferenceEqualityComparer.cs | 45 +++++++
.../Impl/Common/DelegateConverter.cs | 4 +-
10 files changed, 301 insertions(+), 125 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cadc61fa/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
index 0fcb792..41e327b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
@@ -29,10 +29,12 @@ namespace Apache.Ignite.Core.Tests.Binary
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
+ using System.Reflection;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Binary.IO;
+ using Apache.Ignite.Core.Impl.Common;
using NUnit.Framework;
using BinaryReader = Apache.Ignite.Core.Impl.Binary.BinaryReader;
using BinaryWriter = Apache.Ignite.Core.Impl.Binary.BinaryWriter;
@@ -1256,6 +1258,87 @@ namespace Apache.Ignite.Core.Tests.Binary
Assert.IsTrue(newOuter.RawInner == newOuter.RawInner.Outer.RawInner);
}
+ [Test]
+ public void TestHandlesCollections()
+ {
+ var marsh = new Marshaller(new BinaryConfiguration
+ {
+ TypeConfigurations = new[]
+ {
+ new BinaryTypeConfiguration(typeof (HandleCollection))
+ }
+ });
+
+ // Collection in collection dependency loop
+ var collection = new ArrayList {1, 2};
+ collection.Add(collection);
+
+ var collectionRaw = new ArrayList(collection);
+ collectionRaw.Add(collectionRaw);
+
+ var collectionObj = new ArrayList(collectionRaw);
+ collectionObj.Add(collectionObj);
+
+ var dict = new Hashtable { { 1, 1 }, { 2, 2 } };
+ dict.Add(3, dict);
+
+ var arr = collectionObj.ToArray();
+ arr[1] = arr;
+
+ object entry = new DictionaryEntry(1, 2);
+ var dictionaryEntryValSetter = DelegateConverter.CompileFieldSetter(typeof (DictionaryEntry)
+ .GetField("_value", BindingFlags.Instance | BindingFlags.NonPublic));
+ dictionaryEntryValSetter(entry, entry); // modify boxed copy to create reference loop
+
+ var data = new HandleCollection
+ {
+ Collection = collection,
+ CollectionRaw = collectionRaw,
+ Object = collectionObj,
+ Dictionary = dict,
+ Array = arr,
+ DictionaryEntry = (DictionaryEntry) entry
+ };
+
+ var res = marsh.Unmarshal<HandleCollection>(marsh.Marshal(data));
+
+ var resCollection = (ArrayList) res.Collection;
+ Assert.AreEqual(collection[0], resCollection[0]);
+ Assert.AreEqual(collection[1], resCollection[1]);
+ Assert.AreSame(resCollection, resCollection[2]);
+
+ var resCollectionRaw = (ArrayList) res.CollectionRaw;
+ Assert.AreEqual(collectionRaw[0], resCollectionRaw[0]);
+ Assert.AreEqual(collectionRaw[1], resCollectionRaw[1]);
+ Assert.AreSame(resCollection, resCollectionRaw[2]);
+ Assert.AreSame(resCollectionRaw, resCollectionRaw[3]);
+
+ var resCollectionObj = (ArrayList) res.Object;
+ Assert.AreEqual(collectionObj[0], resCollectionObj[0]);
+ Assert.AreEqual(collectionObj[1], resCollectionObj[1]);
+ Assert.AreSame(resCollection, resCollectionObj[2]);
+ Assert.AreSame(resCollectionRaw, resCollectionObj[3]);
+ Assert.AreSame(resCollectionObj, resCollectionObj[4]);
+
+ var resDict = (Hashtable) res.Dictionary;
+ Assert.AreEqual(1, resDict[1]);
+ Assert.AreEqual(2, resDict[2]);
+ Assert.AreSame(resDict, resDict[3]);
+
+ var resArr = res.Array;
+ Assert.AreEqual(arr[0], resArr[0]);
+ Assert.AreSame(resArr, resArr[1]);
+ Assert.AreSame(resCollection, resArr[2]);
+ Assert.AreSame(resCollectionRaw, resArr[3]);
+ Assert.AreSame(resCollectionObj, resArr[4]);
+
+ var resEntry = res.DictionaryEntry;
+ var innerEntry = (DictionaryEntry) resEntry.Value;
+ Assert.AreEqual(1, resEntry.Key);
+ Assert.AreEqual(1, innerEntry.Key);
+ Assert.IsTrue(ReferenceEquals(innerEntry.Value, ((DictionaryEntry) innerEntry.Value).Value));
+ }
+
///
/// <summary>Test KeepSerialized property</summary>
///
@@ -2186,6 +2269,36 @@ namespace Apache.Ignite.Core.Tests.Binary
}
}
+ public class HandleCollection : IBinarizable
+ {
+ public ICollection Collection { get; set; }
+ public IDictionary Dictionary { get; set; }
+ public DictionaryEntry DictionaryEntry { get; set; }
+ public ICollection CollectionRaw { get; set; }
+ public object Object { get; set; }
+ public object[] Array { get; set; }
+
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ writer.WriteCollection("col", Collection);
+ writer.WriteDictionary("dict", Dictionary);
+ writer.WriteObject("dictEntry", DictionaryEntry);
+ writer.WriteObject("obj", Object);
+ writer.WriteArray("arr", Array);
+ writer.GetRawWriter().WriteCollection(CollectionRaw);
+ }
+
+ public void ReadBinary(IBinaryReader reader)
+ {
+ Collection = reader.ReadCollection("col");
+ Dictionary = reader.ReadDictionary("dict");
+ DictionaryEntry = reader.ReadObject<DictionaryEntry>("dictEntry");
+ Object = reader.ReadObject<object>("obj");
+ Array = reader.ReadArray<object>("arr");
+ CollectionRaw = reader.GetRawReader().ReadCollection();
+ }
+ }
+
public class PropertyType
{
public int Field1;
http://git-wip-us.apache.org/repos/asf/ignite/blob/cadc61fa/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 dedf084..bfedce9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -194,6 +194,7 @@
<Compile Include="IIgnite.cs" />
<Compile Include="Impl\Binary\BinaryEnum.cs" />
<Compile Include="Impl\Binary\BinaryObjectSchemaSerializer.cs" />
+ <Compile Include="Impl\Binary\ReferenceEqualityComparer.cs" />
<Compile Include="Impl\Binary\JavaTypes.cs" />
<Compile Include="Impl\Cache\CacheAffinityImpl.cs" />
<Compile Include="Impl\Cache\CacheEntry.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/cadc61fa/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryHandleDictionary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryHandleDictionary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryHandleDictionary.cs
index 3f39bcc..08e17ca 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryHandleDictionary.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryHandleDictionary.cs
@@ -50,22 +50,28 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Third value. */
private TV _val3;
+ /** Comparer. */
+ private readonly IEqualityComparer<TK> _comparer;
+
/// <summary>
/// Constructor with initial key-value pair.
/// </summary>
/// <param name="key">Key.</param>
/// <param name="val">Value.</param>
+ /// <param name="comparer">The comparer.</param>
[SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors"),
SuppressMessage("ReSharper", "DoNotCallOverridableMethodsInConstructor")]
- public BinaryHandleDictionary(TK key, TV val)
+ public BinaryHandleDictionary(TK key, TV val, IEqualityComparer<TK> comparer)
{
- Debug.Assert(!Equals(key, EmptyKey));
-
_key1 = key;
_val1 = val;
_key2 = EmptyKey;
_key3 = EmptyKey;
+
+ _comparer = comparer ?? EqualityComparer<TK>.Default;
+
+ Debug.Assert(!_comparer.Equals(key, EmptyKey));
}
/// <summary>
@@ -75,9 +81,9 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Value.</param>
public void Add(TK key, TV val)
{
- Debug.Assert(!Equals(key, EmptyKey));
+ Debug.Assert(!_comparer.Equals(key, EmptyKey));
- if (Equals(_key2, EmptyKey))
+ if (_comparer.Equals(_key2, EmptyKey))
{
_key2 = key;
_val2 = val;
@@ -85,7 +91,7 @@ namespace Apache.Ignite.Core.Impl.Binary
return;
}
- if (Equals(_key3, EmptyKey))
+ if (_comparer.Equals(_key3, EmptyKey))
{
_key3 = key;
_val3 = val;
@@ -94,7 +100,7 @@ namespace Apache.Ignite.Core.Impl.Binary
}
if (_dict == null)
- _dict = new Dictionary<TK, TV>(InitialSize);
+ _dict = new Dictionary<TK, TV>(InitialSize, _comparer);
_dict[key] = val;
}
@@ -107,23 +113,23 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <returns>True if key was found.</returns>
public bool TryGetValue(TK key, out TV val)
{
- Debug.Assert(!Equals(key, EmptyKey));
+ Debug.Assert(!_comparer.Equals(key, EmptyKey));
- if (Equals(key, _key1))
+ if (_comparer.Equals(key, _key1))
{
val = _val1;
return true;
}
- if (Equals(key, _key2))
+ if (_comparer.Equals(key, _key2))
{
val = _val2;
return true;
}
- if (Equals(key, _key3))
+ if (_comparer.Equals(key, _key3))
{
val = _val3;
@@ -167,10 +173,10 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Value.</param>
private void AddIfAbsent(TK key, TV val)
{
- if (Equals(key, EmptyKey))
+ if (_comparer.Equals(key, EmptyKey))
return;
- if (Equals(key, _key1) || Equals(key, _key2) || Equals(key, _key3))
+ if (_comparer.Equals(key, _key1) || _comparer.Equals(key, _key2) || _comparer.Equals(key, _key3))
return;
if (_dict == null || !_dict.ContainsKey(key))
http://git-wip-us.apache.org/repos/asf/ignite/blob/cadc61fa/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
index 21c1642..1403410 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -874,7 +874,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="pos">Position.</param>
/// <param name="obj">Object.</param>
- private void AddHandle(int pos, object obj)
+ internal void AddHandle(int pos, object obj)
{
if (_hnds == null)
_hnds = new BinaryReaderHandleDictionary(pos, obj);
@@ -905,35 +905,6 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/// <summary>
- /// Determines whether header at current position is HDR_NULL.
- /// </summary>
- private bool IsNotNullHeader(byte expHdr)
- {
- var hdr = ReadByte();
-
- if (hdr == BinaryUtils.HdrNull)
- return false;
-
- if (expHdr != hdr)
- throw new BinaryObjectException(string.Format("Invalid header on deserialization. " +
- "Expected: {0} but was: {1}", expHdr, hdr));
-
- return true;
- }
-
- /// <summary>
- /// Seeks the field by name, reads header and returns true if field is present and header is not null.
- /// </summary>
- private bool SeekField(string fieldName, byte expHdr)
- {
- if (!SeekField(fieldName))
- return false;
-
- // Expected read order, no need to seek.
- return IsNotNullHeader(expHdr);
- }
-
- /// <summary>
/// Seeks the field by name.
/// </summary>
private bool SeekField(string fieldName)
@@ -971,7 +942,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
private T ReadField<T>(string fieldName, Func<IBinaryStream, T> readFunc, byte expHdr)
{
- return SeekField(fieldName, expHdr) ? readFunc(Stream) : default(T);
+ return SeekField(fieldName) ? Read(readFunc, expHdr) : default(T);
}
/// <summary>
@@ -979,7 +950,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
private T ReadField<T>(string fieldName, Func<BinaryReader, T> readFunc, byte expHdr)
{
- return SeekField(fieldName, expHdr) ? readFunc(this) : default(T);
+ return SeekField(fieldName) ? Read(readFunc, expHdr) : default(T);
}
/// <summary>
@@ -987,7 +958,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
private T ReadField<T>(string fieldName, Func<T> readFunc, byte expHdr)
{
- return SeekField(fieldName, expHdr) ? readFunc() : default(T);
+ return SeekField(fieldName) ? Read(readFunc, expHdr) : default(T);
}
/// <summary>
@@ -995,7 +966,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
private T Read<T>(Func<BinaryReader, T> readFunc, byte expHdr)
{
- return IsNotNullHeader(expHdr) ? readFunc(this) : default(T);
+ return Read(() => readFunc(this), expHdr);
}
/// <summary>
@@ -1003,7 +974,27 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
private T Read<T>(Func<IBinaryStream, T> readFunc, byte expHdr)
{
- return IsNotNullHeader(expHdr) ? readFunc(Stream) : default(T);
+ return Read(() => readFunc(Stream), expHdr);
+ }
+
+ /// <summary>
+ /// Reads header and invokes specified func if the header is not null.
+ /// </summary>
+ private T Read<T>(Func<T> readFunc, byte expHdr)
+ {
+ var hdr = ReadByte();
+
+ if (hdr == BinaryUtils.HdrNull)
+ return default(T);
+
+ if (hdr == BinaryUtils.HdrHnd)
+ return ReadHandleObject<T>(Stream.Position - 1);
+
+ if (expHdr != hdr)
+ throw new BinaryObjectException(string.Format("Invalid header on deserialization. " +
+ "Expected: {0} but was: {1}", expHdr, hdr));
+
+ return readFunc();
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/cadc61fa/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderHandleDictionary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderHandleDictionary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderHandleDictionary.cs
index c145e7f..8a9a466 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderHandleDictionary.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReaderHandleDictionary.cs
@@ -28,7 +28,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="key">Key.</param>
/// <param name="val">Value.</param>
public BinaryReaderHandleDictionary(int key, object val)
- : base(key, val)
+ : base(key, val, null)
{
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cadc61fa/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
index 36e324d..89925dd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
@@ -26,24 +26,14 @@ namespace Apache.Ignite.Core.Impl.Binary
using Apache.Ignite.Core.Impl.Binary.IO;
using Apache.Ignite.Core.Impl.Common;
- /// <summary>
- /// Write delegate.
- /// </summary>
- /// <param name="writer">Write context.</param>
- /// <param name="obj">Object to write.</param>
- internal delegate void BinarySystemWriteDelegate(BinaryWriter writer, object obj);
-
/**
* <summary>Collection of predefined handlers for various system types.</summary>
*/
internal static class BinarySystemHandlers
{
/** Write handlers. */
- private static volatile Dictionary<Type, BinarySystemWriteDelegate> _writeHandlers =
- new Dictionary<Type, BinarySystemWriteDelegate>();
-
- /** Mutex for write handlers update. */
- private static readonly object WriteHandlersMux = new object();
+ private static readonly CopyOnWriteConcurrentDictionary<Type, BinarySystemWriteHandler> WriteHandlers =
+ new CopyOnWriteConcurrentDictionary<Type, BinarySystemWriteHandler>();
/** Read handlers. */
private static readonly IBinarySystemReader[] ReadHandlers = new IBinarySystemReader[255];
@@ -171,32 +161,30 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
- public static BinarySystemWriteDelegate GetWriteHandler(Type type)
+ public static BinarySystemWriteHandler GetWriteHandler(Type type)
{
- BinarySystemWriteDelegate res;
-
- var writeHandlers0 = _writeHandlers;
-
- // Have we ever met this type?
- if (writeHandlers0 != null && writeHandlers0.TryGetValue(type, out res))
- return res;
-
- // Determine write handler for type and add it.
- res = FindWriteHandler(type);
+ return WriteHandlers.GetOrAdd(type, t =>
+ {
+ bool supportsHandles;
- if (res != null)
- AddWriteHandler(type, res);
+ var handler = FindWriteHandler(t, out supportsHandles);
- return res;
+ return handler == null ? null : new BinarySystemWriteHandler(handler, supportsHandles);
+ });
}
/// <summary>
/// Find write handler for type.
/// </summary>
/// <param name="type">Type.</param>
- /// <returns>Write handler or NULL.</returns>
- private static BinarySystemWriteDelegate FindWriteHandler(Type type)
+ /// <param name="supportsHandles">Flag indicating whether returned delegate supports handles.</param>
+ /// <returns>
+ /// Write handler or NULL.
+ /// </returns>
+ private static Action<BinaryWriter, object> FindWriteHandler(Type type, out bool supportsHandles)
{
+ supportsHandles = false;
+
// 1. Well-known types.
if (type == typeof(string))
return WriteString;
@@ -210,9 +198,15 @@ namespace Apache.Ignite.Core.Impl.Binary
return WriteBinary;
if (type == typeof (BinaryEnum))
return WriteBinaryEnum;
+ if (type.IsEnum)
+ return WriteEnum;
+
+ // All types below can be written as handles.
+ supportsHandles = true;
+
if (type == typeof (ArrayList))
return WriteArrayList;
- if (type == typeof(Hashtable))
+ if (type == typeof (Hashtable))
return WriteHashtable;
if (type.IsArray)
@@ -258,14 +252,11 @@ namespace Apache.Ignite.Core.Impl.Binary
return WriteEnumArray;
// Object array.
- if (elemType == typeof (object) || elemType == typeof(IBinaryObject) || elemType == typeof(BinaryObject))
+ if (elemType == typeof (object) || elemType == typeof (IBinaryObject) ||
+ elemType == typeof (BinaryObject))
return WriteArray;
}
- if (type.IsEnum)
- // We know how to write enums.
- return WriteEnum;
-
if (type.IsSerializable)
return WriteSerializable;
@@ -294,36 +285,6 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/// <summary>
- /// Add write handler for type.
- /// </summary>
- /// <param name="type"></param>
- /// <param name="handler"></param>
- private static void AddWriteHandler(Type type, BinarySystemWriteDelegate handler)
- {
- lock (WriteHandlersMux)
- {
- if (_writeHandlers == null)
- {
- Dictionary<Type, BinarySystemWriteDelegate> writeHandlers0 =
- new Dictionary<Type, BinarySystemWriteDelegate>();
-
- writeHandlers0[type] = handler;
-
- _writeHandlers = writeHandlers0;
- }
- else if (!_writeHandlers.ContainsKey(type))
- {
- Dictionary<Type, BinarySystemWriteDelegate> writeHandlers0 =
- new Dictionary<Type, BinarySystemWriteDelegate>(_writeHandlers);
-
- writeHandlers0[type] = handler;
-
- _writeHandlers = writeHandlers0;
- }
- }
- }
-
- /// <summary>
/// Reads an object of predefined type.
/// </summary>
public static bool TryReadSystemType<T>(byte typeId, BinaryReader ctx, out T res)
@@ -818,4 +779,47 @@ namespace Apache.Ignite.Core.Impl.Binary
}
}
}
+
+ /// <summary>
+ /// Write delegate + handles flag.
+ /// </summary>
+ internal class BinarySystemWriteHandler
+ {
+ /** */
+ private readonly Action<BinaryWriter, object> _writeAction;
+
+ /** */
+ private readonly bool _supportsHandles;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BinarySystemWriteHandler"/> class.
+ /// </summary>
+ /// <param name="writeAction">The write action.</param>
+ /// <param name="supportsHandles">Handles flag.</param>
+ public BinarySystemWriteHandler(Action<BinaryWriter, object> writeAction, bool supportsHandles = false)
+ {
+ Debug.Assert(writeAction != null);
+
+ _writeAction = writeAction;
+ _supportsHandles = supportsHandles;
+ }
+
+ /// <summary>
+ /// Writes object to a specified writer.
+ /// </summary>
+ /// <param name="writer">The writer.</param>
+ /// <param name="obj">The object.</param>
+ public void Write(BinaryWriter writer, object obj)
+ {
+ _writeAction(writer, obj);
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether this handler supports handles.
+ /// </summary>
+ public bool SupportsHandles
+ {
+ get { return _supportsHandles; }
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cadc61fa/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index b73a6c4..4142d60 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -1123,6 +1123,8 @@ namespace Apache.Ignite.Core.Impl.Binary
{
var stream = ctx.Stream;
+ var pos = stream.Position;
+
if (typed)
stream.ReadInt();
@@ -1130,6 +1132,8 @@ namespace Apache.Ignite.Core.Impl.Binary
var vals = new T[len];
+ ctx.AddHandle(pos - 1, vals);
+
for (int i = 0; i < len; i++)
vals[i] = ctx.Deserialize<T>();
@@ -1209,6 +1213,8 @@ namespace Apache.Ignite.Core.Impl.Binary
{
IBinaryStream stream = ctx.Stream;
+ int pos = stream.Position;
+
int len = stream.ReadInt();
byte colType = ctx.Stream.ReadByte();
@@ -1225,6 +1231,8 @@ namespace Apache.Ignite.Core.Impl.Binary
else
res = factory.Invoke(len);
+ ctx.AddHandle(pos - 1, res);
+
if (adder == null)
adder = (col, elem) => ((ArrayList) col).Add(elem);
@@ -1286,6 +1294,8 @@ namespace Apache.Ignite.Core.Impl.Binary
{
IBinaryStream stream = ctx.Stream;
+ int pos = stream.Position;
+
int len = stream.ReadInt();
// Skip dictionary type as we can do nothing with it here.
@@ -1293,6 +1303,8 @@ namespace Apache.Ignite.Core.Impl.Binary
var res = factory == null ? new Hashtable(len) : factory.Invoke(len);
+ ctx.AddHandle(pos - 1, res);
+
for (int i = 0; i < len; i++)
{
object key = ctx.Deserialize<object>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/cadc61fa/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index 47bc2b6..1ac98c4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -907,13 +907,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
WriteFieldId(fieldName, BinaryUtils.TypeArray);
- if (val == null)
- WriteNullField();
- else
- {
- _stream.WriteByte(BinaryUtils.TypeArray);
- BinaryUtils.WriteArray(val, this);
- }
+ WriteArray(val);
}
/// <summary>
@@ -936,6 +930,9 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
+ if (WriteHandle(_stream.Position, val))
+ return;
+
_stream.WriteByte(BinaryUtils.TypeArray);
BinaryUtils.WriteArray(val, this);
}
@@ -963,6 +960,9 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullField();
else
{
+ if (WriteHandle(_stream.Position, val))
+ return;
+
WriteByte(BinaryUtils.TypeCollection);
BinaryUtils.WriteCollection(val, this);
}
@@ -990,6 +990,9 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullField();
else
{
+ if (WriteHandle(_stream.Position, val))
+ return;
+
WriteByte(BinaryUtils.TypeDictionary);
BinaryUtils.WriteDictionary(val, this);
}
@@ -1194,7 +1197,10 @@ namespace Apache.Ignite.Core.Impl.Binary
if (handler == null) // We did our best, object cannot be marshalled.
throw new BinaryObjectException("Unsupported object type [type=" + type + ", object=" + obj + ']');
- handler(this, obj);
+ if (handler.SupportsHandles && WriteHandle(_stream.Position, obj))
+ return;
+
+ handler.Write(this, obj);
}
}
@@ -1326,7 +1332,7 @@ namespace Apache.Ignite.Core.Impl.Binary
if (_hnds == null)
{
// Cache absolute handle position.
- _hnds = new BinaryHandleDictionary<object, long>(obj, pos);
+ _hnds = new BinaryHandleDictionary<object, long>(obj, pos, ReferenceEqualityComparer<object>.Instance);
return false;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/cadc61fa/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/ReferenceEqualityComparer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/ReferenceEqualityComparer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/ReferenceEqualityComparer.cs
new file mode 100644
index 0000000..8038d6b
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/ReferenceEqualityComparer.cs
@@ -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.
+ */
+
+namespace Apache.Ignite.Core.Impl.Binary
+{
+ using System.Collections.Generic;
+ using System.Runtime.CompilerServices;
+
+ /// <summary>
+ /// Comparer that uses ReferenceEquals.
+ /// </summary>
+ internal class ReferenceEqualityComparer<T> : IEqualityComparer<T>
+ {
+ /// <summary>
+ /// Default instance.
+ /// </summary>
+ public static readonly ReferenceEqualityComparer<T> Instance = new ReferenceEqualityComparer<T>();
+
+ /** <inheritdoc /> */
+ public bool Equals(T x, T y)
+ {
+ return ReferenceEquals(x, y);
+ }
+
+ /** <inheritdoc /> */
+ public int GetHashCode(T obj)
+ {
+ return RuntimeHelpers.GetHashCode(obj);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/cadc61fa/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs
index fa19a9e..00bda16 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs
@@ -214,12 +214,10 @@ namespace Apache.Ignite.Core.Impl.Common
Debug.Assert(field.DeclaringType != null); // non-static
var targetParam = Expression.Parameter(typeof(object));
- var targetParamConverted = Expression.Convert(targetParam, field.DeclaringType);
-
var valParam = Expression.Parameter(typeof(object));
var valParamConverted = Expression.Convert(valParam, field.FieldType);
- var assignExpr = Expression.Call(GetWriteFieldMethod(field), targetParamConverted, valParamConverted);
+ var assignExpr = Expression.Call(GetWriteFieldMethod(field), targetParam, valParamConverted);
return Expression.Lambda<Action<object, object>>(assignExpr, targetParam, valParam).Compile();
}
[13/25] ignite git commit: Added ability to dump direct message
reader and writer (cherry picked from commit 660aa2f)
Posted by dm...@apache.org.
Added ability to dump direct message reader and writer
(cherry picked from commit 660aa2f)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/00139554
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/00139554
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/00139554
Branch: refs/heads/ignite-2849
Commit: 00139554ffdcfaae07970a2281b6dcec8cec0af4
Parents: 61a0a5f
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Mar 22 17:03:03 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Mar 22 17:28:39 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/direct/DirectMessageReader.java | 2 +-
.../apache/ignite/internal/direct/DirectMessageWriter.java | 4 ++--
.../ignite/internal/direct/state/DirectMessageState.java | 7 +++----
.../direct/stream/v2/DirectByteBufferStreamImplV2.java | 2 +-
.../org/apache/ignite/internal/util/nio/GridDirectParser.java | 4 ++--
.../org/apache/ignite/internal/util/nio/GridNioServer.java | 6 ++++++
6 files changed, 15 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/00139554/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
index b567a03..10bc7e2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
@@ -26,8 +26,8 @@ import org.apache.ignite.internal.direct.state.DirectMessageState;
import org.apache.ignite.internal.direct.state.DirectMessageStateItem;
import org.apache.ignite.internal.direct.stream.DirectByteBufferStream;
import org.apache.ignite.internal.direct.stream.v1.DirectByteBufferStreamImplV1;
-import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.direct.stream.v2.DirectByteBufferStreamImplV2;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteOutClosure;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.Message;
http://git-wip-us.apache.org/repos/asf/ignite/blob/00139554/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
index be17113..28993c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
@@ -26,9 +26,9 @@ import org.apache.ignite.internal.direct.state.DirectMessageState;
import org.apache.ignite.internal.direct.state.DirectMessageStateItem;
import org.apache.ignite.internal.direct.stream.DirectByteBufferStream;
import org.apache.ignite.internal.direct.stream.v1.DirectByteBufferStreamImplV1;
+import org.apache.ignite.internal.direct.stream.v2.DirectByteBufferStreamImplV2;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.direct.stream.v2.DirectByteBufferStreamImplV2;
import org.apache.ignite.lang.IgniteOutClosure;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.plugin.extensions.communication.Message;
@@ -336,7 +336,7 @@ public class DirectMessageWriter implements MessageWriter {
}
/** {@inheritDoc} */
- public String toString() {
+ @Override public String toString() {
return S.toString(DirectMessageWriter.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00139554/modules/core/src/main/java/org/apache/ignite/internal/direct/state/DirectMessageState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/state/DirectMessageState.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/state/DirectMessageState.java
index 8ad7fe0..58f625f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/state/DirectMessageState.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/state/DirectMessageState.java
@@ -18,8 +18,8 @@
package org.apache.ignite.internal.direct.state;
import java.lang.reflect.Array;
+import java.util.Arrays;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteOutClosure;
@@ -35,7 +35,6 @@ public class DirectMessageState<T extends DirectMessageStateItem> {
private final IgniteOutClosure<T> factory;
/** Stack array. */
- @GridToStringInclude
private T[] stack;
/** Current position. */
@@ -102,7 +101,7 @@ public class DirectMessageState<T extends DirectMessageStateItem> {
}
/** {@inheritDoc} */
- public String toString() {
- return S.toString(DirectMessageState.class, this);
+ @Override public String toString() {
+ return S.toString(DirectMessageState.class, this, "stack", Arrays.toString(stack));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00139554/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
index 7958793..d7dc990 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/stream/v2/DirectByteBufferStreamImplV2.java
@@ -1779,7 +1779,7 @@ public class DirectByteBufferStreamImplV2 implements DirectByteBufferStream {
}
/** {@inheritDoc} */
- public String toString() {
+ @Override public String toString() {
return S.toString(DirectByteBufferStreamImplV2.class, this);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00139554/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
index 76e7d4d..5a02662 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridDirectParser.java
@@ -33,10 +33,10 @@ import org.jetbrains.annotations.Nullable;
*/
public class GridDirectParser implements GridNioParser {
/** Message metadata key. */
- private static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+ static final int MSG_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
/** Reader metadata key. */
- private static final int READER_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
+ static final int READER_META_KEY = GridNioSessionMetaKey.nextUniqueKey();
/** */
private final IgniteLogger log;
http://git-wip-us.apache.org/repos/asf/ignite/blob/00139554/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 0d5c5de..c9c64ec 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
@@ -64,6 +64,7 @@ import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgnitePredicate;
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.thread.IgniteThread;
import org.jetbrains.annotations.Nullable;
@@ -1455,9 +1456,14 @@ public class GridNioServer<T> {
for (SelectionKey key : keys) {
GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+ MessageWriter writer = ses.meta(MSG_WRITER.ordinal());
+ MessageReader reader = ses.meta(GridDirectParser.READER_META_KEY);
+
sb.append(" Connection info [")
.append("rmtAddr=").append(ses.remoteAddress())
.append(", locAddr=").append(ses.localAddress())
+ .append(", msgWriter=").append(writer != null ? writer.toString() : "null")
+ .append(", msgReader=").append(reader != null ? reader.toString() : "null")
.append(", bytesRcvd=").append(ses.bytesReceived())
.append(", bytesSent=").append(ses.bytesSent());
[21/25] ignite git commit: Reverted accidental change to
GridCacheMapEntry (commit b189bb2e15e7a54).
Posted by dm...@apache.org.
Reverted accidental change to GridCacheMapEntry (commit b189bb2e15e7a54).
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/88c65b84
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/88c65b84
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/88c65b84
Branch: refs/heads/ignite-2849
Commit: 88c65b84847244401eb6a7c520bbbcb2158685c0
Parents: 90a5bbe
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Mar 24 10:40:15 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 24 10:40:15 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/cache/GridCacheMapEntry.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/88c65b84/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 6677c6a..fb6aeef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -2453,12 +2453,10 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
recordNodeId(affNodeId, topVer);
- if (hadVal) {
- updateCntr0 = nextPartCounter(topVer);
+ updateCntr0 = nextPartCounter(topVer);
- if (updateCntr != null)
- updateCntr0 = updateCntr;
- }
+ if (updateCntr != null)
+ updateCntr0 = updateCntr;
drReplicate(drType, null, newVer, topVer);
[08/25] ignite git commit: IGNITE-2806: IGFS: Implemented relaxed
consistency model.
Posted by dm...@apache.org.
IGNITE-2806: IGFS: Implemented relaxed consistency model.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2694c3ce
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2694c3ce
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2694c3ce
Branch: refs/heads/ignite-2849
Commit: 2694c3ce1e2c55151dac741a5d162b1e73239e52
Parents: c3b02dc
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Mar 22 12:34:35 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Mar 22 12:34:35 2016 +0300
----------------------------------------------------------------------
.../configuration/FileSystemConfiguration.java | 49 +++++++++++++++++-
.../processors/igfs/IgfsMetaManager.java | 38 ++++++++------
.../internal/processors/igfs/IgfsPathIds.java | 52 ++++++++++++++------
.../internal/processors/igfs/IgfsProcessor.java | 29 ++++++-----
.../processors/igfs/IgfsAbstractSelfTest.java | 11 +++++
.../igfs/IgfsPrimaryRelaxedSelfTest.java | 28 +++++++++++
.../processors/igfs/IgfsProcessorSelfTest.java | 17 ++++---
.../ignite/testsuites/IgniteIgfsTestSuite.java | 2 +
8 files changed, 177 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2694c3ce/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
index 99d364e..0d7f3cc 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
@@ -17,8 +17,6 @@
package org.apache.ignite.configuration;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.igfs.IgfsIpcEndpointConfiguration;
import org.apache.ignite.igfs.IgfsMode;
@@ -27,6 +25,9 @@ import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+
/**
* {@code IGFS} configuration. More than one file system can be configured within grid.
* {@code IGFS} configuration is provided via {@link IgniteConfiguration#getFileSystemConfiguration()}
@@ -87,6 +88,9 @@ public class FileSystemConfiguration {
/** Default value of metadata co-location flag. */
public static boolean DFLT_COLOCATE_META = true;
+ /** Default value of relaxed consistency flag. */
+ public static boolean DFLT_RELAXED_CONSISTENCY = true;
+
/** IGFS instance name. */
private String name;
@@ -171,6 +175,9 @@ public class FileSystemConfiguration {
/** Metadata co-location flag. */
private boolean colocateMeta = DFLT_COLOCATE_META;
+ /** Relaxed consistency flag. */
+ private boolean relaxedConsistency = DFLT_RELAXED_CONSISTENCY;
+
/**
* Constructs default configuration.
*/
@@ -215,6 +222,7 @@ public class FileSystemConfiguration {
perNodeBatchSize = cfg.getPerNodeBatchSize();
perNodeParallelBatchCnt = cfg.getPerNodeParallelBatchCount();
prefetchBlocks = cfg.getPrefetchBlocks();
+ relaxedConsistency = cfg.isRelaxedConsistency();
seqReadsBeforePrefetch = cfg.getSequentialReadsBeforePrefetch();
trashPurgeTimeout = cfg.getTrashPurgeTimeout();
}
@@ -877,6 +885,43 @@ public class FileSystemConfiguration {
this.colocateMeta = colocateMeta;
}
+ /**
+ * Get relaxed consistency flag.
+ * <p>
+ * Concurrent file system operations might conflict with each other. E.g. {@code move("/a1/a2", "/b")} and
+ * {@code move("/b", "/a1")}. Hence, it is necessary to atomically verify that participating paths are still
+ * on their places to keep file system in consistent state in such cases. These checks are expensive in
+ * distributed environment.
+ * <p>
+ * Real applications, e.g. Hadoop jobs, rarely produce conflicting operations. So additional checks could be
+ * skipped in these scenarios without any negative effect on file system integrity. It significantly increases
+ * performance of file system operations.
+ * <p>
+ * If value of this flag is {@code true}, IGFS will skip expensive consistency checks. It is recommended to set
+ * this flag to {@code false} if your application has conflicting operations, or you do not how exactly users will
+ * use your system.
+ * <p>
+ * This property affects only {@link IgfsMode#PRIMARY} paths.
+ * <p>
+ * Defaults to {@link #DFLT_RELAXED_CONSISTENCY}.
+ *
+ * @return {@code True} if relaxed consistency is enabled.
+ */
+ public boolean isRelaxedConsistency() {
+ return relaxedConsistency;
+ }
+
+ /**
+ * Set relaxed consistency flag.
+ * <p>
+ * See {@link #isColocateMetadata()} for more information.
+ *
+ * @param relaxedConsistency Whether to use relaxed consistency optimization.
+ */
+ public void setRelaxedConsistency(boolean relaxedConsistency) {
+ this.relaxedConsistency = relaxedConsistency;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(FileSystemConfiguration.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/2694c3ce/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
index d6c5995..a4212ba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
@@ -136,8 +136,20 @@ public class IgfsMetaManager extends IgfsManager {
/** Busy lock. */
private final GridSpinBusyLock busyLock = new GridSpinBusyLock();
+ /** Relaxed flag. */
+ private final boolean relaxed;
+
/**
+ * Constructor.
*
+ * @param relaxed Relaxed mode flag.
+ */
+ public IgfsMetaManager(boolean relaxed) {
+ this.relaxed = relaxed;
+ }
+
+ /**
+ * Await initialization.
*/
void awaitInit() {
try {
@@ -889,19 +901,19 @@ public class IgfsMetaManager extends IgfsManager {
// Lock participating IDs.
final Set<IgniteUuid> lockIds = new TreeSet<>(PATH_ID_SORTING_COMPARATOR);
- srcPathIds.addExistingIds(lockIds);
- dstPathIds.addExistingIds(lockIds);
+ srcPathIds.addExistingIds(lockIds, relaxed);
+ dstPathIds.addExistingIds(lockIds, relaxed);
try (IgniteInternalTx tx = startTx()) {
// Obtain the locks.
final Map<IgniteUuid, IgfsEntryInfo> lockInfos = lockIds(lockIds);
// Verify integrity of source and destination paths.
- if (!srcPathIds.verifyIntegrity(lockInfos))
+ if (!srcPathIds.verifyIntegrity(lockInfos, relaxed))
throw new IgfsPathNotFoundException("Failed to perform move because source directory " +
"structure changed concurrently [src=" + srcPath + ", dst=" + dstPath + ']');
- if (!dstPathIds.verifyIntegrity(lockInfos))
+ if (!dstPathIds.verifyIntegrity(lockInfos, relaxed))
throw new IgfsPathNotFoundException("Failed to perform move because destination directory " +
"structure changed concurrently [src=" + srcPath + ", dst=" + dstPath + ']');
@@ -1103,7 +1115,7 @@ public class IgfsMetaManager extends IgfsManager {
// Prepare IDs to lock.
SortedSet<IgniteUuid> allIds = new TreeSet<>(PATH_ID_SORTING_COMPARATOR);
- pathIds.addExistingIds(allIds);
+ pathIds.addExistingIds(allIds, relaxed);
IgniteUuid trashId = IgfsUtils.randomTrashId();
@@ -1114,7 +1126,7 @@ public class IgfsMetaManager extends IgfsManager {
Map<IgniteUuid, IgfsEntryInfo> lockInfos = lockIds(allIds);
// Ensure that all participants are still in place.
- if (!pathIds.verifyIntegrity(lockInfos))
+ if (!pathIds.verifyIntegrity(lockInfos, relaxed))
return null;
IgfsEntryInfo victimInfo = lockInfos.get(victimId);
@@ -1589,16 +1601,14 @@ public class IgfsMetaManager extends IgfsManager {
// Prepare lock IDs. Essentially, they consist of two parts: existing IDs and potential new IDs.
Set<IgniteUuid> lockIds = new TreeSet<>(PATH_ID_SORTING_COMPARATOR);
- pathIds.addExistingIds(lockIds);
+ pathIds.addExistingIds(lockIds, relaxed);
pathIds.addSurrogateIds(lockIds);
- assert lockIds.size() == pathIds.count();
-
// Start TX.
try (IgniteInternalTx tx = startTx()) {
final Map<IgniteUuid, IgfsEntryInfo> lockInfos = lockIds(lockIds);
- if (!pathIds.verifyIntegrity(lockInfos))
+ if (!pathIds.verifyIntegrity(lockInfos, relaxed))
// Directory structure changed concurrently. So we simply re-try.
continue;
@@ -2907,14 +2917,14 @@ public class IgfsMetaManager extends IgfsManager {
// Prepare lock IDs.
Set<IgniteUuid> lockIds = new TreeSet<>(PATH_ID_SORTING_COMPARATOR);
- pathIds.addExistingIds(lockIds);
+ pathIds.addExistingIds(lockIds, relaxed);
pathIds.addSurrogateIds(lockIds);
// Start TX.
try (IgniteInternalTx tx = startTx()) {
Map<IgniteUuid, IgfsEntryInfo> lockInfos = lockIds(lockIds);
- if (!pathIds.verifyIntegrity(lockInfos))
+ if (!pathIds.verifyIntegrity(lockInfos, relaxed))
// Directory structure changed concurrently. So we simply re-try.
continue;
@@ -2998,7 +3008,7 @@ public class IgfsMetaManager extends IgfsManager {
// Prepare lock IDs.
Set<IgniteUuid> lockIds = new TreeSet<>(PATH_ID_SORTING_COMPARATOR);
- pathIds.addExistingIds(lockIds);
+ pathIds.addExistingIds(lockIds, relaxed);
pathIds.addSurrogateIds(lockIds);
// In overwrite mode we also lock ID of potential replacement as well as trash ID.
@@ -3017,7 +3027,7 @@ public class IgfsMetaManager extends IgfsManager {
try (IgniteInternalTx tx = startTx()) {
Map<IgniteUuid, IgfsEntryInfo> lockInfos = lockIds(lockIds);
- if (!pathIds.verifyIntegrity(lockInfos))
+ if (!pathIds.verifyIntegrity(lockInfos, relaxed))
// Directory structure changed concurrently. So we simply re-try.
continue;
http://git-wip-us.apache.org/repos/asf/ignite/blob/2694c3ce/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathIds.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathIds.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathIds.java
index e2fe58d..446495e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathIds.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathIds.java
@@ -221,11 +221,20 @@ public class IgfsPathIds {
* Add existing IDs to provided collection.
*
* @param col Collection.
+ * @param relaxed Relaxed mode flag.
*/
@SuppressWarnings("ManualArrayToCollectionCopy")
- public void addExistingIds(Collection<IgniteUuid> col) {
- for (int i = 0; i <= lastExistingIdx; i++)
- col.add(ids[i]);
+ public void addExistingIds(Collection<IgniteUuid> col, boolean relaxed) {
+ if (relaxed) {
+ col.add(ids[lastExistingIdx]);
+
+ if (lastExistingIdx == ids.length - 1 && lastExistingIdx > 0)
+ col.add(ids[lastExistingIdx - 1]);
+ }
+ else {
+ for (int i = 0; i <= lastExistingIdx; i++)
+ col.add(ids[i]);
+ }
}
/**
@@ -265,24 +274,39 @@ public class IgfsPathIds {
* Verify that observed paths are found in provided infos in the right order.
*
* @param infos Info.
+ * @param relaxed Whether to perform check in relaxed mode.
* @return {@code True} if full integrity is preserved.
*/
- public boolean verifyIntegrity(Map<IgniteUuid, IgfsEntryInfo> infos) {
- for (int i = 0; i <= lastExistingIdx; i++) {
- IgniteUuid curId = ids[i];
- IgfsEntryInfo curInfo = infos.get(curId);
+ public boolean verifyIntegrity(Map<IgniteUuid, IgfsEntryInfo> infos, boolean relaxed) {
+ if (relaxed) {
+ // Relaxed mode ensures that the last element is there. If this element is the last in the path, then
+ // existence of it's parent and link between them are checked as well.
+ IgfsEntryInfo info = infos.get(ids[lastExistingIdx]);
- // Check if required ID is there.
- if (curInfo == null)
+ if (info == null)
return false;
- // For non-leaf entry we check if child exists.
- if (i < lastExistingIdx) {
- String childName = parts[i + 1];
- IgniteUuid childId = ids[i + 1];
+ if (lastExistingIdx == ids.length - 1 && lastExistingIdx > 0) {
+ IgfsEntryInfo parentInfo = infos.get(ids[lastExistingIdx - 1]);
+
+ if (parentInfo == null || !parentInfo.hasChild(parts[lastExistingIdx], ids[lastExistingIdx]))
+ return false;
+ }
+ }
+ else {
+ // Strict mode ensures that all participants are in place and are still linked.
+ for (int i = 0; i <= lastExistingIdx; i++) {
+ IgfsEntryInfo info = infos.get(ids[i]);
- if (!curInfo.hasChild(childName, childId))
+ // Check if required ID is there.
+ if (info == null)
return false;
+
+ // For non-leaf entry we check if child exists.
+ if (i < lastExistingIdx) {
+ if (!info.hasChild(parts[i + 1], ids[i + 1]))
+ return false;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2694c3ce/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
index 1b60252..44f6e44 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
@@ -17,16 +17,6 @@
package org.apache.ignite.internal.processors.igfs;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentMap;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.cache.affinity.AffinityKeyMapper;
@@ -53,6 +43,17 @@ import org.apache.ignite.lang.IgniteClosure;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentMap;
+
import static org.apache.ignite.IgniteSystemProperties.IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK;
import static org.apache.ignite.IgniteSystemProperties.getBoolean;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -104,10 +105,12 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
// Start IGFS instances.
for (FileSystemConfiguration cfg : cfgs) {
+ FileSystemConfiguration cfg0 = new FileSystemConfiguration(cfg);
+
IgfsContext igfsCtx = new IgfsContext(
ctx,
- new FileSystemConfiguration(cfg),
- new IgfsMetaManager(),
+ cfg0,
+ new IgfsMetaManager(cfg0.isRelaxedConsistency()),
new IgfsDataManager(),
new IgfsServerManager(),
new IgfsFragmentizerManager());
@@ -116,7 +119,7 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
for (IgfsManager mgr : igfsCtx.managers())
mgr.start(igfsCtx);
- igfsCache.put(maskName(cfg.getName()), igfsCtx);
+ igfsCache.put(maskName(cfg0.getName()), igfsCtx);
}
if (log.isDebugEnabled())
http://git-wip-us.apache.org/repos/asf/ignite/blob/2694c3ce/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index 5894fa2..ec3878c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -225,6 +225,13 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
}
/**
+ * @return Relaxed consistency flag.
+ */
+ protected boolean relaxedConsistency() {
+ return false;
+ }
+
+ /**
* Data chunk.
*
* @param len Length.
@@ -302,6 +309,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
igfsCfg.setSecondaryFileSystem(secondaryFs);
igfsCfg.setPrefetchBlocks(PREFETCH_BLOCKS);
igfsCfg.setSequentialReadsBeforePrefetch(SEQ_READS_BEFORE_PREFETCH);
+ igfsCfg.setRelaxedConsistency(relaxedConsistency());
CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
@@ -2368,6 +2376,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
private void checkDeadlocksRepeat(final int lvlCnt, final int childrenDirPerLvl, final int childrenFilePerLvl,
int primaryLvlCnt, int renCnt, int delCnt,
int updateCnt, int mkdirsCnt, int createCnt) throws Exception {
+ if (relaxedConsistency())
+ return;
+
for (int i = 0; i < REPEAT_CNT; i++) {
try {
checkDeadlocks(lvlCnt, childrenDirPerLvl, childrenFilePerLvl, primaryLvlCnt, renCnt, delCnt,
http://git-wip-us.apache.org/repos/asf/ignite/blob/2694c3ce/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsPrimaryRelaxedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsPrimaryRelaxedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsPrimaryRelaxedSelfTest.java
new file mode 100644
index 0000000..6691df5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsPrimaryRelaxedSelfTest.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.processors.igfs;
+
+/**
+ * Tests for PRIMARY mode and relaxed consistency model.
+ */
+public class IgfsPrimaryRelaxedSelfTest extends IgfsPrimarySelfTest {
+ /** {@inheritDoc} */
+ @Override protected boolean relaxedConsistency() {
+ return true;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/2694c3ce/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
index bcc2314..269706e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
@@ -779,14 +780,18 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest {
assert !igfs.exists(path(dirPath));
assert !igfs.exists(path(filePath));
- int metaSize = 0;
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ int metaSize = 0;
- for (Object metaId : grid(0).cachex(igfs.configuration().getMetaCacheName()).keySet()) {
- if (!IgfsUtils.isRootOrTrashId((IgniteUuid)metaId))
- metaSize++;
- }
+ for (Object metaId : grid(0).cachex(igfs.configuration().getMetaCacheName()).keySet()) {
+ if (!IgfsUtils.isRootOrTrashId((IgniteUuid)metaId))
+ metaSize++;
+ }
- assert metaSize == 0;
+ return metaSize == 0;
+ }
+ }, 5000);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/2694c3ce/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
index 489088c..038cb54 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
@@ -40,6 +40,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsModesSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsOneClientNodeTest;
import org.apache.ignite.internal.processors.igfs.IgfsPrimaryOffheapTieredSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsPrimaryOffheapValuesSelfTest;
+import org.apache.ignite.internal.processors.igfs.IgfsPrimaryRelaxedSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsPrimarySelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsProcessorSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsProcessorValidationSelfTest;
@@ -67,6 +68,7 @@ public class IgniteIgfsTestSuite extends TestSuite {
TestSuite suite = new TestSuite("Ignite FS Test Suite For Platform Independent Tests");
suite.addTest(new TestSuite(IgfsPrimarySelfTest.class));
+ suite.addTest(new TestSuite(IgfsPrimaryRelaxedSelfTest.class));
suite.addTest(new TestSuite(IgfsPrimaryOffheapTieredSelfTest.class));
suite.addTest(new TestSuite(IgfsPrimaryOffheapValuesSelfTest.class));
suite.addTest(new TestSuite(IgfsDualSyncSelfTest.class));
[09/25] ignite git commit: IGFS: Added misssing "final" modifiers to
FileSystemConfiguration defaults.
Posted by dm...@apache.org.
IGFS: Added misssing "final" modifiers to FileSystemConfiguration defaults.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/409a623a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/409a623a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/409a623a
Branch: refs/heads/ignite-2849
Commit: 409a623aad9c63904404875aa548caf038f2c3b9
Parents: 2694c3c
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Mar 22 12:46:23 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Mar 22 12:46:23 2016 +0300
----------------------------------------------------------------------
.../org/apache/ignite/configuration/FileSystemConfiguration.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/409a623a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
index 0d7f3cc..518bbf6 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
@@ -86,10 +86,10 @@ public class FileSystemConfiguration {
public static final boolean DFLT_INIT_DFLT_PATH_MODES = true;
/** Default value of metadata co-location flag. */
- public static boolean DFLT_COLOCATE_META = true;
+ public static final boolean DFLT_COLOCATE_META = true;
/** Default value of relaxed consistency flag. */
- public static boolean DFLT_RELAXED_CONSISTENCY = true;
+ public static final boolean DFLT_RELAXED_CONSISTENCY = true;
/** IGFS instance name. */
private String name;
[02/25] ignite git commit: Added test.
Posted by dm...@apache.org.
Added test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/43ff1488
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/43ff1488
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/43ff1488
Branch: refs/heads/ignite-2849
Commit: 43ff1488fba3c75ac9097c5374c0edd868131f23
Parents: cadc61fa
Author: sboikov <sb...@gridgain.com>
Authored: Mon Mar 21 18:11:40 2016 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Mar 21 18:11:40 2016 +0300
----------------------------------------------------------------------
.../distributed/IgniteCacheCreatePutTest.java | 137 ++++++++++++++++++-
1 file changed, 130 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/43ff1488/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
index 8b3d9d3..efba34a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
@@ -18,12 +18,15 @@
package org.apache.ignite.internal.processors.cache.distributed;
import java.util.concurrent.Callable;
+import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -31,6 +34,12 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+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;
+
/**
*
*/
@@ -41,6 +50,9 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest {
/** */
private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+ /** */
+ private boolean client;
+
/** {@inheritDoc} */
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -60,11 +72,13 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest {
CacheConfiguration ccfg = new CacheConfiguration();
ccfg.setName("cache*");
- ccfg.setCacheMode(CacheMode.PARTITIONED);
+ ccfg.setCacheMode(PARTITIONED);
ccfg.setBackups(1);
cfg.setCacheConfiguration(ccfg);
+ cfg.setClientMode(client);
+
return cfg;
}
@@ -74,10 +88,10 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- super.afterTestsStopped();
-
+ @Override protected void afterTest() throws Exception {
stopAllGrids();
+
+ super.afterTest();
}
/**
@@ -96,8 +110,7 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest {
final AtomicInteger idx = new AtomicInteger();
GridTestUtils.runMultiThreaded(new Callable<Void>() {
- @Override
- public Void call() throws Exception {
+ @Override public Void call() throws Exception {
int node = idx.getAndIncrement();
Ignite ignite = startGrid(node);
@@ -122,4 +135,114 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest {
stopAllGrids();
}
}
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testUpdatesAndCacheStart() throws Exception {
+ final int NODES = 4;
+
+ startGridsMultiThreaded(NODES);
+
+ Ignite ignite0 = ignite(0);
+
+ ignite0.createCache(cacheConfiguration("atomic-cache", ATOMIC));
+ ignite0.createCache(cacheConfiguration("tx-cache", TRANSACTIONAL));
+
+ final long stopTime = System.currentTimeMillis() + 60_000;
+
+ final AtomicInteger updateThreadIdx = new AtomicInteger();
+
+ IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ int nodeIdx = updateThreadIdx.getAndIncrement() % NODES;
+
+ Ignite node = ignite(nodeIdx);
+
+ IgniteCache cache1 = node.cache("atomic-cache");
+ IgniteCache cache2 = node.cache("tx-cache");
+
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ int iter = 0;
+
+ while (System.currentTimeMillis() < stopTime) {
+ Integer key = rnd.nextInt(10_000);
+
+ cache1.put(key, key);
+
+ cache2.put(key, key);
+
+ if (iter++ % 1000 == 0)
+ log.info("Update iteration: " + iter);
+ }
+
+ return null;
+ }
+ }, NODES * 2, "update-thread");
+
+ final AtomicInteger cacheThreadIdx = new AtomicInteger();
+
+ IgniteInternalFuture<?> cacheFut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ int nodeIdx = cacheThreadIdx.getAndIncrement() % NODES;
+
+ Ignite node = ignite(nodeIdx);
+
+ int iter = 0;
+
+ while (System.currentTimeMillis() < stopTime) {
+ String cacheName = "dynamic-cache-" + nodeIdx;
+
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setName(cacheName);
+
+ node.createCache(ccfg);
+
+ node.destroyCache(cacheName);
+
+ U.sleep(500);
+
+ if (iter++ % 1000 == 0)
+ log.info("Cache create iteration: " + iter);
+ }
+
+ return null;
+ }
+ }, NODES, "cache-thread");
+
+ while (!fut.isDone()) {
+ client = true;
+
+ startGrid(NODES);
+
+ stopGrid(NODES);
+
+ client = false;
+
+ startGrid(NODES);
+
+ stopGrid(NODES);
+ }
+
+ fut.get();
+ cacheFut.get();
+ }
+
+ /**
+ * @param name Cache name.
+ * @param atomicityMode Cache atomicity mode.
+ * @return Cache configuration.
+ */
+ private CacheConfiguration cacheConfiguration(String name, CacheAtomicityMode atomicityMode) {
+ CacheConfiguration ccfg = new CacheConfiguration();
+
+ ccfg.setName(name);
+ ccfg.setCacheMode(REPLICATED);
+ ccfg.setAtomicityMode(atomicityMode);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ return ccfg;
+ }
}
\ No newline at end of file
[22/25] ignite git commit: IGNITE-2876: Fixed possible starvation in
system pool caused by IgfsBlockMessage. This closes #575.
Posted by dm...@apache.org.
IGNITE-2876: Fixed possible starvation in system pool caused by IgfsBlockMessage. This closes #575.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bc14c802
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bc14c802
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bc14c802
Branch: refs/heads/ignite-2849
Commit: bc14c802f8d404392901abb7fb2da6088d638d36
Parents: 88c65b8
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Mar 24 13:28:30 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 24 13:28:30 2016 +0300
----------------------------------------------------------------------
.../managers/communication/GridIoManager.java | 11 +
.../managers/communication/GridIoPolicy.java | 3 +
.../processors/igfs/IgfsDataManager.java | 29 +-
.../processors/igfs/IgfsDeleteWorker.java | 2 +-
.../igfs/IgfsFragmentizerManager.java | 4 +-
...lockMessageSystemPoolStarvationSelfTest.java | 299 +++++++++++++++++++
.../ignite/testsuites/IgniteIgfsTestSuite.java | 3 +
7 files changed, 329 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/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 9ffbf4e..4577dc8 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
@@ -88,6 +88,7 @@ import static org.apache.ignite.events.EventType.EVT_NODE_JOINED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
import static org.apache.ignite.internal.GridTopic.TOPIC_COMM_USER;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.AFFINITY_POOL;
+import static org.apache.ignite.internal.managers.communication.GridIoPolicy.IGFS_POOL;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.MANAGEMENT_POOL;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.MARSH_CACHE_POOL;
import static org.apache.ignite.internal.managers.communication.GridIoPolicy.P2P_POOL;
@@ -150,6 +151,9 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
/** Marshaller cache pool. */
private ExecutorService marshCachePool;
+ /** IGFS pool. */
+ private ExecutorService igfsPool;
+
/** Discovery listener. */
private GridLocalEventListener discoLsnr;
@@ -252,6 +256,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
mgmtPool = ctx.getManagementExecutorService();
utilityCachePool = ctx.utilityCachePool();
marshCachePool = ctx.marshallerCachePool();
+ igfsPool = ctx.getIgfsExecutorService();
affPool = new IgniteThreadPoolExecutor(
"aff",
ctx.gridName(),
@@ -643,6 +648,7 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
case AFFINITY_POOL:
case UTILITY_CACHE_POOL:
case MARSH_CACHE_POOL:
+ case IGFS_POOL:
{
if (msg.isOrdered())
processOrderedMessage(nodeId, msg, plc, msgC);
@@ -703,6 +709,11 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
return marshCachePool;
+ case IGFS_POOL:
+ assert igfsPool != null : "IGFS pool is not configured.";
+
+ return igfsPool;
+
default: {
assert plc >= 0 : "Negative policy: " + plc;
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
index 57622c9..00590ba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoPolicy.java
@@ -43,6 +43,9 @@ public class GridIoPolicy {
/** Marshaller cache execution pool. */
public static final byte MARSH_CACHE_POOL = 6;
+ /** Marshaller cache execution pool. */
+ public static final byte IGFS_POOL = 7;
+
/**
* Defines the range of reserved pools that are not available for plugins.
* @param key The key.
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
index 3825086..16fbeb8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
@@ -91,7 +91,7 @@ import java.util.concurrent.locks.ReentrantLock;
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.GridTopic.TOPIC_IGFS;
-import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
+import static org.apache.ignite.internal.managers.communication.GridIoPolicy.IGFS_POOL;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
@@ -1014,26 +1014,18 @@ public class IgfsDataManager extends IgfsManager {
if (!node.isLocal()) {
final IgfsBlocksMessage msg = new IgfsBlocksMessage(fileId, batchId, blocks);
- callIgfsLocalSafe(new GridPlainCallable<Object>() {
- @Override @Nullable public Object call() throws Exception {
- try {
- igfsCtx.send(nodeId, topic, msg, SYSTEM_POOL);
- } catch (IgniteCheckedException e) {
- completionFut.onError(nodeId, e);
- }
-
- return null;
- }
- });
+ try {
+ igfsCtx.send(nodeId, topic, msg, IGFS_POOL);
+ }
+ catch (IgniteCheckedException e) {
+ completionFut.onError(nodeId, e);
+ }
}
else {
callIgfsLocalSafe(new GridPlainCallable<Object>() {
- @Override
- @Nullable
- public Object call() throws Exception {
+ @Override @Nullable public Object call() throws Exception {
storeBlocksAsync(blocks).listen(new CI1<IgniteInternalFuture<?>>() {
- @Override
- public void apply(IgniteInternalFuture<?> fut) {
+ @Override public void apply(IgniteInternalFuture<?> fut) {
try {
fut.get();
@@ -1276,8 +1268,7 @@ public class IgfsDataManager extends IgfsManager {
try {
// Send reply back to node.
- igfsCtx.send(nodeId, topic, new IgfsAckMessage(blocksMsg.fileId(), blocksMsg.id(), err),
- SYSTEM_POOL);
+ igfsCtx.send(nodeId, topic, new IgfsAckMessage(blocksMsg.fileId(), blocksMsg.id(), err), IGFS_POOL);
}
catch (IgniteCheckedException e) {
U.warn(log, "Failed to send batch acknowledgement (did node leave the grid?) [nodeId=" + nodeId +
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
index 7e4dac8..e5914e0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
@@ -357,7 +357,7 @@ public class IgfsDeleteWorker extends IgfsThread {
for (ClusterNode node : nodes) {
try {
- igfsCtx.send(node, topic, msg, GridIoPolicy.SYSTEM_POOL);
+ igfsCtx.send(node, topic, msg, GridIoPolicy.IGFS_POOL);
}
catch (IgniteCheckedException e) {
U.warn(log, "Failed to send IGFS delete message to node [nodeId=" + node.id() +
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
index 99e7cd6..d64c64a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerManager.java
@@ -59,7 +59,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
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.GridTopic.TOPIC_IGFS;
-import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
+import static org.apache.ignite.internal.managers.communication.GridIoPolicy.IGFS_POOL;
import static org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange.RANGE_STATUS_INITIAL;
import static org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange.RANGE_STATUS_MOVED;
import static org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange.RANGE_STATUS_MOVING;
@@ -186,7 +186,7 @@ public class IgfsFragmentizerManager extends IgfsManager {
private void sendWithRetries(UUID nodeId, IgfsCommunicationMessage msg) throws IgniteCheckedException {
for (int i = 0; i < MESSAGE_SEND_RETRY_COUNT; i++) {
try {
- igfsCtx.send(nodeId, topic, msg, SYSTEM_POOL);
+ igfsCtx.send(nodeId, topic, msg, IGFS_POOL);
return;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
new file mode 100644
index 0000000..ec3b808
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
@@ -0,0 +1,299 @@
+/*
+ * 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.igfs;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteFileSystem;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.FileSystemConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper;
+import org.apache.ignite.igfs.IgfsMode;
+import org.apache.ignite.igfs.IgfsOutputStream;
+import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
+import org.apache.ignite.internal.util.lang.GridAbsPredicateX;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ * Test to check for system pool starvation due to {@link IgfsBlocksMessage}.
+ */
+public class IgfsBlockMessageSystemPoolStarvationSelfTest extends IgfsCommonAbstractTest {
+ /** First node name. */
+ private static final String NODE_1_NAME = "node1";
+
+ /** Second node name. */
+ private static final String NODE_2_NAME = "node2";
+
+ /** Data cache name. */
+ private static final String DATA_CACHE_NAME = "data";
+
+ /** Meta cache name. */
+ private static final String META_CACHE_NAME = "meta";
+
+ /** Key in data caceh we will use to reproduce the issue. */
+ private static final Integer DATA_KEY = 1;
+
+ /** First node. */
+ private Ignite victim;
+
+ /** Second node. */
+ private Ignite attacker;
+
+ /** {@inheritDoc} */
+ @SuppressWarnings({"unchecked", "ConstantConditions"})
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ // Start nodes.
+ TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ victim = Ignition.start(config(NODE_1_NAME, ipFinder));
+ attacker = Ignition.start(config(NODE_2_NAME, ipFinder));
+
+ // Check if we selected victim correctly.
+ if (F.eq(dataCache(victim).affinity().mapKeyToNode(DATA_KEY).id(), attacker.cluster().localNode().id())) {
+ Ignite tmp = victim;
+
+ victim = attacker;
+
+ attacker = tmp;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ G.stopAll(true);
+
+ victim = null;
+ attacker = null;
+
+ super.afterTest();
+ }
+
+ /**
+ * Test starvation.
+ *
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings("unchecked")
+ public void testStarvation() throws Exception {
+ // 1. Create two IGFS file to make all system threads busy.
+ CountDownLatch fileWriteLatch = new CountDownLatch(1);
+
+ final IgniteInternalFuture fileFut1 = createFileAsync(new IgfsPath("/file1"), fileWriteLatch);
+ final IgniteInternalFuture fileFut2 = createFileAsync(new IgfsPath("/file2"), fileWriteLatch);
+
+ // 2. Start transaction and keep it opened.
+ final CountDownLatch txStartLatch = new CountDownLatch(1);
+ final CountDownLatch txCommitLatch = new CountDownLatch(1);
+
+ IgniteInternalFuture<Void> txFut = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ GridCacheAdapter dataCache = dataCache(attacker);
+
+ try (IgniteInternalTx tx =
+ dataCache.txStartEx(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) {
+ dataCache.put(DATA_KEY, 0);
+
+ txStartLatch.countDown();
+
+ txCommitLatch.await();
+
+ tx.commit();
+ }
+
+ return null;
+ }
+ });
+
+ txStartLatch.await();
+
+ // 3. Start async operation to drain semaphore permits.
+ final IgniteInternalFuture putFut = dataCache(victim).putAsync(DATA_KEY, 1);
+
+ assert !awaitFuture(putFut);
+
+ // 4. Write data to files and ensure we stuck.
+ fileWriteLatch.countDown();
+
+ assert !awaitFuture(fileFut1);
+ assert !awaitFuture(fileFut2);
+
+ // 5. Finish transaction.
+ txCommitLatch.countDown();
+
+ assert awaitFuture(txFut);
+
+ // 6. Async put must succeed.
+ assert awaitFuture(putFut);
+
+ // 7. Writes must succeed.
+ assert awaitFuture(fileFut1);
+ assert awaitFuture(fileFut2);
+ }
+
+ /**
+ * Await future completion.
+ *
+ * @param fut Future.
+ * @return {@code True} if future completed.
+ * @throws Exception If failed.
+ */
+ private static boolean awaitFuture(final IgniteInternalFuture fut) throws Exception {
+ return GridTestUtils.waitForCondition(new GridAbsPredicateX() {
+ @Override public boolean applyx() throws IgniteCheckedException {
+ return fut.isDone();
+ }
+ }, 1000);
+ }
+
+ /**
+ * Create IGFS file asynchronously.
+ *
+ * @param path Path.
+ * @return Future.
+ */
+ private IgniteInternalFuture<Void> createFileAsync(final IgfsPath path, final CountDownLatch writeStartLatch) {
+ return GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ IgniteFileSystem igfs = attacker.fileSystem(null);
+
+ try (IgfsOutputStream out = igfs.create(path, true)) {
+ writeStartLatch.await();
+
+ out.write(new byte[1024]);
+
+ out.flush();
+ }
+
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Get data cache for node.
+ *
+ * @param node Node.
+ * @return Data cache.
+ * @throws Exception If failed.
+ */
+ private GridCacheAdapter dataCache(Ignite node) throws Exception {
+ return ((IgniteKernal)node).internalCache(DATA_CACHE_NAME);
+ }
+
+ /**
+ * Create node configuration.
+ *
+ * @param name Node name.
+ * @return Configuration.
+ * @throws Exception If failed.
+ */
+ private IgniteConfiguration config(String name, TcpDiscoveryVmIpFinder ipFinder) throws Exception {
+ // Data cache configuration.
+ CacheConfiguration dataCcfg = new CacheConfiguration();
+
+ dataCcfg.setName(DATA_CACHE_NAME);
+ dataCcfg.setCacheMode(CacheMode.REPLICATED);
+ dataCcfg.setAtomicityMode(TRANSACTIONAL);
+ dataCcfg.setWriteSynchronizationMode(FULL_SYNC);
+ dataCcfg.setAffinityMapper(new DummyAffinityMapper(1));
+ dataCcfg.setMaxConcurrentAsyncOperations(1);
+
+ // Meta cache configuration.
+ CacheConfiguration metaCcfg = new CacheConfiguration();
+
+ metaCcfg.setName(META_CACHE_NAME);
+ metaCcfg.setCacheMode(CacheMode.REPLICATED);
+ metaCcfg.setAtomicityMode(TRANSACTIONAL);
+ metaCcfg.setWriteSynchronizationMode(FULL_SYNC);
+
+ // File system configuration.
+ FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
+
+ igfsCfg.setDefaultMode(IgfsMode.PRIMARY);
+ igfsCfg.setDataCacheName(DATA_CACHE_NAME);
+ igfsCfg.setMetaCacheName(META_CACHE_NAME);
+ igfsCfg.setFragmentizerEnabled(false);
+ igfsCfg.setBlockSize(1024);
+
+ // Ignite configuration.
+ IgniteConfiguration cfg = getConfiguration(name);
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+ discoSpi.setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(discoSpi);
+ cfg.setCacheConfiguration(dataCcfg, metaCcfg);
+ cfg.setFileSystemConfiguration(igfsCfg);
+
+ cfg.setLocalHost("127.0.0.1");
+ cfg.setConnectorConfiguration(null);
+
+ cfg.setSystemThreadPoolSize(2);
+ cfg.setRebalanceThreadPoolSize(1);
+ cfg.setPublicThreadPoolSize(1);
+
+ return cfg;
+ }
+
+ /**
+ * Dimmy affinity mapper.
+ */
+ private static class DummyAffinityMapper extends IgfsGroupDataBlocksKeyMapper {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Dummy affinity key. */
+ private static final Integer KEY = 1;
+
+ /**
+ * Constructor.
+ *
+ * @param grpSize Group size.
+ */
+ public DummyAffinityMapper(int grpSize) {
+ super(grpSize);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object affinityKey(Object key) {
+ return KEY;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bc14c802/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
index aff3ad7..25c54e4 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsAttributesSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsBackupsDualAsyncSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsBackupsDualSyncSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsBackupsPrimarySelfTest;
+import org.apache.ignite.internal.processors.igfs.IgfsBlockMessageSystemPoolStarvationSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsCachePerBlockLruEvictionPolicySelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsCacheSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsClientCacheSelfTest;
@@ -118,6 +119,8 @@ public class IgniteIgfsTestSuite extends TestSuite {
suite.addTestSuite(IgfsBackupsDualSyncSelfTest.class);
suite.addTestSuite(IgfsBackupsDualAsyncSelfTest.class);
+ suite.addTestSuite(IgfsBlockMessageSystemPoolStarvationSelfTest.class);
+
// TODO: Enable when IGFS failover is fixed.
//suite.addTestSuite(IgfsBackupFailoverSelfTest.class);
[18/25] ignite git commit: Added remove() method for Iterator in Java
7.
Posted by dm...@apache.org.
Added remove() method for Iterator in Java 7.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3bf5f46b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3bf5f46b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3bf5f46b
Branch: refs/heads/ignite-2849
Commit: 3bf5f46b19d7f142bb04917d812e7336e86c085a
Parents: 2f64ab0
Author: shtykh_roman <rs...@yahoo.com>
Authored: Thu Mar 24 14:44:04 2016 +0900
Committer: shtykh_roman <rs...@yahoo.com>
Committed: Thu Mar 24 14:44:04 2016 +0900
----------------------------------------------------------------------
.../examples/datagrid/store/CacheLoadOnlyStoreExample.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3bf5f46b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
index 4635c16..ac3d27b 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
@@ -153,6 +153,11 @@ public class CacheLoadOnlyStoreExample {
return scanner.next();
}
+
+ /** {@inheritDoc} */
+ @Override public void remove() {
+ throw new UnsupportedOperationException();
+ }
};
}
[23/25] ignite git commit: IGNITE-2883: IGFS: Now IPC messages are
handled in a dedicated thread pool.
Posted by dm...@apache.org.
IGNITE-2883: IGFS: Now IPC messages are handled in a dedicated thread pool.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cfc7d4ee
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cfc7d4ee
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cfc7d4ee
Branch: refs/heads/ignite-2849
Commit: cfc7d4eec255d0fe720398882d0c058f6821611a
Parents: bc14c80
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Mar 24 14:29:35 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 24 14:29:35 2016 +0300
----------------------------------------------------------------------
.../igfs/IgfsIpcEndpointConfiguration.java | 28 +++++++
.../processors/igfs/IgfsIpcHandler.java | 81 +++++++++++++++-----
.../internal/processors/igfs/IgfsProcessor.java | 11 ++-
.../internal/processors/igfs/IgfsServer.java | 2 +-
.../igfs/IgfsProcessorValidationSelfTest.java | 16 ++++
5 files changed, 117 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc7d4ee/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
index 23993a6..1c68d0f 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsIpcEndpointConfiguration.java
@@ -49,6 +49,9 @@ public class IgfsIpcEndpointConfiguration {
*/
public static final String DFLT_TOKEN_DIR_PATH = "ipc/shmem";
+ /** Default threads count. */
+ public static final int DFLT_THREAD_CNT = IgniteConfiguration.AVAILABLE_PROC_CNT;
+
/** Endpoint type. */
private IgfsIpcEndpointType type = DFLT_TYPE;
@@ -64,6 +67,9 @@ public class IgfsIpcEndpointConfiguration {
/** Token directory path. */
private String tokenDirPath = DFLT_TOKEN_DIR_PATH;
+ /** Thread count. */
+ private int threadCnt = DFLT_THREAD_CNT;
+
/**
* Default constructor.
*/
@@ -236,6 +242,28 @@ public class IgfsIpcEndpointConfiguration {
this.tokenDirPath = tokenDirPath;
}
+ /**
+ * Get number of threads used by this endpoint to process incoming requests.
+ * <p>
+ * Defaults to {@link #DFLT_THREAD_CNT}.
+ *
+ * @return Number of threads used by this endpoint to process incoming requests.
+ */
+ public int getThreadCount() {
+ return threadCnt;
+ }
+
+ /**
+ * Set number of threads used by this endpoint to process incoming requests.
+ * <p>
+ * See {@link #getThreadCount()} for more information.
+ *
+ * @param threadCnt Number of threads used by this endpoint to process incoming requests.
+ */
+ public void setThreadCount(int threadCnt) {
+ this.threadCnt = threadCnt;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(IgfsIpcEndpointConfiguration.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc7d4ee/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsIpcHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsIpcHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsIpcHandler.java
index eadbdb2..bf87384 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsIpcHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsIpcHandler.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.igfs;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.igfs.IgfsIpcEndpointConfiguration;
import org.apache.ignite.igfs.IgfsOutOfSpaceException;
import org.apache.ignite.igfs.IgfsOutputStream;
import org.apache.ignite.igfs.IgfsUserContext;
@@ -31,20 +32,22 @@ import org.apache.ignite.internal.igfs.common.IgfsIpcCommand;
import org.apache.ignite.internal.igfs.common.IgfsMessage;
import org.apache.ignite.internal.igfs.common.IgfsPathControlRequest;
import org.apache.ignite.internal.igfs.common.IgfsStreamControlRequest;
-import org.apache.ignite.internal.processors.closure.GridClosurePolicy;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
-import org.apache.ignite.internal.util.lang.GridPlainCallable;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteOutClosure;
import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.thread.IgniteThreadPoolExecutor;
import org.jetbrains.annotations.Nullable;
import java.io.Closeable;
import java.io.DataInput;
import java.io.IOException;
import java.util.Iterator;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.atomic.AtomicLong;
/**
@@ -70,6 +73,9 @@ class IgfsIpcHandler implements IgfsServerHandler {
/** Resource ID generator. */
private final AtomicLong rsrcIdGen = new AtomicLong();
+ /** Thread pool. */
+ private volatile IgniteThreadPoolExecutor pool;
+
/** Stopping flag. */
private volatile boolean stopping;
@@ -77,8 +83,10 @@ class IgfsIpcHandler implements IgfsServerHandler {
* Constructs IGFS IPC handler.
*
* @param igfsCtx Context.
+ * @param endpointCfg Endpoint configuration.
+ * @param mgmt Management flag.
*/
- IgfsIpcHandler(IgfsContext igfsCtx) {
+ IgfsIpcHandler(IgfsContext igfsCtx, IgfsIpcEndpointConfiguration endpointCfg, boolean mgmt) {
assert igfsCtx != null;
ctx = igfsCtx.kernalContext();
@@ -87,12 +95,24 @@ class IgfsIpcHandler implements IgfsServerHandler {
// Keep buffer size multiple of block size so no extra byte array copies is performed.
bufSize = igfsCtx.configuration().getBlockSize() * 2;
+ // Create thread pool for request handling.
+ int threadCnt = endpointCfg.getThreadCount();
+
+ String prefix = "igfs-" + igfsCtx.igfs().name() + (mgmt ? "mgmt-" : "") + "-ipc";
+
+ pool = new IgniteThreadPoolExecutor(prefix, igfsCtx.kernalContext().gridName(), threadCnt, threadCnt,
+ Long.MAX_VALUE, new LinkedBlockingQueue<Runnable>());
+
log = ctx.log(IgfsIpcHandler.class);
}
/** {@inheritDoc} */
@Override public void stop() throws IgniteCheckedException {
stopping = true;
+
+ U.shutdownNow(getClass(), pool, log);
+
+ pool = null;
}
/** {@inheritDoc} */
@@ -114,7 +134,7 @@ class IgfsIpcHandler implements IgfsServerHandler {
/** {@inheritDoc} */
@Override public IgniteInternalFuture<IgfsMessage> handleAsync(final IgfsClientSession ses,
- final IgfsMessage msg, DataInput in) {
+ final IgfsMessage msg, final DataInput in) {
try {
// Even if will be closed right after this call, response write error will be ignored.
if (stopping)
@@ -130,21 +150,32 @@ class IgfsIpcHandler implements IgfsServerHandler {
case MAKE_DIRECTORIES:
case LIST_FILES:
case LIST_PATHS: {
- IgfsMessage res = execute(ses, cmd, msg, in);
-
- fut = res == null ? null : new GridFinishedFuture<>(res);
+ fut = executeSynchronously(ses, cmd, msg, in);
break;
}
- // Execute command asynchronously in user's pool.
+ // Execute command asynchronously in pool.
default: {
- fut = ctx.closure().callLocalSafe(new GridPlainCallable<IgfsMessage>() {
- @Override public IgfsMessage call() throws Exception {
- // No need to pass data input for non-write-block commands.
- return execute(ses, cmd, msg, null);
- }
- }, GridClosurePolicy.IGFS_POOL);
+ try {
+ final GridFutureAdapter<IgfsMessage> fut0 = new GridFutureAdapter<>();
+
+ pool.execute(new Runnable() {
+ @Override public void run() {
+ try {
+ fut0.onDone(execute(ses, cmd, msg, in));
+ }
+ catch (Exception e) {
+ fut0.onDone(e);
+ }
+ }
+ });
+
+ fut = fut0;
+ }
+ catch (RejectedExecutionException ignored) {
+ fut = executeSynchronously(ses, cmd, msg, in);
+ }
}
}
@@ -157,6 +188,23 @@ class IgfsIpcHandler implements IgfsServerHandler {
}
/**
+ * Execute operation synchronously.
+ *
+ * @param ses Session.
+ * @param cmd Command.
+ * @param msg Message.
+ * @param in Input.
+ * @return Result.
+ * @throws Exception If failed.
+ */
+ @Nullable private IgniteInternalFuture<IgfsMessage> executeSynchronously(IgfsClientSession ses,
+ IgfsIpcCommand cmd, IgfsMessage msg, DataInput in) throws Exception {
+ IgfsMessage res = execute(ses, cmd, msg, in);
+
+ return res == null ? null : new GridFinishedFuture<>(res);
+ }
+
+ /**
* Execute IGFS command.
*
* @param ses Client connection session.
@@ -167,8 +215,7 @@ class IgfsIpcHandler implements IgfsServerHandler {
* @throws Exception If failed.
*/
private IgfsMessage execute(IgfsClientSession ses, IgfsIpcCommand cmd, IgfsMessage msg,
- @Nullable DataInput in)
- throws Exception {
+ @Nullable DataInput in) throws Exception {
switch (cmd) {
case HANDSHAKE:
return processHandshakeRequest((IgfsHandshakeRequest)msg);
@@ -495,8 +542,6 @@ class IgfsIpcHandler implements IgfsServerHandler {
}
case WRITE_BLOCK: {
- assert rsrcId != null : "Missing stream ID";
-
IgfsOutputStream out = (IgfsOutputStream)resource(ses, rsrcId);
if (out == null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc7d4ee/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
index 44f6e44..778de99 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
@@ -26,6 +26,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper;
+import org.apache.ignite.igfs.IgfsIpcEndpointConfiguration;
import org.apache.ignite.igfs.IgfsMode;
import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.igfs.mapreduce.IgfsJob;
@@ -316,12 +317,18 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
throw new IgniteCheckedException("Invalid IGFS data cache configuration (key affinity mapper class should be " +
IgfsGroupDataBlocksKeyMapper.class.getSimpleName() + "): " + cfg);
- if (cfg.getIpcEndpointConfiguration() != null) {
- final int tcpPort = cfg.getIpcEndpointConfiguration().getPort();
+ IgfsIpcEndpointConfiguration ipcCfg = cfg.getIpcEndpointConfiguration();
+
+ if (ipcCfg != null) {
+ final int tcpPort = ipcCfg.getPort();
if (!(tcpPort >= MIN_TCP_PORT && tcpPort <= MAX_TCP_PORT))
throw new IgniteCheckedException("IGFS endpoint TCP port is out of range [" + MIN_TCP_PORT +
".." + MAX_TCP_PORT + "]: " + tcpPort);
+
+ if (ipcCfg.getThreadCount() <= 0)
+ throw new IgniteCheckedException("IGFS endpoint thread count must be positive: " +
+ ipcCfg.getThreadCount());
}
long maxSpaceSize = cfg.getMaxSpaceSize();
http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc7d4ee/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServer.java
index 314baac..aa4b115 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsServer.java
@@ -139,7 +139,7 @@ public class IgfsServer {
if (srvEndpoint.getPort() >= 0)
igfsCtx.kernalContext().ports().registerPort(srvEndpoint.getPort(), TCP, srvEndpoint.getClass());
- hnd = new IgfsIpcHandler(igfsCtx);
+ hnd = new IgfsIpcHandler(igfsCtx, endpointCfg, mgmt);
// Start client accept worker.
acceptWorker = new AcceptWorker();
http://git-wip-us.apache.org/repos/asf/ignite/blob/cfc7d4ee/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
index 27f47e8..0ce1036 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorValidationSelfTest.java
@@ -469,6 +469,22 @@ public class IgfsProcessorValidationSelfTest extends IgfsCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testInvalidEndpointThreadCount() throws Exception {
+ final String failMsg = "IGFS endpoint thread count must be positive";
+ g1Cfg.setCacheConfiguration(concat(dataCaches(1024), metaCaches(), CacheConfiguration.class));
+
+ final String igfsCfgName = "igfs-cfg";
+ final IgfsIpcEndpointConfiguration igfsEndpointCfg = new IgfsIpcEndpointConfiguration();
+ igfsEndpointCfg.setThreadCount(0);
+ g1IgfsCfg1.setName(igfsCfgName);
+ g1IgfsCfg1.setIpcEndpointConfiguration(igfsEndpointCfg);
+
+ checkGridStartFails(g1Cfg, failMsg, true);
+ }
+
+ /**
* Checks that the given grid configuration will lead to {@link IgniteCheckedException} upon grid startup.
*
* @param cfg Grid configuration to check.
[16/25] ignite git commit: Fixed tests.
Posted by dm...@apache.org.
Fixed tests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/66f9a34b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/66f9a34b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/66f9a34b
Branch: refs/heads/ignite-2849
Commit: 66f9a34bfc13eb54822581aefcd2c687c5bc9245
Parents: b189bb2
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Wed Mar 23 19:45:51 2016 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Wed Mar 23 19:46:16 2016 +0300
----------------------------------------------------------------------
.../continuous/CacheContinuousQueryManager.java | 13 +++++++++----
.../continuous/GridContinuousProcessor.java | 2 +-
.../processors/cache/IgniteCacheAbstractTest.java | 6 ++++++
.../cache/IgniteCacheEntryListenerAbstractTest.java | 16 +++++++++++++++-
.../distributed/IgniteCacheManyClientsTest.java | 6 ++++++
...acheContinuousQueryFailoverAbstractSelfTest.java | 6 ++++++
6 files changed, 43 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index 869a51b..c01f636 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -489,7 +489,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
false,
false,
loc,
- keepBinary);
+ keepBinary,
+ false);
}
/**
@@ -528,6 +529,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
true,
notifyExisting,
loc,
+ false,
false);
}
@@ -608,6 +610,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
* @param internal Internal flag.
* @param notifyExisting Notify existing flag.
* @param loc Local flag.
+ * @param onStart Waiting topology exchange.
* @return Continuous routine ID.
* @throws IgniteCheckedException In case of error.
*/
@@ -619,7 +622,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
boolean internal,
boolean notifyExisting,
boolean loc,
- final boolean keepBinary) throws IgniteCheckedException
+ final boolean keepBinary,
+ boolean onStart) throws IgniteCheckedException
{
cctx.checkSecurity(SecurityPermission.CACHE_READ);
@@ -650,7 +654,7 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
pred).get();
try {
- if (hnd.isQuery() && cctx.userCache())
+ if (hnd.isQuery() && cctx.userCache() && !onStart)
hnd.waitTopologyFuture(cctx.kernalContext());
}
catch (IgniteCheckedException e) {
@@ -905,7 +909,8 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
false,
false,
false,
- keepBinary
+ keepBinary,
+ onStart
);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index f2d6e1e..99e0bb5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -915,7 +915,7 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
if (proc != null) {
GridCacheAdapter cache = ctx.cache().internalCache(hnd0.cacheName());
- if (cache != null && !cache.isLocal())
+ if (cache != null && !cache.isLocal() && cache.context().userCache())
req.addUpdateCounters(ctx.localNodeId(), cache.context().topology().updateCounters());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
index 7df72f0..ce60232 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
@@ -37,6 +37,7 @@ 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.spi.eventstorage.memory.MemoryEventStorageSpi;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jsr166.ConcurrentHashMap8;
@@ -100,6 +101,11 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
if (isDebug())
disco.setAckTimeout(Integer.MAX_VALUE);
+ MemoryEventStorageSpi eventSpi = new MemoryEventStorageSpi();
+ eventSpi.setExpireCount(100);
+
+ cfg.setEventStorageSpi(eventSpi);
+
cfg.setDiscoverySpi(disco);
cfg.setCacheConfiguration(cacheConfiguration(gridName));
http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
index 35fbbd5..1f58765 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
@@ -60,11 +60,13 @@ import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
import org.apache.ignite.cache.CacheMemoryMode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.continuous.GridContinuousProcessor;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.jetbrains.annotations.Nullable;
@@ -118,6 +120,18 @@ public abstract class IgniteCacheEntryListenerAbstractTest extends IgniteCacheAb
return cfg;
}
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ MemoryEventStorageSpi eventSpi = new MemoryEventStorageSpi();
+ eventSpi.setExpireCount(50);
+
+ cfg.setEventStorageSpi(eventSpi);
+
+ return cfg;
+ }
+
/**
* @return Cache memory mode.
*/
@@ -421,7 +435,7 @@ public abstract class IgniteCacheEntryListenerAbstractTest extends IgniteCacheAb
barrier.await();
- for (int i = 0; i < 200; i++) {
+ for (int i = 0; i < 100; i++) {
cache.registerCacheEntryListener(cfg);
cache.deregisterCacheEntryListener(cfg);
http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
index 8d4af19..ddc75ba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
@@ -38,6 +38,7 @@ 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.spi.eventstorage.memory.MemoryEventStorageSpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
@@ -71,6 +72,11 @@ public class IgniteCacheManyClientsTest extends GridCommonAbstractTest {
cfg.setPeerClassLoadingEnabled(false);
cfg.setTimeServerPortRange(200);
+ MemoryEventStorageSpi eventSpi = new MemoryEventStorageSpi();
+ eventSpi.setExpireCount(100);
+
+ cfg.setEventStorageSpi(eventSpi);
+
((TcpCommunicationSpi)cfg.getCommunicationSpi()).setLocalPortRange(200);
((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/66f9a34b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
index f104f21..4454379 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
@@ -90,6 +90,7 @@ 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.spi.eventstorage.memory.MemoryEventStorageSpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
@@ -136,6 +137,11 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
cfg.setCommunicationSpi(commSpi);
+ MemoryEventStorageSpi eventSpi = new MemoryEventStorageSpi();
+ eventSpi.setExpireCount(50);
+
+ cfg.setEventStorageSpi(eventSpi);
+
CacheConfiguration ccfg = new CacheConfiguration();
ccfg.setCacheMode(cacheMode());
[04/25] ignite git commit: IGNITE-2869: IGFS: Slightly improved
serialization of IgfsListingEntry.
Posted by dm...@apache.org.
IGNITE-2869: IGFS: Slightly improved serialization of IgfsListingEntry.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/574f2cd2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/574f2cd2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/574f2cd2
Branch: refs/heads/ignite-2849
Commit: 574f2cd20243fef2c62fc5506d31c14c84d00885
Parents: 49725e9
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Mar 22 09:20:32 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Mar 22 09:20:32 2016 +0300
----------------------------------------------------------------------
.../processors/igfs/IgfsDirectoryInfo.java | 30 +++++++++++++++-
.../internal/processors/igfs/IgfsUtils.java | 38 ++++++++++++++++++++
.../meta/IgfsMetaDirectoryCreateProcessor.java | 4 +--
.../IgfsMetaDirectoryListingAddProcessor.java | 7 ++--
4 files changed, 74 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/574f2cd2/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
index 233c8ee..a426e8c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
@@ -23,7 +23,6 @@ import org.apache.ignite.binary.BinaryRawWriter;
import org.apache.ignite.binary.BinaryReader;
import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.internal.binary.BinaryUtils;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -35,6 +34,7 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
/**
@@ -198,6 +198,20 @@ public class IgfsDirectoryInfo extends IgfsEntryInfo implements Binarylizable {
writeBinary(out);
+ if (listing != null) {
+ out.writeBoolean(true);
+
+ out.writeInt(listing.size());
+
+ for (Map.Entry<String, IgfsListingEntry> entry : listing.entrySet()) {
+ out.writeString(entry.getKey());
+
+ IgfsUtils.writeListingEntry(out, entry.getValue());
+ }
+ }
+ else
+ out.writeBoolean(false);
+
out.writeMap(listing);
}
@@ -207,6 +221,20 @@ public class IgfsDirectoryInfo extends IgfsEntryInfo implements Binarylizable {
readBinary(in);
+ if (in.readBoolean()) {
+ int listingSize = in.readInt();
+
+ listing = new HashMap<>(listingSize);
+
+ for (int i = 0; i < listingSize; i++) {
+ String key = in.readString();
+
+ IgfsListingEntry val = IgfsUtils.readListingEntry(in);
+
+ listing.put(key, val);
+ }
+ }
+
listing = in.readMap();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/574f2cd2/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index 325f636..7063f68 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -20,6 +20,8 @@ package org.apache.ignite.internal.processors.igfs;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.binary.BinaryRawWriter;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.cluster.ClusterTopologyException;
@@ -30,6 +32,7 @@ import org.apache.ignite.events.IgfsEvent;
import org.apache.ignite.igfs.IgfsException;
import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.binary.BinaryUtils;
import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
@@ -389,4 +392,39 @@ public class IgfsUtils {
return new IgfsFileInfo(id, blockSize, len, affKey, props, null, lockId, accessTime, modificationTime,
evictExclude);
}
+
+ /**
+ * Write listing entry.
+ *
+ * @param out Writer.
+ * @param entry Entry.
+ */
+ public static void writeListingEntry(BinaryRawWriter out, @Nullable IgfsListingEntry entry) {
+ if (entry != null) {
+ out.writeBoolean(true);
+
+ BinaryUtils.writeIgniteUuid(out, entry.fileId());
+
+ out.writeBoolean(entry.isDirectory());
+ }
+ else
+ out.writeBoolean(false);
+ }
+
+ /**
+ * Read listing entry.
+ *
+ * @param in Reader.
+ * @return Entry.
+ */
+ @Nullable public static IgfsListingEntry readListingEntry(BinaryRawReader in) {
+ if (in.readBoolean()) {
+ IgniteUuid id = BinaryUtils.readIgniteUuid(in);
+ boolean dir = in.readBoolean();
+
+ return new IgfsListingEntry(id, dir);
+ }
+ else
+ return null;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/574f2cd2/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
index dcca298..907019c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
@@ -148,7 +148,7 @@ public class IgfsMetaDirectoryCreateProcessor implements EntryProcessor<IgniteUu
out.writeString(childName);
if (childName != null)
- out.writeObject(childEntry);
+ IgfsUtils.writeListingEntry(out, childEntry);
}
/** {@inheritDoc} */
@@ -160,7 +160,7 @@ public class IgfsMetaDirectoryCreateProcessor implements EntryProcessor<IgniteUu
childName = in.readString();
if (childName != null)
- childEntry = in.readObject();
+ childEntry = IgfsUtils.readListingEntry(in);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/574f2cd2/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
index f27bdd5..e9fa867 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
@@ -26,6 +26,7 @@ import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.internal.processors.igfs.IgfsEntryInfo;
import org.apache.ignite.internal.processors.igfs.IgfsListingEntry;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
@@ -113,7 +114,8 @@ public final class IgfsMetaDirectoryListingAddProcessor implements EntryProcesso
BinaryRawWriter out = writer.rawWriter();
out.writeString(fileName);
- out.writeObject(entry);
+
+ IgfsUtils.writeListingEntry(out, entry);
}
/** {@inheritDoc} */
@@ -121,7 +123,8 @@ public final class IgfsMetaDirectoryListingAddProcessor implements EntryProcesso
BinaryRawReader in = reader.rawReader();
fileName = in.readString();
- entry = in.readObject();
+
+ entry = IgfsUtils.readListingEntry(in);
}
/** {@inheritDoc} */
[24/25] ignite git commit: Merge remote-tracking branch
'remotes/apache-main/master' into ignite-2849
Posted by dm...@apache.org.
Merge remote-tracking branch 'remotes/apache-main/master' into ignite-2849
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ab9387cb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ab9387cb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ab9387cb
Branch: refs/heads/ignite-2849
Commit: ab9387cbc423d00566cb3b57e9a01b22bb7abd84
Parents: 031c915 cfc7d4e
Author: Denis Magda <dm...@gridgain.com>
Authored: Thu Mar 24 14:35:14 2016 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Thu Mar 24 14:35:14 2016 +0300
----------------------------------------------------------------------
.../store/CacheLoadOnlyStoreExample.java | 171 +++++++
examples/src/main/resources/person.csv | 20 +
.../ignite/examples/CacheExamplesSelfTest.java | 8 +
.../configuration/FileSystemConfiguration.java | 51 +-
.../igfs/IgfsIpcEndpointConfiguration.java | 28 ++
.../internal/GridEventConsumeHandler.java | 3 +-
.../internal/GridMessageListenHandler.java | 3 +-
.../ignite/internal/binary/BinaryContext.java | 4 +-
.../internal/direct/DirectMessageReader.java | 2 +-
.../internal/direct/DirectMessageWriter.java | 4 +-
.../direct/state/DirectMessageState.java | 7 +-
.../stream/v2/DirectByteBufferStreamImplV2.java | 2 +-
.../managers/communication/GridIoManager.java | 11 +
.../managers/communication/GridIoPolicy.java | 3 +
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 4 +-
.../continuous/CacheContinuousQueryHandler.java | 88 +++-
.../continuous/CacheContinuousQueryManager.java | 23 +-
.../continuous/GridContinuousHandler.java | 4 +-
.../continuous/GridContinuousProcessor.java | 27 +-
.../StartRoutineAckDiscoveryMessage.java | 22 +-
.../StartRoutineDiscoveryMessage.java | 22 +-
.../internal/processors/igfs/IgfsBlockKey.java | 30 +-
.../processors/igfs/IgfsDataManager.java | 29 +-
.../processors/igfs/IgfsDeleteWorker.java | 10 +-
.../processors/igfs/IgfsDirectoryInfo.java | 59 ++-
.../internal/processors/igfs/IgfsEntryInfo.java | 45 +-
.../ignite/internal/processors/igfs/IgfsEx.java | 12 -
.../igfs/IgfsFragmentizerManager.java | 4 +-
.../internal/processors/igfs/IgfsImpl.java | 47 +-
.../processors/igfs/IgfsInputStreamImpl.java | 2 +-
.../processors/igfs/IgfsIpcHandler.java | 81 +++-
.../processors/igfs/IgfsMetaManager.java | 111 ++---
.../processors/igfs/IgfsOutputStreamImpl.java | 21 +-
.../internal/processors/igfs/IgfsPathIds.java | 52 ++-
.../processors/igfs/IgfsPathsCreateResult.java | 15 +-
.../internal/processors/igfs/IgfsProcessor.java | 40 +-
.../IgfsSecondaryOutputStreamDescriptor.java | 17 +-
.../internal/processors/igfs/IgfsServer.java | 2 +-
.../internal/processors/igfs/IgfsUtils.java | 300 +++++++++++-
.../meta/IgfsMetaDirectoryCreateProcessor.java | 36 +-
.../IgfsMetaDirectoryListingAddProcessor.java | 13 +-
...gfsMetaDirectoryListingReplaceProcessor.java | 4 +-
.../igfs/meta/IgfsMetaFileCreateProcessor.java | 24 +-
.../igfs/meta/IgfsMetaUpdatePathProcessor.java | 102 ----
.../meta/IgfsMetaUpdatePropertiesProcessor.java | 10 +-
.../platform/cache/PlatformCache.java | 54 +++
.../platform/utils/PlatformFutureUtils.java | 2 +-
.../internal/util/nio/GridDirectParser.java | 4 +-
.../ignite/internal/util/nio/GridNioServer.java | 19 +-
.../communication/tcp/TcpCommunicationSpi.java | 16 +
.../ignite/igfs/IgfsEventsAbstractSelfTest.java | 32 +-
.../cache/IgniteCacheAbstractTest.java | 6 +
.../IgniteCacheEntryListenerAbstractTest.java | 16 +-
.../distributed/IgniteCacheCreatePutTest.java | 137 +++++-
.../distributed/IgniteCacheManyClientsTest.java | 6 +
...ContinuousQueryFailoverAbstractSelfTest.java | 6 +
.../CacheContinuousQueryLostPartitionTest.java | 2 -
.../GridCacheContinuousQueryConcurrentTest.java | 466 +++++++++++++++++++
.../processors/igfs/IgfsAbstractSelfTest.java | 42 +-
...lockMessageSystemPoolStarvationSelfTest.java | 299 ++++++++++++
.../igfs/IgfsDualAbstractSelfTest.java | 13 +-
.../igfs/IgfsMetaManagerSelfTest.java | 8 +-
.../IgfsPrimaryOptimziedMarshallerSelfTest.java | 28 ++
.../igfs/IgfsPrimaryRelaxedSelfTest.java | 28 ++
.../processors/igfs/IgfsProcessorSelfTest.java | 17 +-
.../igfs/IgfsProcessorValidationSelfTest.java | 16 +
.../processors/igfs/IgfsStreamsSelfTest.java | 2 +-
.../ignite/testsuites/IgniteIgfsTestSuite.java | 7 +
.../fs/IgniteHadoopIgfsSecondaryFileSystem.java | 8 +-
.../hadoop/fs/v1/IgniteHadoopFileSystem.java | 19 +-
.../hadoop/fs/v2/IgniteHadoopFileSystem.java | 21 +-
.../hadoop/igfs/HadoopIgfsProperties.java | 11 +-
...oopFileSystemUniversalFileSystemAdapter.java | 8 +-
.../processors/hadoop/HadoopMapReduceTest.java | 5 +-
.../IgniteCacheQuerySelfTestSuite.java | 2 +
.../Binary/BinarySelfTest.cs | 113 +++++
.../Cache/CacheTestAsyncWrapper.cs | 12 +
.../Cache/Store/CacheStoreTest.cs | 31 ++
.../Cache/Store/CacheTestStore.cs | 2 +-
.../Apache.Ignite.Core.csproj | 1 +
.../dotnet/Apache.Ignite.Core/Cache/ICache.cs | 26 ++
.../Impl/Binary/BinaryHandleDictionary.cs | 32 +-
.../Impl/Binary/BinaryReader.cs | 61 ++-
.../Impl/Binary/BinaryReaderHandleDictionary.cs | 2 +-
.../Impl/Binary/BinarySystemHandlers.cs | 132 +++---
.../Impl/Binary/BinaryUtils.cs | 12 +
.../Impl/Binary/BinaryWriter.cs | 24 +-
.../Impl/Binary/ReferenceEqualityComparer.cs | 45 ++
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 17 +
.../Apache.Ignite.Core/Impl/Cache/CacheOp.cs | 3 +-
.../Impl/Common/DelegateConverter.cs | 4 +-
91 files changed, 2678 insertions(+), 712 deletions(-)
----------------------------------------------------------------------
[19/25] ignite git commit: IGNITE-2878: IGFS: Optimzied serialization
of IgfsListingEntry and properties map.
Posted by dm...@apache.org.
IGNITE-2878: IGFS: Optimzied serialization of IgfsListingEntry and properties map.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/29806af4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/29806af4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/29806af4
Branch: refs/heads/ignite-2849
Commit: 29806af4ec2a0a9ab6b19f9a08c1fd17ea7a0694
Parents: 2f64ab0
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Mar 24 10:35:43 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 24 10:35:43 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 2 +
.../internal/processors/igfs/IgfsBlockKey.java | 30 ++++-
.../processors/igfs/IgfsDirectoryInfo.java | 33 ++++-
.../internal/processors/igfs/IgfsEntryInfo.java | 8 +-
.../internal/processors/igfs/IgfsUtils.java | 127 +++++++++++++++++++
.../meta/IgfsMetaDirectoryCreateProcessor.java | 24 ++--
.../IgfsMetaDirectoryListingAddProcessor.java | 6 +-
...gfsMetaDirectoryListingReplaceProcessor.java | 4 +-
.../igfs/meta/IgfsMetaFileCreateProcessor.java | 16 ++-
.../meta/IgfsMetaUpdatePropertiesProcessor.java | 5 +-
.../processors/igfs/IgfsAbstractSelfTest.java | 11 ++
.../IgfsPrimaryOptimziedMarshallerSelfTest.java | 28 ++++
.../ignite/testsuites/IgniteIgfsTestSuite.java | 2 +
13 files changed, 261 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/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 b357345..4d8c293 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
@@ -65,6 +65,7 @@ import org.apache.ignite.internal.processors.cache.binary.BinaryMetadataKey;
import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
import org.apache.ignite.internal.processors.datastructures.CollocatedQueueItemKey;
import org.apache.ignite.internal.processors.datastructures.CollocatedSetItemKey;
+import org.apache.ignite.internal.processors.igfs.IgfsBlockKey;
import org.apache.ignite.internal.processors.igfs.IgfsDirectoryInfo;
import org.apache.ignite.internal.processors.igfs.IgfsFileAffinityRange;
import org.apache.ignite.internal.processors.igfs.IgfsFileInfo;
@@ -118,6 +119,7 @@ public class BinaryContext {
// IGFS classes.
sysClss.add(IgfsPath.class.getName());
+ sysClss.add(IgfsBlockKey.class.getName());
sysClss.add(IgfsDirectoryInfo.class.getName());
sysClss.add(IgfsFileAffinityRange.class.getName());
sysClss.add(IgfsFileInfo.class.getName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
index 06a2e1c..c366ae3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlockKey.java
@@ -22,6 +22,14 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.nio.ByteBuffer;
+
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.internal.binary.BinaryUtils;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -37,7 +45,7 @@ import org.jetbrains.annotations.Nullable;
* File's binary data block key.
*/
@GridInternal
-public final class IgfsBlockKey implements Message, Externalizable, Comparable<IgfsBlockKey> {
+public final class IgfsBlockKey implements Message, Externalizable, Binarylizable, Comparable<IgfsBlockKey> {
/** */
private static final long serialVersionUID = 0L;
@@ -150,6 +158,26 @@ public final class IgfsBlockKey implements Message, Externalizable, Comparable<I
}
/** {@inheritDoc} */
+ @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+ BinaryRawWriter out = writer.rawWriter();
+
+ BinaryUtils.writeIgniteUuid(out, fileId);
+ BinaryUtils.writeIgniteUuid(out, affKey);
+ out.writeBoolean(evictExclude);
+ out.writeLong(blockId);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+ BinaryRawReader in = reader.rawReader();
+
+ fileId = BinaryUtils.readIgniteUuid(in);
+ affKey = BinaryUtils.readIgniteUuid(in);
+ evictExclude = in.readBoolean();
+ blockId = in.readLong();
+ }
+
+ /** {@inheritDoc} */
@Override public int hashCode() {
return fileId.hashCode() + (int)(blockId ^ (blockId >>> 32));
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
index a426e8c..269098b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDirectoryInfo.java
@@ -26,6 +26,7 @@ import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
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.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
@@ -181,7 +182,19 @@ public class IgfsDirectoryInfo extends IgfsEntryInfo implements Binarylizable {
@Override public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out);
- out.writeObject(listing);
+ if (listing != null) {
+ out.writeBoolean(true);
+
+ out.writeInt(listing.size());
+
+ for (Map.Entry<String, IgfsListingEntry> entry : listing.entrySet()) {
+ U.writeString(out, entry.getKey());
+
+ IgfsUtils.writeListingEntry(out, entry.getValue());
+ }
+ }
+ else
+ out.writeBoolean(false);
}
/** {@inheritDoc} */
@@ -189,7 +202,19 @@ public class IgfsDirectoryInfo extends IgfsEntryInfo implements Binarylizable {
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
- listing = (Map<String, IgfsListingEntry>)in.readObject();
+ if (in.readBoolean()) {
+ int listingSize = in.readInt();
+
+ listing = new HashMap<>(listingSize);
+
+ for (int i = 0; i < listingSize; i++) {
+ String key = U.readString(in);
+
+ IgfsListingEntry val = IgfsUtils.readListingEntry(in);
+
+ listing.put(key, val);
+ }
+ }
}
/** {@inheritDoc} */
@@ -211,8 +236,6 @@ public class IgfsDirectoryInfo extends IgfsEntryInfo implements Binarylizable {
}
else
out.writeBoolean(false);
-
- out.writeMap(listing);
}
/** {@inheritDoc} */
@@ -234,8 +257,6 @@ public class IgfsDirectoryInfo extends IgfsEntryInfo implements Binarylizable {
listing.put(key, val);
}
}
-
- listing = in.readMap();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
index 9ff65da..4df8b34 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
@@ -267,7 +267,9 @@ public abstract class IgfsEntryInfo implements Externalizable {
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
U.writeGridUuid(out, id);
- U.writeStringMap(out, props);
+
+ IgfsUtils.writeProperties(out, props);
+
out.writeLong(accessTime);
out.writeLong(modificationTime);
}
@@ -275,7 +277,9 @@ public abstract class IgfsEntryInfo implements Externalizable {
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
id = U.readGridUuid(in);
- props = U.readStringMap(in);
+
+ props = IgfsUtils.readProperties(in);
+
accessTime = in.readLong();
modificationTime = in.readLong();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index c6b7ad3..1b97565 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -36,6 +36,7 @@ import org.apache.ignite.internal.binary.BinaryUtils;
import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.lang.IgniteOutClosureX;
import org.apache.ignite.internal.util.typedef.F;
@@ -45,6 +46,9 @@ import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.transactions.Transaction;
import org.jetbrains.annotations.Nullable;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
@@ -471,6 +475,42 @@ public class IgfsUtils {
}
/**
+ * Write listing entry.
+ *
+ * @param out Writer.
+ * @param entry Entry.
+ * @throws IOException If failed.
+ */
+ public static void writeListingEntry(DataOutput out, @Nullable IgfsListingEntry entry) throws IOException {
+ if (entry != null) {
+ out.writeBoolean(true);
+
+ IgniteUtils.writeGridUuid(out, entry.fileId());
+
+ out.writeBoolean(entry.isDirectory());
+ }
+ else
+ out.writeBoolean(false);
+ }
+
+ /**
+ * Read listing entry.
+ *
+ * @param in Reader.
+ * @return Entry.
+ */
+ @Nullable public static IgfsListingEntry readListingEntry(DataInput in) throws IOException {
+ if (in.readBoolean()) {
+ IgniteUuid id = IgniteUtils.readGridUuid(in);
+ boolean dir = in.readBoolean();
+
+ return new IgfsListingEntry(id, dir);
+ }
+ else
+ return null;
+ }
+
+ /**
* Write entry properties. Rely on reference equality for well-known properties.
*
* @param out Writer.
@@ -554,4 +594,91 @@ public class IgfsUtils {
else
return null;
}
+
+ /**
+ * Write entry properties. Rely on reference equality for well-known properties.
+ *
+ * @param out Writer.
+ * @param props Properties.
+ * @throws IOException If failed.
+ */
+ @SuppressWarnings("StringEquality")
+ public static void writeProperties(DataOutput out, @Nullable Map<String, String> props) throws IOException {
+ if (props != null) {
+ out.writeInt(props.size());
+
+ for (Map.Entry<String, String> entry : props.entrySet()) {
+ String key = entry.getKey();
+
+ if (key == PROP_PERMISSION)
+ out.writeByte(PROP_PERMISSION_IDX);
+ else if (key == PROP_PREFER_LOCAL_WRITES)
+ out.writeByte(PROP_PREFER_LOCAL_WRITES_IDX);
+ else if (key == PROP_USER_NAME)
+ out.writeByte(PROP_USER_NAME_IDX);
+ else if (key == PROP_GROUP_NAME)
+ out.writeByte(PROP_GROUP_NAME_IDX);
+ else {
+ out.writeByte(PROP_IDX);
+ U.writeString(out, key);
+ }
+
+ U.writeString(out, entry.getValue());
+ }
+ }
+ else
+ out.writeInt(-1);
+ }
+
+ /**
+ * Read entry properties.
+ *
+ * @param in Reader.
+ * @return Properties.
+ * @throws IOException If failed.
+ */
+ @Nullable public static Map<String, String> readProperties(DataInput in) throws IOException {
+ int size = in.readInt();
+
+ if (size >= 0) {
+ Map<String, String> props = new HashMap<>(size);
+
+ for (int i = 0; i < size; i++) {
+ byte idx = in.readByte();
+
+ String key;
+
+ switch (idx) {
+ case PROP_PERMISSION_IDX:
+ key = PROP_PERMISSION;
+
+ break;
+
+ case PROP_PREFER_LOCAL_WRITES_IDX:
+ key = PROP_PREFER_LOCAL_WRITES;
+
+ break;
+
+ case PROP_USER_NAME_IDX:
+ key = PROP_USER_NAME;
+
+ break;
+
+ case PROP_GROUP_NAME_IDX:
+ key = PROP_GROUP_NAME;
+
+ break;
+
+ default:
+ key = U.readString(in);
+ }
+
+ props.put(key, U.readString(in));
+ }
+
+ return props;
+ }
+ else
+ return null;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
index 5f4fe73..eee9300 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
@@ -116,27 +116,25 @@ public class IgfsMetaDirectoryCreateProcessor implements EntryProcessor<IgniteUu
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeLong(createTime);
- U.writeStringMap(out, props);
- if (childName != null) {
- out.writeBoolean(true);
+ IgfsUtils.writeProperties(out, props);
+
+ U.writeString(out, childName);
- U.writeString(out, childName);
- out.writeObject(childEntry);
- }
- else
- out.writeBoolean(false);
+ if (childName != null)
+ IgfsUtils.writeListingEntry(out, childEntry);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
createTime = in.readLong();
- props = U.readStringMap(in);
- if (in.readBoolean()) {
- childName = U.readString(in);
- childEntry = (IgfsListingEntry)in.readObject();
- }
+ props = IgfsUtils.readProperties(in);
+
+ childName = U.readString(in);
+
+ if (childName != null)
+ childEntry = IgfsUtils.readListingEntry(in);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
index e9fa867..380d997 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingAddProcessor.java
@@ -100,13 +100,15 @@ public final class IgfsMetaDirectoryListingAddProcessor implements EntryProcesso
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
U.writeString(out, fileName);
- out.writeObject(entry);
+
+ IgfsUtils.writeListingEntry(out, entry);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
fileName = U.readString(in);
- entry = (IgfsListingEntry)in.readObject();
+
+ entry = IgfsUtils.readListingEntry(in);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingReplaceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingReplaceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingReplaceProcessor.java
index dfc9bfc..e230f05 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingReplaceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryListingReplaceProcessor.java
@@ -98,13 +98,13 @@ public final class IgfsMetaDirectoryListingReplaceProcessor implements EntryProc
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
U.writeString(out, name);
- out.writeObject(id);
+ U.writeGridUuid(out, id);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
name = U.readString(in);
- id = (IgniteUuid)in.readObject();
+ id = U.readGridUuid(in);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
index 9fd16aa..8c4c296 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
@@ -116,20 +116,24 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeLong(createTime);
- U.writeStringMap(out, props);
+
+ IgfsUtils.writeProperties(out, props);
+
out.writeInt(blockSize);
- out.writeObject(affKey);
- out.writeObject(lockId);
+ U.writeGridUuid(out, affKey);
+ U.writeGridUuid(out, lockId);
out.writeBoolean(evictExclude);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
createTime = in.readLong();
- props = U.readStringMap(in);
+
+ props = IgfsUtils.readProperties(in);
+
blockSize = in.readInt();
- affKey = (IgniteUuid)in.readObject();
- lockId = (IgniteUuid)in.readObject();
+ affKey = U.readGridUuid(in);
+ lockId = U.readGridUuid(in);
evictExclude = in.readBoolean();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
index e0d5b8b..af79332 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
@@ -27,7 +27,6 @@ import org.apache.ignite.internal.processors.igfs.IgfsEntryInfo;
import org.apache.ignite.internal.processors.igfs.IgfsUtils;
import org.apache.ignite.internal.util.GridLeanMap;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteUuid;
import javax.cache.processor.EntryProcessor;
@@ -93,12 +92,12 @@ public class IgfsMetaUpdatePropertiesProcessor implements EntryProcessor<IgniteU
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeStringMap(out, props);
+ IgfsUtils.writeProperties(out, props);
}
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- props = U.readStringMap(in);
+ props = IgfsUtils.readProperties(in);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index ec3878c..2f6c7bf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -53,6 +53,7 @@ import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.GridTestUtils;
@@ -232,6 +233,13 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
}
/**
+ * @return Use optimzied marshaller flag.
+ */
+ protected boolean useOptimizedMarshaller() {
+ return false;
+ }
+
+ /**
* Data chunk.
*
* @param len Length.
@@ -332,6 +340,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
IgniteConfiguration cfg = new IgniteConfiguration();
+ if (useOptimizedMarshaller())
+ cfg.setMarshaller(new OptimizedMarshaller());
+
cfg.setGridName(gridName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsPrimaryOptimziedMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsPrimaryOptimziedMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsPrimaryOptimziedMarshallerSelfTest.java
new file mode 100644
index 0000000..e4ad1f4
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsPrimaryOptimziedMarshallerSelfTest.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.processors.igfs;
+
+/**
+ * Tests for PRIMARY mode with optimized marshaller.
+ */
+public class IgfsPrimaryOptimziedMarshallerSelfTest extends IgfsPrimarySelfTest {
+ /** {@inheritDoc} */
+ @Override protected boolean useOptimizedMarshaller() {
+ return true;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/29806af4/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
index 038cb54..aff3ad7 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteIgfsTestSuite.java
@@ -40,6 +40,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsModesSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsOneClientNodeTest;
import org.apache.ignite.internal.processors.igfs.IgfsPrimaryOffheapTieredSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsPrimaryOffheapValuesSelfTest;
+import org.apache.ignite.internal.processors.igfs.IgfsPrimaryOptimziedMarshallerSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsPrimaryRelaxedSelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsPrimarySelfTest;
import org.apache.ignite.internal.processors.igfs.IgfsProcessorSelfTest;
@@ -69,6 +70,7 @@ public class IgniteIgfsTestSuite extends TestSuite {
suite.addTest(new TestSuite(IgfsPrimarySelfTest.class));
suite.addTest(new TestSuite(IgfsPrimaryRelaxedSelfTest.class));
+ suite.addTest(new TestSuite(IgfsPrimaryOptimziedMarshallerSelfTest.class));
suite.addTest(new TestSuite(IgfsPrimaryOffheapTieredSelfTest.class));
suite.addTest(new TestSuite(IgfsPrimaryOffheapValuesSelfTest.class));
suite.addTest(new TestSuite(IgfsDualSyncSelfTest.class));
[14/25] ignite git commit: IGNITE-2844: .NET: Added "LoadAll" methods
to cache API. This closes #562.
Posted by dm...@apache.org.
IGNITE-2844: .NET: Added "LoadAll" methods to cache API. This closes #562.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fc9730a9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fc9730a9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fc9730a9
Branch: refs/heads/ignite-2849
Commit: fc9730a9ae33b36ee8b6430583b39f13dfdd16de
Parents: 0013955
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Wed Mar 23 12:44:44 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Mar 23 12:44:44 2016 +0300
----------------------------------------------------------------------
.../platform/cache/PlatformCache.java | 54 ++++++++++++++++++++
.../platform/utils/PlatformFutureUtils.java | 2 +-
.../Cache/CacheTestAsyncWrapper.cs | 12 +++++
.../Cache/Store/CacheStoreTest.cs | 31 +++++++++++
.../Cache/Store/CacheTestStore.cs | 2 +-
.../dotnet/Apache.Ignite.Core/Cache/ICache.cs | 26 ++++++++++
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 17 ++++++
.../Apache.Ignite.Core/Impl/Cache/CacheOp.cs | 3 +-
8 files changed, 144 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fc9730a9/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index 37fd335..35ccd19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -44,16 +44,19 @@ import org.apache.ignite.internal.processors.platform.cache.query.PlatformFields
import org.apache.ignite.internal.processors.platform.cache.query.PlatformQueryCursor;
import org.apache.ignite.internal.processors.platform.utils.PlatformConfigurationUtils;
import org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils;
+import org.apache.ignite.internal.processors.platform.utils.PlatformListenable;
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.internal.util.GridConcurrentFactory;
import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.typedef.C1;
+import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteFuture;
import org.jetbrains.annotations.Nullable;
import javax.cache.Cache;
import javax.cache.expiry.Duration;
import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.integration.CompletionListener;
import javax.cache.processor.EntryProcessorException;
import javax.cache.processor.EntryProcessorResult;
import java.util.Iterator;
@@ -183,6 +186,9 @@ public class PlatformCache extends PlatformAbstractTarget {
/** */
public static final int OP_GET_CONFIG = 39;
+ /** */
+ public static final int OP_LOAD_ALL = 40;
+
/** Underlying JCache. */
private final IgniteCacheProxy cache;
@@ -369,6 +375,19 @@ public class PlatformCache extends PlatformAbstractTarget {
case OP_IS_LOCAL_LOCKED:
return cache.isLocalLocked(reader.readObjectDetached(), reader.readBoolean()) ? TRUE : FALSE;
+ case OP_LOAD_ALL: {
+ long futId = reader.readLong();
+ boolean replaceExisting = reader.readBoolean();
+
+ CompletionListenable fut = new CompletionListenable();
+
+ PlatformFutureUtils.listen(platformCtx, fut, futId, PlatformFutureUtils.TYP_OBJ, null, this);
+
+ cache.loadAll(PlatformUtils.readSet(reader), replaceExisting, fut);
+
+ return TRUE;
+ }
+
default:
return super.processInStreamOutLong(type, reader);
}
@@ -1101,4 +1120,39 @@ public class PlatformCache extends PlatformAbstractTarget {
}
}
}
+
+ /**
+ * Listenable around CompletionListener.
+ */
+ private static class CompletionListenable implements PlatformListenable, CompletionListener {
+ /** */
+ private IgniteBiInClosure<Object, Throwable> lsnr;
+
+ /** {@inheritDoc} */
+ @Override public void onCompletion() {
+ assert lsnr != null;
+
+ lsnr.apply(null, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onException(Exception e) {
+ lsnr.apply(null, e);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void listen(IgniteBiInClosure<Object, Throwable> lsnr) {
+ this.lsnr = lsnr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean cancel() throws IgniteCheckedException {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean isCancelled() {
+ return false;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/fc9730a9/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformFutureUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformFutureUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformFutureUtils.java
index 7a86201..8fad7d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformFutureUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformFutureUtils.java
@@ -182,7 +182,7 @@ public class PlatformFutureUtils {
* @param writer Optional writer.
*/
@SuppressWarnings("unchecked")
- private static void listen(final PlatformContext ctx, PlatformListenable listenable, final long futPtr, final
+ public static void listen(final PlatformContext ctx, PlatformListenable listenable, final long futPtr, final
int typ, @Nullable final Writer writer, final PlatformAbstractTarget target) {
final PlatformCallbackGateway gate = ctx.gateway();
http://git-wip-us.apache.org/repos/asf/ignite/blob/fc9730a9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
index 09e57dc..ff0c37c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
@@ -119,6 +119,18 @@ namespace Apache.Ignite.Core.Tests.Cache
}
/** <inheritDoc /> */
+ public void LoadAll(IEnumerable<TK> keys, bool replaceExistingValues)
+ {
+ _cache.LoadAll(keys, replaceExistingValues);
+ }
+
+ /** <inheritDoc /> */
+ public Task LoadAllAsync(IEnumerable<TK> keys, bool replaceExistingValues)
+ {
+ return _cache.LoadAllAsync(keys, replaceExistingValues);
+ }
+
+ /** <inheritDoc /> */
public bool ContainsKey(TK key)
{
return GetResult(_cache.ContainsKeyAsync(key));
http://git-wip-us.apache.org/repos/asf/ignite/blob/fc9730a9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
index cc46642..76ec384 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
using System;
using System.Collections;
using System.Collections.Generic;
+ using System.Linq;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Store;
@@ -474,6 +475,36 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
_storeCount++;
}
+ [Test]
+ public void TestLoadAll([Values(true, false)] bool isAsync)
+ {
+ var cache = GetCache();
+
+ var loadAll = isAsync
+ ? (Action<IEnumerable<int>, bool>) ((x, y) => { cache.LoadAllAsync(x, y).Wait(); })
+ : cache.LoadAll;
+
+ Assert.AreEqual(0, cache.GetSize());
+
+ loadAll(Enumerable.Range(105, 5), false);
+
+ Assert.AreEqual(5, cache.GetSize());
+
+ for (int i = 105; i < 110; i++)
+ Assert.AreEqual("val_" + i, cache[i]);
+
+ // Test overwrite
+ cache[105] = "42";
+
+ cache.LocalEvict(new[] { 105 });
+ loadAll(new[] {105}, false);
+ Assert.AreEqual("42", cache[105]);
+
+ loadAll(new[] {105, 106}, true);
+ Assert.AreEqual("val_105", cache[105]);
+ Assert.AreEqual("val_106", cache[106]);
+ }
+
/// <summary>
/// Get's grid name for this test.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/fc9730a9/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
index 9c381cb..b4b1670 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
@@ -100,7 +100,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
{
Debug.Assert(_grid != null);
- return keys.OfType<object>().ToDictionary(key => key, Load);
+ return keys.OfType<object>().ToDictionary(key => key, key => "val_" + key);
}
public void Write(object key, object val)
http://git-wip-us.apache.org/repos/asf/ignite/blob/fc9730a9/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICache.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICache.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICache.cs
index f5e7cd2..9d72cfa 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICache.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICache.cs
@@ -161,6 +161,32 @@ namespace Apache.Ignite.Core.Cache
Task LocalLoadCacheAsync(ICacheEntryFilter<TK, TV> p, params object[] args);
/// <summary>
+ /// Loads the specified entries into the cache using the configured
+ /// <see cref="ICacheStore"/>> for the given keys.
+ /// <para />
+ /// If an entry for a key already exists in the cache, a value will be loaded if and only if
+ /// <paramref name="replaceExistingValues" /> is true.
+ /// If no loader is configured for the cache, no objects will be loaded.
+ /// </summary>
+ /// <param name="keys">The keys to load.</param>
+ /// <param name="replaceExistingValues">if set to <c>true</c>, existing cache values will
+ /// be replaced by those loaded from a cache store.</param>
+ void LoadAll(IEnumerable<TK> keys, bool replaceExistingValues);
+
+ /// <summary>
+ /// Asynchronously loads the specified entries into the cache using the configured
+ /// <see cref="ICacheStore"/>> for the given keys.
+ /// <para />
+ /// If an entry for a key already exists in the cache, a value will be loaded if and only if
+ /// <paramref name="replaceExistingValues" /> is true.
+ /// If no loader is configured for the cache, no objects will be loaded.
+ /// </summary>
+ /// <param name="keys">The keys to load.</param>
+ /// <param name="replaceExistingValues">if set to <c>true</c>, existing cache values will
+ /// be replaced by those loaded from a cache store.</param>
+ Task LoadAllAsync(IEnumerable<TK> keys, bool replaceExistingValues);
+
+ /// <summary>
/// Check if cache contains mapping for this key.
/// </summary>
/// <param name="key">Key.</param>
http://git-wip-us.apache.org/repos/asf/ignite/blob/fc9730a9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index 1296596..266012f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -288,6 +288,23 @@ namespace Apache.Ignite.Core.Impl.Cache
}
/** <inheritDoc /> */
+ public void LoadAll(IEnumerable<TK> keys, bool replaceExistingValues)
+ {
+ LoadAllAsync(keys, replaceExistingValues).Wait();
+ }
+
+ /** <inheritDoc /> */
+ public Task LoadAllAsync(IEnumerable<TK> keys, bool replaceExistingValues)
+ {
+ return GetFuture<object>((futId, futTyp) => DoOutOp((int) CacheOp.LoadAll, writer =>
+ {
+ writer.WriteLong(futId);
+ writer.WriteBoolean(replaceExistingValues);
+ WriteEnumerable(writer, keys);
+ })).Task;
+ }
+
+ /** <inheritDoc /> */
public bool ContainsKey(TK key)
{
IgniteArgumentCheck.NotNull(key, "key");
http://git-wip-us.apache.org/repos/asf/ignite/blob/fc9730a9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs
index 61ccb5f..4c42bf3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs
@@ -60,6 +60,7 @@ namespace Apache.Ignite.Core.Impl.Cache
RemoveObj = 36,
Replace2 = 37,
Replace3 = 38,
- GetConfig = 39
+ GetConfig = 39,
+ LoadAll = 40
}
}
\ No newline at end of file
[07/25] ignite git commit: IGNITE-2871: IGFS: Removed "path" from
IgfsEntryInfo. Purge event is never fired now,
it will be fixed as a part of IGNITE-1679.
Posted by dm...@apache.org.
IGNITE-2871: IGFS: Removed "path" from IgfsEntryInfo. Purge event is never fired now, it will be fixed as a part of IGNITE-1679.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c3b02dca
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c3b02dca
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c3b02dca
Branch: refs/heads/ignite-2849
Commit: c3b02dca7246e998edd878c199abba8232dd1add
Parents: 5f7a46e
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Mar 22 12:06:51 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Mar 22 12:06:51 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 2 -
.../processors/igfs/IgfsDeleteWorker.java | 8 +-
.../internal/processors/igfs/IgfsEntryInfo.java | 29 ------
.../internal/processors/igfs/IgfsImpl.java | 45 ++++----
.../processors/igfs/IgfsInputStreamImpl.java | 2 +-
.../processors/igfs/IgfsMetaManager.java | 73 ++++---------
.../processors/igfs/IgfsOutputStreamImpl.java | 19 +---
.../processors/igfs/IgfsPathsCreateResult.java | 15 +--
.../IgfsSecondaryOutputStreamDescriptor.java | 17 +---
.../internal/processors/igfs/IgfsUtils.java | 20 +++-
.../igfs/meta/IgfsMetaUpdatePathProcessor.java | 102 -------------------
.../ignite/igfs/IgfsEventsAbstractSelfTest.java | 32 +-----
.../igfs/IgfsMetaManagerSelfTest.java | 8 +-
13 files changed, 78 insertions(+), 294 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/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 c9ad1e9..b357345 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
@@ -80,7 +80,6 @@ import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileRangeDeletePr
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileRangeUpdateProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileReserveSpaceProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileUnlockProcessor;
-import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdatePathProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdatePropertiesProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor;
import org.apache.ignite.internal.util.IgniteUtils;
@@ -135,7 +134,6 @@ public class BinaryContext {
sysClss.add(IgfsMetaFileRangeUpdateProcessor.class.getName());
sysClss.add(IgfsMetaFileReserveSpaceProcessor.class.getName());
sysClss.add(IgfsMetaFileUnlockProcessor.class.getName());
- sysClss.add(IgfsMetaUpdatePathProcessor.class.getName());
sysClss.add(IgfsMetaUpdatePropertiesProcessor.class.getName());
sysClss.add(IgfsMetaUpdateTimesProcessor.class.getName());
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
index f6b26ab..7e4dac8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDeleteWorker.java
@@ -38,7 +38,6 @@ import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_PURGED;
import static org.apache.ignite.internal.GridTopic.TOPIC_IGFS;
/**
@@ -246,12 +245,7 @@ public class IgfsDeleteWorker extends IgfsThread {
// In case this node crashes, other node will re-delete the file.
data.delete(lockedInfo).get();
- boolean ret = meta.delete(trashId, name, id);
-
- if (info.path() != null)
- IgfsUtils.sendEvents(igfsCtx.kernalContext(), info.path(), EVT_IGFS_FILE_PURGED);
-
- return ret;
+ return meta.delete(trashId, name, id);
}
}
else
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
index 45cf828..9ff65da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.igfs;
import org.apache.ignite.binary.BinaryRawReader;
import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.internal.binary.BinaryUtils;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -52,9 +51,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
/** Last modification time. */
protected long modificationTime;
- /** Original file path. This is a helper field used only during real file delete. */
- protected IgfsPath path;
-
/**
* Default constructor.
*/
@@ -113,13 +109,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
}
/**
- * @return Original file path. This is a helper field used only in some operations like delete.
- */
- public IgfsPath path() {
- return path;
- }
-
- /**
* @return {@code True} if this is a file.
*/
public abstract boolean isFile();
@@ -155,20 +144,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
}
/**
- * Update path.
- *
- * @param path Path.
- * @return Updated file info.
- */
- public IgfsEntryInfo path(IgfsPath path) {
- IgfsEntryInfo res = copy();
-
- res.path = path;
-
- return res;
- }
-
- /**
* Update access and modification time.
*
* @param accessTime Access time.
@@ -295,7 +270,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
U.writeStringMap(out, props);
out.writeLong(accessTime);
out.writeLong(modificationTime);
- out.writeObject(path);
}
/** {@inheritDoc} */
@@ -304,7 +278,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
props = U.readStringMap(in);
accessTime = in.readLong();
modificationTime = in.readLong();
- path = (IgfsPath)in.readObject();
}
/**
@@ -319,7 +292,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
out.writeLong(accessTime);
out.writeLong(modificationTime);
- out.writeObject(path);
}
/**
@@ -334,7 +306,6 @@ public abstract class IgfsEntryInfo implements Externalizable {
accessTime = in.readLong();
modificationTime = in.readLong();
- path = in.readObject();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index e3a82a5..358aaf0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -691,12 +691,7 @@ public final class IgfsImpl implements IgfsEx {
return null;
}
- IgfsEntryInfo info = meta.move(src, dest);
-
- int evtTyp = info.isFile() ? EVT_IGFS_FILE_RENAMED : EVT_IGFS_DIR_RENAMED;
-
- if (evts.isRecordable(evtTyp))
- evts.record(new IgfsEvent(src, info.path(), localNode(), evtTyp));
+ meta.move(src, dest);
return null;
}
@@ -1016,8 +1011,8 @@ public final class IgfsImpl implements IgfsEx {
batch = newBatch(path, desc.out());
- IgfsEventAwareOutputStream os = new IgfsEventAwareOutputStream(path, desc.info(), desc.parentId(),
- bufSize == 0 ? cfg.getStreamBufferSize() : bufSize, mode, batch);
+ IgfsEventAwareOutputStream os = new IgfsEventAwareOutputStream(path, desc.info(),
+ bufferSize(bufSize), mode, batch);
IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, EVT_IGFS_FILE_OPENED_WRITE);
@@ -1034,7 +1029,7 @@ public final class IgfsImpl implements IgfsEx {
else
dirProps = fileProps = new HashMap<>(props);
- IgniteBiTuple<IgfsEntryInfo, IgniteUuid> t2 = meta.create(
+ IgfsEntryInfo res = meta.create(
path,
dirProps,
overwrite,
@@ -1044,10 +1039,9 @@ public final class IgfsImpl implements IgfsEx {
fileProps
);
- assert t2 != null;
+ assert res != null;
- return new IgfsEventAwareOutputStream(path, t2.get1(), t2.get2(),
- bufSize == 0 ? cfg.getStreamBufferSize() : bufSize, mode, null);
+ return new IgfsEventAwareOutputStream(path, res, bufferSize(bufSize), mode, null);
}
});
}
@@ -1082,8 +1076,7 @@ public final class IgfsImpl implements IgfsEx {
batch = newBatch(path, desc.out());
- return new IgfsEventAwareOutputStream(path, desc.info(), desc.parentId(),
- bufSize == 0 ? cfg.getStreamBufferSize() : bufSize, mode, batch);
+ return new IgfsEventAwareOutputStream(path, desc.info(), bufferSize(bufSize), mode, batch);
}
final List<IgniteUuid> ids = meta.fileIds(path);
@@ -1112,7 +1105,7 @@ public final class IgfsImpl implements IgfsEx {
else
dirProps = fileProps = new HashMap<>(props);
- IgniteBiTuple<IgfsEntryInfo, IgniteUuid> t2 = meta.append(
+ IgfsEntryInfo res = meta.append(
path,
dirProps,
create,
@@ -1122,10 +1115,9 @@ public final class IgfsImpl implements IgfsEx {
fileProps
);
- assert t2 != null;
+ assert res != null;
- return new IgfsEventAwareOutputStream(path, t2.get1(), t2.get2(),
- bufSize == 0 ? cfg.getStreamBufferSize() : bufSize, mode, null);
+ return new IgfsEventAwareOutputStream(path, res, bufferSize(bufSize), mode, null);
}
});
}
@@ -1693,14 +1685,13 @@ public final class IgfsImpl implements IgfsEx {
*
* @param path Path to stored file.
* @param fileInfo File info.
- * @param parentId Parent ID.
* @param bufSize The size of the buffer to be used.
* @param mode IGFS mode.
* @param batch Optional secondary file system batch.
*/
- IgfsEventAwareOutputStream(IgfsPath path, IgfsEntryInfo fileInfo,
- IgniteUuid parentId, int bufSize, IgfsMode mode, @Nullable IgfsFileWorkerBatch batch) {
- super(igfsCtx, path, fileInfo, parentId, bufSize, mode, batch, metrics);
+ IgfsEventAwareOutputStream(IgfsPath path, IgfsEntryInfo fileInfo, int bufSize, IgfsMode mode,
+ @Nullable IgfsFileWorkerBatch batch) {
+ super(igfsCtx, path, fileInfo, bufSize, mode, batch, metrics);
metrics.incrementFilesOpenedForWrite();
}
@@ -1964,6 +1955,16 @@ public final class IgfsImpl implements IgfsEx {
}
/**
+ * Get buffer size.
+ *
+ * @param bufSize Original buffer size.
+ * @return Real buffer size.
+ */
+ private int bufferSize(int bufSize) {
+ return bufSize == 0 ? cfg.getStreamBufferSize() : bufSize;
+ }
+
+ /**
* IGFS thread factory.
*/
@SuppressWarnings("NullableProblems")
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInputStreamImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInputStreamImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInputStreamImpl.java
index 5d41543..447be93 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInputStreamImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsInputStreamImpl.java
@@ -324,7 +324,7 @@ public class IgfsInputStreamImpl extends IgfsInputStreamAdapter {
}
}
catch (IgniteCheckedException e) {
- throw new IOException("File to close the file: " + fileInfo.path(), e);
+ throw new IOException("File to close the file: " + path, e);
}
finally {
closed = true;
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
index 1aa49ed..d6c5995 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
@@ -52,7 +52,6 @@ import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaFileUnlockProcess
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingAddProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingRemoveProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaDirectoryListingReplaceProcessor;
-import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdatePathProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdatePropertiesProcessor;
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor;
import org.apache.ignite.internal.util.GridLeanMap;
@@ -61,9 +60,7 @@ import org.apache.ignite.internal.util.lang.GridClosureException;
import org.apache.ignite.internal.util.lang.IgniteOutClosureX;
import org.apache.ignite.internal.util.typedef.CI1;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
@@ -89,13 +86,15 @@ import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.CountDownLatch;
+import static org.apache.ignite.events.EventType.EVT_IGFS_DIR_RENAMED;
+import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_RENAMED;
+
/**
* Cache based structure (meta data) manager.
*/
public class IgfsMetaManager extends IgfsManager {
/** Comparator for Id sorting. */
- private static final Comparator<IgniteUuid> PATH_ID_SORTING_COMPARATOR
- = new Comparator<IgniteUuid>() {
+ private static final Comparator<IgniteUuid> PATH_ID_SORTING_COMPARATOR = new Comparator<IgniteUuid>() {
@Override public int compare(IgniteUuid u1, IgniteUuid u2) {
if (u1 == u2)
return 0;
@@ -850,11 +849,10 @@ public class IgfsMetaManager extends IgfsManager {
* Move routine.
*
* @param srcPath Source path.
- * @param dstPath Destinatoin path.
- * @return File info of renamed entry.
+ * @param dstPath Destination path.
* @throws IgniteCheckedException In case of exception.
*/
- public IgfsEntryInfo move(IgfsPath srcPath, IgfsPath dstPath) throws IgniteCheckedException {
+ public void move(IgfsPath srcPath, IgfsPath dstPath) throws IgniteCheckedException {
if (busyLock.enterBusy()) {
try {
validTxState(false);
@@ -931,10 +929,11 @@ public class IgfsMetaManager extends IgfsManager {
tx.commit();
+ // Fire events.
IgfsPath newPath = new IgfsPath(dstPathIds.path(), dstName);
- // Set the new path to the info to simplify event creation:
- return srcInfo.path(newPath);
+ IgfsUtils.sendEvents(igfsCtx.kernalContext(), srcPath, newPath,
+ srcInfo.isFile() ? EVT_IGFS_FILE_RENAMED : EVT_IGFS_DIR_RENAMED);
}
}
finally {
@@ -1137,9 +1136,6 @@ public class IgfsMetaManager extends IgfsManager {
transferEntry(parentInfo.listing().get(victimName), parentId, victimName, trashId, trashName);
- if (victimInfo.isFile())
- invokeUpdatePath(victimId, path);
-
tx.commit();
delWorker.signal();
@@ -1739,19 +1735,6 @@ public class IgfsMetaManager extends IgfsManager {
}
/**
- * Invoke path update processor.
- *
- * @param id File ID.
- * @param path Path to be updated.
- * @throws IgniteCheckedException If failed.
- */
- private void invokeUpdatePath(IgniteUuid id, IgfsPath path) throws IgniteCheckedException {
- validTxState(true);
-
- id2InfoPrj.invoke(id, new IgfsMetaUpdatePathProcessor(path));
- }
-
- /**
* Invoke some processor and return new value.
*
* @param id ID.
@@ -1923,10 +1906,10 @@ public class IgfsMetaManager extends IgfsManager {
}
// Record CREATE event if needed.
- if (evts.isRecordable(EventType.EVT_IGFS_FILE_CREATED))
+ if (oldId == null && evts.isRecordable(EventType.EVT_IGFS_FILE_CREATED))
pendingEvts.add(new IgfsEvent(path, locNode, EventType.EVT_IGFS_FILE_CREATED));
- return new IgfsSecondaryOutputStreamDescriptor(parentInfo.id(), newInfo, out);
+ return new IgfsSecondaryOutputStreamDescriptor(newInfo, out);
}
@Override public IgfsSecondaryOutputStreamDescriptor onFailure(Exception err)
@@ -2018,8 +2001,7 @@ public class IgfsMetaManager extends IgfsManager {
// Set lock and return.
IgfsEntryInfo lockedInfo = invokeLock(info.id(), false);
- return new IgfsSecondaryOutputStreamDescriptor(infos.get(path.parent()).id(),
- lockedInfo, out);
+ return new IgfsSecondaryOutputStreamDescriptor(lockedInfo, out);
}
@Override public IgfsSecondaryOutputStreamDescriptor onFailure(@Nullable Exception err)
@@ -2373,9 +2355,6 @@ public class IgfsMetaManager extends IgfsManager {
softDeleteNonTx(null, path.name(), info.id(), trashId);
}
- // Update the deleted file info with path information for delete worker.
- invokeUpdatePath(info.id(), path);
-
return true; // No additional handling is required.
}
@@ -2902,10 +2881,10 @@ public class IgfsMetaManager extends IgfsManager {
* @param affKey Affinity key.
* @param evictExclude Evict exclude flag.
* @param fileProps File properties.
- * @return Tuple containing the file info and its parent id.
+ * @return Resulting info.
* @throws IgniteCheckedException If failed.
*/
- IgniteBiTuple<IgfsEntryInfo, IgniteUuid> append(
+ IgfsEntryInfo append(
final IgfsPath path,
Map<String, String> dirProps,
final boolean create,
@@ -2954,13 +2933,11 @@ public class IgfsMetaManager extends IgfsManager {
// At this point we can open the stream safely.
info = invokeLock(info.id(), false);
- IgniteBiTuple<IgfsEntryInfo, IgniteUuid> t2 = new T2<>(info, pathIds.lastParentId());
-
tx.commit();
IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, EventType.EVT_IGFS_FILE_OPENED_WRITE);
- return t2;
+ return info;
}
else {
// Create file and parent folders.
@@ -2976,7 +2953,7 @@ public class IgfsMetaManager extends IgfsManager {
// Generate events.
generateCreateEvents(res.createdPaths(), true);
- return new T2<>(res.info(), res.parentId());
+ return res.info();
}
}
}
@@ -2999,10 +2976,10 @@ public class IgfsMetaManager extends IgfsManager {
* @param affKey Affinity key.
* @param evictExclude Evict exclude flag.
* @param fileProps File properties.
- * @return @return Tuple containing the created file info and its parent id.
+ * @return @return Resulting info.
* @throws IgniteCheckedException If failed.
*/
- IgniteBiTuple<IgfsEntryInfo, IgniteUuid> create(
+ IgfsEntryInfo create(
final IgfsPath path,
Map<String, String> dirProps,
final boolean overwrite,
@@ -3080,17 +3057,12 @@ public class IgfsMetaManager extends IgfsManager {
IgfsEntryInfo newInfo = invokeAndGet(overwriteId, new IgfsMetaFileCreateProcessor(createTime,
fileProps, blockSize, affKey, createFileLockId(false), evictExclude));
- // Fourth step: update path of remove file.
- invokeUpdatePath(oldId, path);
-
// Prepare result and commit.
- IgniteBiTuple<IgfsEntryInfo, IgniteUuid> t2 = new T2<>(newInfo, parentId);
-
tx.commit();
IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, EventType.EVT_IGFS_FILE_OPENED_WRITE);
- return t2;
+ return newInfo;
}
else {
// Create file and parent folders.
@@ -3106,7 +3078,7 @@ public class IgfsMetaManager extends IgfsManager {
// Generate events.
generateCreateEvents(res.createdPaths(), true);
- return new T2<>(res.info(), res.parentId());
+ return res.info();
}
}
}
@@ -3190,7 +3162,6 @@ public class IgfsMetaManager extends IgfsManager {
String curPart = pathIds.part(curIdx);
IgniteUuid curId = pathIds.surrogateId(curIdx);
- IgniteUuid curParentId = lastExistingInfo.id();
if (lastExistingInfo.hasChild(curPart))
return null;
@@ -3224,8 +3195,6 @@ public class IgfsMetaManager extends IgfsManager {
// Advance things further.
curIdx++;
- curParentId = curId;
-
curPart = nextPart;
curId = nextId;
}
@@ -3241,7 +3210,7 @@ public class IgfsMetaManager extends IgfsManager {
createdPaths.add(pathIds.path());
- return new IgfsPathsCreateResult(createdPaths, info, curParentId);
+ return new IgfsPathsCreateResult(createdPaths, info);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
index f7c85e8..21e5fb6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
@@ -58,12 +58,6 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
private IgfsEntryInfo fileInfo;
- /** Parent ID. */
- private final IgniteUuid parentId;
-
- /** File name. */
- private final String fileName;
-
/** Space in file to write data. */
@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
private long space;
@@ -103,8 +97,8 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
* @param batch Optional secondary file system batch.
* @param metrics Local IGFS metrics.
*/
- IgfsOutputStreamImpl(IgfsContext igfsCtx, IgfsPath path, IgfsEntryInfo fileInfo, IgniteUuid parentId,
- int bufSize, IgfsMode mode, @Nullable IgfsFileWorkerBatch batch, IgfsLocalMetrics metrics) {
+ IgfsOutputStreamImpl(IgfsContext igfsCtx, IgfsPath path, IgfsEntryInfo fileInfo, int bufSize, IgfsMode mode,
+ @Nullable IgfsFileWorkerBatch batch, IgfsLocalMetrics metrics) {
super(path, optimizeBufferSize(bufSize, fileInfo));
assert fileInfo != null;
@@ -126,13 +120,10 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
this.fileInfo = fileInfo;
this.mode = mode;
this.batch = batch;
- this.parentId = parentId;
this.metrics = metrics;
streamRange = initialStreamRange(fileInfo);
- fileName = path.name();
-
writeCompletionFut = data.writeStart(fileInfo);
}
@@ -270,7 +261,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
exists = meta.exists(fileInfo.id());
}
catch (IgniteCheckedException e) {
- throw new IOException("File to read file metadata: " + fileInfo.path(), e);
+ throw new IOException("File to read file metadata: " + path, e);
}
if (!exists) {
@@ -339,7 +330,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
exists = !deleted && meta.exists(fileInfo.id());
}
catch (IgniteCheckedException e) {
- throw new IOException("File to read file metadata: " + fileInfo.path(), e);
+ throw new IOException("File to read file metadata: " + path, e);
}
if (exists) {
@@ -379,7 +370,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
throw new IOException("File was concurrently deleted: " + path);
}
catch (IgniteCheckedException e) {
- throw new IOException("File to read file metadata: " + fileInfo.path(), e);
+ throw new IOException("File to read file metadata: " + path, e);
}
if (err != null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
index 9462aa4..bd13555 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPathsCreateResult.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.igfs;
import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteUuid;
import java.util.List;
@@ -33,20 +32,15 @@ public class IgfsPathsCreateResult {
/** Info of the last created file. */
private final IgfsEntryInfo info;
- /** Parent ID. */
- private final IgniteUuid parentId;
-
/**
* Constructor.
*
* @param paths Created paths.
* @param info Info of the last created file.
- * @param parentId Parent ID.
*/
- public IgfsPathsCreateResult(List<IgfsPath> paths, IgfsEntryInfo info, IgniteUuid parentId) {
+ public IgfsPathsCreateResult(List<IgfsPath> paths, IgfsEntryInfo info) {
this.paths = paths;
this.info = info;
- this.parentId = parentId;
}
/**
@@ -63,13 +57,6 @@ public class IgfsPathsCreateResult {
return info;
}
- /**
- * @return Parent ID.
- */
- public IgniteUuid parentId() {
- return parentId;
- }
-
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(IgfsPathsCreateResult.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryOutputStreamDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryOutputStreamDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryOutputStreamDescriptor.java
index 507ccfc..6bbc2c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryOutputStreamDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryOutputStreamDescriptor.java
@@ -17,17 +17,12 @@
package org.apache.ignite.internal.processors.igfs;
-import org.apache.ignite.lang.IgniteUuid;
-
import java.io.OutputStream;
/**
* Descriptor of an output stream opened to the secondary file system.
*/
public class IgfsSecondaryOutputStreamDescriptor {
- /** Parent ID in the primary file system. */
- private final IgniteUuid parentId;
-
/** File info in the primary file system. */
private final IgfsEntryInfo info;
@@ -37,28 +32,18 @@ public class IgfsSecondaryOutputStreamDescriptor {
/**
* Constructor.
*
- * @param parentId Parent ID in the primary file system.
* @param info File info in the primary file system.
* @param out Output stream to the secondary file system.
*/
- IgfsSecondaryOutputStreamDescriptor(IgniteUuid parentId, IgfsEntryInfo info, OutputStream out) {
- assert parentId != null;
+ IgfsSecondaryOutputStreamDescriptor(IgfsEntryInfo info, OutputStream out) {
assert info != null;
assert out != null;
- this.parentId = parentId;
this.info = info;
this.out = out;
}
/**
- * @return Parent ID in the primary file system.
- */
- IgniteUuid parentId() {
- return parentId;
- }
-
- /**
* @return File info in the primary file system.
*/
IgfsEntryInfo info() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index 9b813b8..c6b7ad3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -282,7 +282,6 @@ public class IgfsUtils {
"exceeded. [maxAttempts=" + MAX_CACHE_TX_RETRIES + ']');
}
-
/**
* Sends a series of event.
*
@@ -290,14 +289,29 @@ public class IgfsUtils {
* @param type The type of event to send.
*/
public static void sendEvents(GridKernalContext kernalCtx, IgfsPath path, int type) {
+ sendEvents(kernalCtx, path, null, type);
+ }
+
+ /**
+ * Sends a series of event.
+ *
+ * @param path The path of the created file.
+ * @param newPath New path.
+ * @param type The type of event to send.
+ */
+ public static void sendEvents(GridKernalContext kernalCtx, IgfsPath path, IgfsPath newPath, int type) {
assert kernalCtx != null;
assert path != null;
GridEventStorageManager evts = kernalCtx.event();
ClusterNode locNode = kernalCtx.discovery().localNode();
- if (evts.isRecordable(type))
- evts.record(new IgfsEvent(path, locNode, type));
+ if (evts.isRecordable(type)) {
+ if (newPath == null)
+ evts.record(new IgfsEvent(path, locNode, type));
+ else
+ evts.record(new IgfsEvent(path, newPath, locNode, type));
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePathProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePathProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePathProcessor.java
deleted file mode 100644
index 782b25b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePathProcessor.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.igfs.meta;
-
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.igfs.IgfsPath;
-import org.apache.ignite.internal.processors.igfs.IgfsEntryInfo;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.lang.IgniteUuid;
-
-import javax.cache.processor.EntryProcessor;
-import javax.cache.processor.MutableEntry;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-/**
- * Update path closure.
- */
-public final class IgfsMetaUpdatePathProcessor implements EntryProcessor<IgniteUuid, IgfsEntryInfo, Void>,
- Externalizable, Binarylizable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** New path. */
- private IgfsPath path;
-
- /**
- * @param path Path.
- */
- public IgfsMetaUpdatePathProcessor(IgfsPath path) {
- this.path = path;
- }
-
- /**
- * Default constructor (required by Externalizable).
- */
- public IgfsMetaUpdatePathProcessor() {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public Void process(MutableEntry<IgniteUuid, IgfsEntryInfo> e, Object... args) {
- IgfsEntryInfo info = e.getValue();
-
- IgfsEntryInfo newInfo = info.path(path);
-
- e.setValue(newInfo);
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(path);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- path = (IgfsPath)in.readObject();
- }
-
- /** {@inheritDoc} */
- @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
- BinaryRawWriter out = writer.rawWriter();
-
- out.writeObject(path);
- }
-
- /** {@inheritDoc} */
- @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
- BinaryRawReader in = reader.rawReader();
-
- path = in.readObject();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(IgfsMetaUpdatePathProcessor.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
index 6ca75a1..de20a4f 100644
--- a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
@@ -53,7 +53,6 @@ import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_CREATED;
import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_DELETED;
import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_OPENED_READ;
import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_OPENED_WRITE;
-import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_PURGED;
import static org.apache.ignite.events.EventType.EVT_IGFS_FILE_RENAMED;
import static org.apache.ignite.events.EventType.EVT_JOB_MAPPED;
import static org.apache.ignite.events.EventType.EVT_TASK_FAILED;
@@ -425,7 +424,7 @@ public abstract class IgfsEventsAbstractSelfTest extends GridCommonAbstractTest
public void testTwoFiles() throws Exception {
final List<Event> evtList = new ArrayList<>();
- final int evtsCnt = 4 + 3 + 2 + 2;
+ final int evtsCnt = 4 + 3 + 1 + 1;
final CountDownLatch latch = new CountDownLatch(evtsCnt);
@@ -495,11 +494,9 @@ public abstract class IgfsEventsAbstractSelfTest extends GridCommonAbstractTest
assertEquals(0, evt.dataSize());
assertOneToOne(
- evtList.subList(7, 11),
+ evtList.subList(7, 9),
new EventPredicate(EVT_IGFS_FILE_DELETED, new IgfsPath("/dir1/file1")),
- new EventPredicate(EVT_IGFS_FILE_PURGED, new IgfsPath("/dir1/file1")),
- new EventPredicate(EVT_IGFS_FILE_DELETED, new IgfsPath("/dir1/file2")),
- new EventPredicate(EVT_IGFS_FILE_PURGED, new IgfsPath("/dir1/file2"))
+ new EventPredicate(EVT_IGFS_FILE_DELETED, new IgfsPath("/dir1/file2"))
);
}
@@ -683,7 +680,7 @@ public abstract class IgfsEventsAbstractSelfTest extends GridCommonAbstractTest
public void testSingleFileOverwrite() throws Exception {
final List<Event> evtList = new ArrayList<>();
- final int evtsCnt = 1 + 4 + 1;
+ final int evtsCnt = 1 + 3 + 1;
final CountDownLatch latch = new CountDownLatch(evtsCnt);
@@ -737,27 +734,6 @@ public abstract class IgfsEventsAbstractSelfTest extends GridCommonAbstractTest
@Override public boolean apply(Event e) {
IgfsEvent e0 = (IgfsEvent)e;
- return e0.type() == EVT_IGFS_FILE_DELETED && e0.path().equals(file1);
- }
- },
- new P1<Event>() {
- @Override public boolean apply(Event e) {
- IgfsEvent e0 = (IgfsEvent)e;
-
- return e0.type() == EVT_IGFS_FILE_PURGED && e0.path().equals(file1);
- }
- },
- new P1<Event>() {
- @Override public boolean apply(Event e) {
- IgfsEvent e0 = (IgfsEvent)e;
-
- return e0.type() == EVT_IGFS_FILE_CREATED && e0.path().equals(file1);
- }
- },
- new P1<Event>() {
- @Override public boolean apply(Event e) {
- IgfsEvent e0 = (IgfsEvent)e;
-
return e0.type() == EVT_IGFS_FILE_OPENED_WRITE && e0.path().equals(file1);
}
},
http://git-wip-us.apache.org/repos/asf/ignite/blob/c3b02dca/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
index 3dc2791..039bf8d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
@@ -214,12 +214,12 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
private IgfsEntryInfo createFileAndGetInfo(String path) throws IgniteCheckedException {
IgfsPath p = path(path);
- IgniteBiTuple<IgfsEntryInfo, IgniteUuid> t2 = mgr.create(p, null, false, 400, null, false, null);
+ IgfsEntryInfo res = mgr.create(p, null, false, 400, null, false, null);
- assert t2 != null;
- assert !t2.get1().isDirectory();
+ assert res != null;
+ assert !res.isDirectory();
- return t2.get1();
+ return res;
}
/**
[10/25] ignite git commit: Minor
Posted by dm...@apache.org.
Minor
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8d199683
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8d199683
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8d199683
Branch: refs/heads/ignite-2849
Commit: 8d199683d074ba377077d1291eb2682bc2f228b4
Parents: cadc61fa
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Mar 22 15:14:15 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Mar 22 15:14:15 2016 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/atomic/GridDhtAtomicUpdateFuture.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8d199683/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 58d704d..9f52658 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
@@ -135,9 +135,7 @@ public class GridDhtAtomicUpdateFuture extends GridFutureAdapter<Void>
keys = new ArrayList<>(updateReq.keys().size());
mappings = U.newHashMap(updateReq.keys().size());
- boolean topLocked = updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest());
-
- waitForExchange = !topLocked;
+ waitForExchange = !(updateReq.topologyLocked() || (updateReq.fastMap() && !updateReq.clientRequest()));
}
/**
[11/25] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by dm...@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/046a188b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/046a188b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/046a188b
Branch: refs/heads/ignite-2849
Commit: 046a188b80f0110080b1151362a51379429aa660
Parents: 8d19968 409a623
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Mar 22 15:14:34 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Mar 22 15:14:34 2016 +0300
----------------------------------------------------------------------
.../configuration/FileSystemConfiguration.java | 51 +-
.../internal/GridEventConsumeHandler.java | 3 +-
.../internal/GridMessageListenHandler.java | 3 +-
.../ignite/internal/binary/BinaryContext.java | 2 -
.../continuous/CacheContinuousQueryHandler.java | 88 +++-
.../continuous/CacheContinuousQueryManager.java | 12 +
.../continuous/GridContinuousHandler.java | 4 +-
.../continuous/GridContinuousProcessor.java | 27 +-
.../StartRoutineAckDiscoveryMessage.java | 22 +-
.../StartRoutineDiscoveryMessage.java | 22 +-
.../processors/igfs/IgfsDeleteWorker.java | 8 +-
.../processors/igfs/IgfsDirectoryInfo.java | 30 +-
.../internal/processors/igfs/IgfsEntryInfo.java | 37 +-
.../ignite/internal/processors/igfs/IgfsEx.java | 12 -
.../internal/processors/igfs/IgfsImpl.java | 47 +-
.../processors/igfs/IgfsInputStreamImpl.java | 2 +-
.../processors/igfs/IgfsMetaManager.java | 111 ++---
.../processors/igfs/IgfsOutputStreamImpl.java | 21 +-
.../internal/processors/igfs/IgfsPathIds.java | 52 ++-
.../processors/igfs/IgfsPathsCreateResult.java | 15 +-
.../internal/processors/igfs/IgfsProcessor.java | 29 +-
.../IgfsSecondaryOutputStreamDescriptor.java | 17 +-
.../internal/processors/igfs/IgfsUtils.java | 173 ++++++-
.../meta/IgfsMetaDirectoryCreateProcessor.java | 12 +-
.../IgfsMetaDirectoryListingAddProcessor.java | 7 +-
.../igfs/meta/IgfsMetaFileCreateProcessor.java | 8 +-
.../igfs/meta/IgfsMetaUpdatePathProcessor.java | 102 ----
.../meta/IgfsMetaUpdatePropertiesProcessor.java | 5 +-
.../ignite/igfs/IgfsEventsAbstractSelfTest.java | 32 +-
.../distributed/IgniteCacheCreatePutTest.java | 137 +++++-
.../CacheContinuousQueryLostPartitionTest.java | 2 -
.../GridCacheContinuousQueryConcurrentTest.java | 466 +++++++++++++++++++
.../processors/igfs/IgfsAbstractSelfTest.java | 31 +-
.../igfs/IgfsDualAbstractSelfTest.java | 13 +-
.../igfs/IgfsMetaManagerSelfTest.java | 8 +-
.../igfs/IgfsPrimaryRelaxedSelfTest.java | 28 ++
.../processors/igfs/IgfsProcessorSelfTest.java | 17 +-
.../processors/igfs/IgfsStreamsSelfTest.java | 2 +-
.../ignite/testsuites/IgniteIgfsTestSuite.java | 2 +
.../fs/IgniteHadoopIgfsSecondaryFileSystem.java | 8 +-
.../hadoop/fs/v1/IgniteHadoopFileSystem.java | 19 +-
.../hadoop/fs/v2/IgniteHadoopFileSystem.java | 21 +-
.../hadoop/igfs/HadoopIgfsProperties.java | 11 +-
...oopFileSystemUniversalFileSystemAdapter.java | 8 +-
.../processors/hadoop/HadoopMapReduceTest.java | 5 +-
.../IgniteCacheQuerySelfTestSuite.java | 2 +
46 files changed, 1248 insertions(+), 486 deletions(-)
----------------------------------------------------------------------
[25/25] ignite git commit: IGNITE-2849: BINARY_OBJ time must be of
Object type name
Posted by dm...@apache.org.
IGNITE-2849: BINARY_OBJ time must be of Object type name
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8fa87699
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8fa87699
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8fa87699
Branch: refs/heads/ignite-2849
Commit: 8fa8769930866b94dc12f677d4e68b91dea24c9d
Parents: ab9387c
Author: Denis Magda <dm...@gridgain.com>
Authored: Thu Mar 24 14:40:55 2016 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Thu Mar 24 14:40:55 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryUtils.java | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8fa87699/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
index a293611..37f1d6a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java
@@ -218,7 +218,7 @@ public class BinaryUtils {
FIELD_TYPE_NAMES[GridBinaryMarshaller.TIMESTAMP] = "Timestamp";
FIELD_TYPE_NAMES[GridBinaryMarshaller.ENUM] = "Enum";
FIELD_TYPE_NAMES[GridBinaryMarshaller.OBJ] = "Object";
- FIELD_TYPE_NAMES[GridBinaryMarshaller.BINARY_OBJ] = "BinaryObject";
+ FIELD_TYPE_NAMES[GridBinaryMarshaller.BINARY_OBJ] = "Object";
FIELD_TYPE_NAMES[GridBinaryMarshaller.COL] = "Collection";
FIELD_TYPE_NAMES[GridBinaryMarshaller.MAP] = "Map";
FIELD_TYPE_NAMES[GridBinaryMarshaller.CLASS] = "Class";
@@ -320,22 +320,6 @@ public class BinaryUtils {
}
/**
- * @param typeName Field type name.
- * @return Field type ID;
- */
- @SuppressWarnings("StringEquality")
- public static int fieldTypeId(String typeName) {
- for (int i = 0; i < FIELD_TYPE_NAMES.length; i++) {
- String typeName0 = FIELD_TYPE_NAMES[i];
-
- if (typeName.equals(typeName0))
- return i;
- }
-
- throw new IllegalArgumentException("Invalid metadata type name: " + typeName);
- }
-
- /**
* @param typeId Field type ID.
* @return Field type name.
*/
[05/25] ignite git commit: IGNITE-2868: IGFS: Increased trash
concurrency from 16 to 64.
Posted by dm...@apache.org.
IGNITE-2868: IGFS: Increased trash concurrency from 16 to 64.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f0fe3e0c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f0fe3e0c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f0fe3e0c
Branch: refs/heads/ignite-2849
Commit: f0fe3e0ca43e2b6f9adb0b719399104a0e2ab54f
Parents: 574f2cd
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Mar 22 09:23:29 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Mar 22 09:23:29 2016 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0fe3e0c/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index 7063f68..94e1cef 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -65,7 +65,7 @@ public class IgfsUtils {
public static final IgniteUuid DELETE_LOCK_ID = new IgniteUuid(new UUID(0, 0), 0);
/** Constant trash concurrency level. */
- public static final int TRASH_CONCURRENCY = 16;
+ public static final int TRASH_CONCURRENCY = 64;
/** Trash directory IDs. */
private static final IgniteUuid[] TRASH_IDS;
[15/25] ignite git commit: Reproducer.
Posted by dm...@apache.org.
Reproducer.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b189bb2e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b189bb2e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b189bb2e
Branch: refs/heads/ignite-2849
Commit: b189bb2e15e7a54a890395b344bc7355e2f6d147
Parents: fc9730a
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Mar 23 18:01:01 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Mar 23 18:01:01 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/cache/GridCacheMapEntry.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b189bb2e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index fb6aeef..6677c6a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -2453,10 +2453,12 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
recordNodeId(affNodeId, topVer);
- updateCntr0 = nextPartCounter(topVer);
+ if (hadVal) {
+ updateCntr0 = nextPartCounter(topVer);
- if (updateCntr != null)
- updateCntr0 = updateCntr;
+ if (updateCntr != null)
+ updateCntr0 = updateCntr;
+ }
drReplicate(drType, null, newVer, topVer);
[20/25] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by dm...@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/90a5bbec
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/90a5bbec
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/90a5bbec
Branch: refs/heads/ignite-2849
Commit: 90a5bbec4978da35d43c1c121d880cbba5c8dea4
Parents: 29806af 3bf5f46
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Mar 24 10:35:55 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Mar 24 10:35:55 2016 +0300
----------------------------------------------------------------------
.../examples/datagrid/store/CacheLoadOnlyStoreExample.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
[17/25] ignite git commit: IGNITE-2415: CacheLoadOnlyStoreAdapter use
example. - Fixes #569.
Posted by dm...@apache.org.
IGNITE-2415: CacheLoadOnlyStoreAdapter use example. - Fixes #569.
Signed-off-by: shtykh_roman <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/2f64ab0b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2f64ab0b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2f64ab0b
Branch: refs/heads/ignite-2849
Commit: 2f64ab0b4739a646dfb2c3b1fb2ed5b8039b43b4
Parents: 66f9a34
Author: shtykh_roman <rs...@yahoo.com>
Authored: Thu Mar 24 11:00:21 2016 +0900
Committer: shtykh_roman <rs...@yahoo.com>
Committed: Thu Mar 24 11:00:21 2016 +0900
----------------------------------------------------------------------
.../store/CacheLoadOnlyStoreExample.java | 166 +++++++++++++++++++
examples/src/main/resources/person.csv | 20 +++
.../ignite/examples/CacheExamplesSelfTest.java | 8 +
3 files changed, 194 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f64ab0b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
new file mode 100644
index 0000000..4635c16
--- /dev/null
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
@@ -0,0 +1,166 @@
+/*
+ * 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.examples.datagrid.store;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Scanner;
+import javax.cache.configuration.FactoryBuilder;
+import javax.cache.integration.CacheLoaderException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CachePeekMode;
+import org.apache.ignite.cache.store.CacheLoadOnlyStoreAdapter;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.examples.ExampleNodeStartup;
+import org.apache.ignite.examples.model.Person;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Example of how to load data from CSV file using {@link CacheLoadOnlyStoreAdapter}.
+ * <p>
+ * The adapter is intended to be used in cases when you need to pre-load a cache from text or file of any other format.
+ * <p>
+ * Remote nodes can be started with {@link ExampleNodeStartup} in another JVM which will
+ * start node with {@code examples/config/example-ignite.xml} configuration.
+ */
+public class CacheLoadOnlyStoreExample {
+ /** Cache name. */
+ private static final String CACHE_NAME = CacheLoadOnlyStoreExample.class.getSimpleName();
+
+ /**
+ * Executes example.
+ *
+ * @param args Command line arguments, none required.
+ * @throws IgniteException If example execution failed.
+ */
+ public static void main(String[] args) throws IgniteException {
+ try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
+ System.out.println();
+ System.out.println(">>> CacheLoadOnlyStoreExample started.");
+
+ ProductLoader productLoader = new ProductLoader("examples/src/main/resources/person.csv");
+
+ productLoader.setThreadsCount(2);
+ productLoader.setBatchSize(10);
+ productLoader.setBatchQueueSize(1);
+
+ try (IgniteCache<Long, Person> cache = ignite.getOrCreateCache(cacheConfiguration(productLoader))) {
+ // load data.
+ cache.loadCache(null);
+
+ System.out.println(">>> Loaded number of items: " + cache.size(CachePeekMode.PRIMARY));
+
+ System.out.println(">>> Data for the person by id1: " + cache.get(1L));
+ }
+ finally {
+ // Distributed cache could be removed from cluster only by #destroyCache() call.
+ ignite.destroyCache(CACHE_NAME);
+ }
+ }
+ }
+
+ /**
+ * Creates cache configurations for the loader.
+ *
+ * @return {@link CacheConfiguration}.
+ */
+ private static CacheConfiguration cacheConfiguration(ProductLoader productLoader) {
+ CacheConfiguration cacheCfg = new CacheConfiguration();
+
+ cacheCfg.setCacheMode(CacheMode.PARTITIONED);
+ cacheCfg.setName(CACHE_NAME);
+
+ // provide the loader.
+ cacheCfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(productLoader));
+
+ return cacheCfg;
+ }
+
+ /**
+ * Csv data loader for product data.
+ */
+ private static class ProductLoader extends CacheLoadOnlyStoreAdapter<Long, Person, String> implements Serializable {
+ /** Csv file name. */
+ final String csvFileName;
+
+ /** Constructor. */
+ ProductLoader(String csvFileName) {
+ this.csvFileName = csvFileName;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Iterator<String> inputIterator(@Nullable Object... args) throws CacheLoaderException {
+ final Scanner scanner;
+
+ try {
+ File path = IgniteUtils.resolveIgnitePath(csvFileName);
+
+ if (path == null)
+ throw new CacheLoaderException("Failed to open the source file: " + csvFileName);
+
+ scanner = new Scanner(path);
+
+ scanner.useDelimiter("\\n");
+ }
+ catch (FileNotFoundException e) {
+ throw new CacheLoaderException("Failed to open the source file " + csvFileName, e);
+ }
+
+ /**
+ * Iterator for text input. The scanner is implicitly closed when there's nothing to scan.
+ */
+ return new Iterator<String>() {
+ /** {@inheritDoc} */
+ @Override public boolean hasNext() {
+ if (!scanner.hasNext()) {
+ scanner.close();
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String next() {
+ if (!hasNext())
+ throw new NoSuchElementException();
+
+ return scanner.next();
+ }
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected IgniteBiTuple<Long, Person> parse(String rec, @Nullable Object... args) {
+ String[] p = rec.split("\\s*,\\s*");
+ return new T2<>(Long.valueOf(p[0]), new Person(Long.valueOf(p[0]), Long.valueOf(p[1]),
+ p[2], p[3], Double.valueOf(p[4]), p[5].trim()));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f64ab0b/examples/src/main/resources/person.csv
----------------------------------------------------------------------
diff --git a/examples/src/main/resources/person.csv b/examples/src/main/resources/person.csv
new file mode 100644
index 0000000..6f45854
--- /dev/null
+++ b/examples/src/main/resources/person.csv
@@ -0,0 +1,20 @@
+1,201,name1,surname1,1000,r1
+2,202,name2,surname2,2000,r2
+3,203,name3,surname3,3000,r3
+4,204,name4,surname4,4000,r4
+5,205,name5,surname5,5000,r5
+6,206,name6,surname6,6000,r6
+7,207,name7,surname7,7000,r7
+8,208,name8,surname8,8000,r8
+9,209,name9,surname9,9000,r9
+10,210,name10,surname10,10000,r10
+11,211,name11,surname11,11000,r11
+12,212,name12,surname12,12000,r12
+13,213,name13,surname13,13000,r13
+14,214,name14,surname14,14000,r14
+15,215,name15,surname15,15000,r15
+16,216,name16,surname16,16000,r16
+17,217,name17,surname17,17000,r17
+18,218,name18,surname18,18000,r18
+19,219,name19,surname19,19000,r19
+20,220,name20,surname20,20000,r20
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/2f64ab0b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
----------------------------------------------------------------------
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
index 39c2ea6..541291b 100644
--- a/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
+++ b/examples/src/test/java/org/apache/ignite/examples/CacheExamplesSelfTest.java
@@ -26,6 +26,7 @@ import org.apache.ignite.examples.datagrid.CachePutGetExample;
import org.apache.ignite.examples.datagrid.CacheQueryExample;
import org.apache.ignite.examples.datagrid.CacheTransactionExample;
import org.apache.ignite.examples.datagrid.starschema.CacheStarSchemaExample;
+import org.apache.ignite.examples.datagrid.store.CacheLoadOnlyStoreExample;
import org.apache.ignite.examples.datastructures.IgniteAtomicLongExample;
import org.apache.ignite.examples.datastructures.IgniteAtomicReferenceExample;
import org.apache.ignite.examples.datastructures.IgniteAtomicSequenceExample;
@@ -158,4 +159,11 @@ public class CacheExamplesSelfTest extends GridAbstractExamplesTest {
public void testCacheContinuousQueryExample() throws Exception {
CacheContinuousQueryExample.main(EMPTY_ARGS);
}
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheLoadOnlyStoreExample() throws Exception {
+ CacheLoadOnlyStoreExample.main(EMPTY_ARGS);
+ }
}
[03/25] ignite git commit: Fixed IGNITE-2791 "Continuous query
listener is not notified during concurrent key put and registration."
Posted by dm...@apache.org.
Fixed IGNITE-2791 "Continuous query listener is not notified during concurrent key put and registration."
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/49725e9d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/49725e9d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/49725e9d
Branch: refs/heads/ignite-2849
Commit: 49725e9d37e8f0117758cda4714ca6e9a583b900
Parents: 43ff148
Author: Tikhonov Nikolay <ti...@gmail.com>
Authored: Mon Mar 21 23:44:56 2016 +0300
Committer: Tikhonov Nikolay <ti...@gmail.com>
Committed: Mon Mar 21 23:44:56 2016 +0300
----------------------------------------------------------------------
.../internal/GridEventConsumeHandler.java | 3 +-
.../internal/GridMessageListenHandler.java | 3 +-
.../continuous/CacheContinuousQueryHandler.java | 88 +++-
.../continuous/CacheContinuousQueryManager.java | 12 +
.../continuous/GridContinuousHandler.java | 4 +-
.../continuous/GridContinuousProcessor.java | 27 +-
.../StartRoutineAckDiscoveryMessage.java | 22 +-
.../StartRoutineDiscoveryMessage.java | 22 +-
.../CacheContinuousQueryLostPartitionTest.java | 2 -
.../GridCacheContinuousQueryConcurrentTest.java | 466 +++++++++++++++++++
.../IgniteCacheQuerySelfTestSuite.java | 2 +
11 files changed, 600 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/49725e9d/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
index e2b1184..19bf1a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridEventConsumeHandler.java
@@ -136,7 +136,8 @@ class GridEventConsumeHandler implements GridContinuousHandler {
}
/** {@inheritDoc} */
- @Override public void updateCounters(AffinityTopologyVersion topVer, Map<Integer, Long> cntrs) {
+ @Override public void updateCounters(AffinityTopologyVersion topVer, Map<UUID, Map<Integer, Long>> cntrsPerNode,
+ Map<Integer, Long> cntrs) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49725e9d/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
index 402365c..0ac6877 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridMessageListenHandler.java
@@ -125,7 +125,8 @@ public class GridMessageListenHandler implements GridContinuousHandler {
}
/** {@inheritDoc} */
- @Override public void updateCounters(AffinityTopologyVersion topVer, Map<Integer, Long> cntrs) {
+ @Override public void updateCounters(AffinityTopologyVersion topVer, Map<UUID, Map<Integer, Long>> cntrsPerNode,
+ Map<Integer, Long> cntrs) {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49725e9d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
index 10fbd89..6243af7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java
@@ -55,6 +55,7 @@ import org.apache.ignite.internal.managers.deployment.GridDeploymentInfo;
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
+import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheDeploymentManager;
import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
@@ -72,6 +73,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgnitePredicate;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentLinkedDeque8;
@@ -146,10 +148,13 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
private transient int cacheId;
/** */
- private Map<Integer, Long> initUpdCntrs;
+ private transient volatile Map<Integer, Long> initUpdCntrs;
/** */
- private AffinityTopologyVersion initTopVer;
+ private transient volatile Map<UUID, Map<Integer, Long>> initUpdCntrsPerNode;
+
+ /** */
+ private transient volatile AffinityTopologyVersion initTopVer;
/** */
private transient boolean ignoreClsNotFound;
@@ -264,9 +269,11 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
}
/** {@inheritDoc} */
- @Override public void updateCounters(AffinityTopologyVersion topVer, Map<Integer, Long> cntrs) {
- this.initTopVer = topVer;
+ @Override public void updateCounters(AffinityTopologyVersion topVer, Map<UUID, Map<Integer, Long>> cntrsPerNode,
+ Map<Integer, Long> cntrs) {
+ this.initUpdCntrsPerNode = cntrsPerNode;
this.initUpdCntrs = cntrs;
+ this.initTopVer = topVer;
}
/** {@inheritDoc} */
@@ -296,20 +303,6 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
assert !skipPrimaryCheck || loc;
- final GridCacheContext<K, V> cctx = cacheContext(ctx);
-
- if (!internal && cctx != null && initUpdCntrs != null) {
- Map<Integer, Long> map = cctx.topology().updateCounters();
-
- for (Map.Entry<Integer, Long> e : map.entrySet()) {
- Long cntr0 = initUpdCntrs.get(e.getKey());
- Long cntr1 = e.getValue();
-
- if (cntr0 == null || cntr1 > cntr0)
- initUpdCntrs.put(e.getKey(), cntr1);
- }
- }
-
CacheContinuousQueryListener<K, V> lsnr = new CacheContinuousQueryListener<K, V>() {
@Override public void onExecution() {
if (ctx.event().isRecordable(EVT_CACHE_QUERY_EXECUTED)) {
@@ -561,6 +554,20 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
entry.prepareMarshal(cctx);
}
+ /**
+ * Wait topology.
+ */
+ public void waitTopologyFuture(GridKernalContext ctx) throws IgniteCheckedException {
+ GridCacheContext<K, V> cctx = cacheContext(ctx);
+
+ if (!cctx.isLocal()) {
+ cacheContext(ctx).affinity().affinityReadyFuture(initTopVer).get();
+
+ for (int partId = 0; partId < cacheContext(ctx).affinity().partitions(); partId++)
+ getOrCreatePartitionRecovery(ctx, partId);
+ }
+ }
+
/** {@inheritDoc} */
@Override public void onListenerRegistered(UUID routineId, GridKernalContext ctx) {
// No-op.
@@ -668,19 +675,54 @@ public class CacheContinuousQueryHandler<K, V> implements GridContinuousHandler
if (e.updateCounter() == -1L)
return F.asList(e);
- PartitionRecovery rec = rcvs.get(e.partition());
+ PartitionRecovery rec = getOrCreatePartitionRecovery(ctx, e.partition());
+
+ return rec.collectEntries(e);
+ }
+
+ /**
+ * @param ctx Context.
+ * @param partId Partition id.
+ * @return Partition recovery.
+ */
+ @NotNull private PartitionRecovery getOrCreatePartitionRecovery(GridKernalContext ctx, int partId) {
+ PartitionRecovery rec = rcvs.get(partId);
if (rec == null) {
- rec = new PartitionRecovery(ctx.log(getClass()), initTopVer,
- initUpdCntrs == null ? null : initUpdCntrs.get(e.partition()));
+ Long partCntr = null;
- PartitionRecovery oldRec = rcvs.putIfAbsent(e.partition(), rec);
+ AffinityTopologyVersion initTopVer0 = initTopVer;
+
+ if (initTopVer0 != null) {
+ GridCacheContext<K, V> cctx = cacheContext(ctx);
+
+ GridCacheAffinityManager aff = cctx.affinity();
+
+ if (initUpdCntrsPerNode != null) {
+ for (ClusterNode node : aff.nodes(partId, initTopVer)) {
+ Map<Integer, Long> map = initUpdCntrsPerNode.get(node.id());
+
+ if (map != null) {
+ partCntr = map.get(partId);
+
+ break;
+ }
+ }
+ }
+ else if (initUpdCntrs != null) {
+ partCntr = initUpdCntrs.get(partId);
+ }
+ }
+
+ rec = new PartitionRecovery(ctx.log(getClass()), initTopVer0, partCntr);
+
+ PartitionRecovery oldRec = rcvs.putIfAbsent(partId, rec);
if (oldRec != null)
rec = oldRec;
}
- return rec.collectEntries(e);
+ return rec;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/49725e9d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index 353043f..869a51b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -649,6 +649,18 @@ public class CacheContinuousQueryManager extends GridCacheManagerAdapter {
autoUnsubscribe,
pred).get();
+ try {
+ if (hnd.isQuery() && cctx.userCache())
+ hnd.waitTopologyFuture(cctx.kernalContext());
+ }
+ catch (IgniteCheckedException e) {
+ log.warning("Failed to start continuous query.", e);
+
+ cctx.kernalContext().continuous().stopRoutine(id);
+
+ throw new IgniteCheckedException("Failed to start continuous query.", e);
+ }
+
if (notifyExisting) {
final Iterator<GridCacheEntryEx> it = cctx.cache().allEntries().iterator();
http://git-wip-us.apache.org/repos/asf/ignite/blob/49725e9d/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
index 8cd30a8..46e87af 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java
@@ -154,8 +154,10 @@ public interface GridContinuousHandler extends Externalizable, Cloneable {
public String cacheName();
/**
+ * @param cntrsPerNode Init state partition counters for node.
* @param cntrs Init state for partition counters.
* @param topVer Topology version.
*/
- public void updateCounters(AffinityTopologyVersion topVer, Map<Integer, Long> cntrs);
+ public void updateCounters(AffinityTopologyVersion topVer, Map<UUID, Map<Integer, Long>> cntrsPerNode,
+ Map<Integer, Long> cntrs);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/49725e9d/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index 1776748..f2d6e1e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -45,7 +45,6 @@ import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
import org.apache.ignite.internal.IgniteDeploymentCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
-import org.apache.ignite.internal.IgniteNodeAttributes;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.managers.deployment.GridDeployment;
@@ -220,25 +219,18 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
// Update partition counters.
if (routine != null && routine.handler().isQuery()) {
+ Map<UUID, Map<Integer, Long>> cntrsPerNode = msg.updateCountersPerNode();
Map<Integer, Long> cntrs = msg.updateCounters();
GridCacheAdapter<Object, Object> interCache =
ctx.cache().internalCache(routine.handler().cacheName());
- if (interCache != null && cntrs != null && interCache.context() != null
- && !interCache.isLocal() && !CU.clientNode(ctx.grid().localNode())) {
- Map<Integer, Long> map = interCache.context().topology().updateCounters();
+ GridCacheContext cctx = interCache != null ? interCache.context() : null;
- for (Map.Entry<Integer, Long> e : map.entrySet()) {
- Long cntr0 = cntrs.get(e.getKey());
- Long cntr1 = e.getValue();
+ if (cctx != null && cntrsPerNode != null && !cctx.isLocal() && cctx.affinityNode())
+ cntrsPerNode.put(ctx.localNodeId(), cctx.topology().updateCounters());
- if (cntr0 == null || cntr1 > cntr0)
- cntrs.put(e.getKey(), cntr1);
- }
- }
-
- routine.handler().updateCounters(topVer, msg.updateCounters());
+ routine.handler().updateCounters(topVer, cntrsPerNode, cntrs);
}
fut.onRemoteRegistered();
@@ -756,7 +748,7 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
syncMsgFuts.put(futId, fut);
try {
- sendNotification(nodeId, routineId, futId, F.asList(obj), orderedTopic, msg, null);
+ sendNotification(nodeId, routineId, futId, F.asList(obj), null, msg, null);
}
catch (IgniteCheckedException e) {
syncMsgFuts.remove(futId);
@@ -923,11 +915,8 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
if (proc != null) {
GridCacheAdapter cache = ctx.cache().internalCache(hnd0.cacheName());
- if (cache != null && !cache.isLocal()) {
- Map<Integer, Long> cntrs = cache.context().topology().updateCounters();
-
- req.addUpdateCounters(cntrs);
- }
+ if (cache != null && !cache.isLocal())
+ req.addUpdateCounters(ctx.localNodeId(), cache.context().topology().updateCounters());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49725e9d/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineAckDiscoveryMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineAckDiscoveryMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineAckDiscoveryMessage.java
index 9644372..ca34b27 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineAckDiscoveryMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineAckDiscoveryMessage.java
@@ -22,6 +22,7 @@ import java.util.Map;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
@@ -36,18 +37,28 @@ public class StartRoutineAckDiscoveryMessage extends AbstractContinuousMessage {
private final Map<UUID, IgniteCheckedException> errs;
/** */
+ @GridToStringExclude
private final Map<Integer, Long> updateCntrs;
+ /** */
+ @GridToStringExclude
+ private final Map<UUID, Map<Integer, Long>> updateCntrsPerNode;
+
/**
* @param routineId Routine id.
* @param errs Errs.
+ * @param cntrs Partition counters.
+ * @param cntrsPerNode Partition counters per node.
*/
- public StartRoutineAckDiscoveryMessage(UUID routineId, Map<UUID, IgniteCheckedException> errs,
- Map<Integer, Long> cntrs) {
+ public StartRoutineAckDiscoveryMessage(UUID routineId,
+ Map<UUID, IgniteCheckedException> errs,
+ Map<Integer, Long> cntrs,
+ Map<UUID, Map<Integer, Long>> cntrsPerNode) {
super(routineId);
this.errs = new HashMap<>(errs);
this.updateCntrs = cntrs;
+ this.updateCntrsPerNode = cntrsPerNode;
}
/** {@inheritDoc} */
@@ -63,6 +74,13 @@ public class StartRoutineAckDiscoveryMessage extends AbstractContinuousMessage {
}
/**
+ * @return Update counters for partitions per each node.
+ */
+ public Map<UUID, Map<Integer, Long>> updateCountersPerNode() {
+ return updateCntrsPerNode;
+ }
+
+ /**
* @return Errs.
*/
public Map<UUID, IgniteCheckedException> errs() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/49725e9d/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineDiscoveryMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineDiscoveryMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineDiscoveryMessage.java
index ff037d4..24eb050 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineDiscoveryMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/StartRoutineDiscoveryMessage.java
@@ -40,6 +40,9 @@ public class StartRoutineDiscoveryMessage extends AbstractContinuousMessage {
/** */
private Map<Integer, Long> updateCntrs;
+ /** */
+ private Map<UUID, Map<Integer, Long>> updateCntrsPerNode;
+
/** Keep binary flag. */
private boolean keepBinary;
@@ -72,7 +75,7 @@ public class StartRoutineDiscoveryMessage extends AbstractContinuousMessage {
/**
* @param cntrs Update counters.
*/
- public void addUpdateCounters(Map<Integer, Long> cntrs) {
+ private void addUpdateCounters(Map<Integer, Long> cntrs) {
if (updateCntrs == null)
updateCntrs = new HashMap<>();
@@ -86,6 +89,21 @@ public class StartRoutineDiscoveryMessage extends AbstractContinuousMessage {
}
/**
+ * @param nodeId Local node ID.
+ * @param cntrs Update counters.
+ */
+ public void addUpdateCounters(UUID nodeId, Map<Integer, Long> cntrs) {
+ addUpdateCounters(cntrs);
+
+ if (updateCntrsPerNode == null)
+ updateCntrsPerNode = new HashMap<>();
+
+ Map<Integer, Long> old = updateCntrsPerNode.put(nodeId, cntrs);
+
+ assert old == null : old;
+ }
+
+ /**
* @return Errs.
*/
public Map<UUID, IgniteCheckedException> errs() {
@@ -106,7 +124,7 @@ public class StartRoutineDiscoveryMessage extends AbstractContinuousMessage {
/** {@inheritDoc} */
@Override public DiscoveryCustomMessage ackMessage() {
- return new StartRoutineAckDiscoveryMessage(routineId, errs, updateCntrs);
+ return new StartRoutineAckDiscoveryMessage(routineId, errs, updateCntrs, updateCntrsPerNode);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/49725e9d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryLostPartitionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryLostPartitionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryLostPartitionTest.java
index f4659dc..025dd80 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryLostPartitionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryLostPartitionTest.java
@@ -140,8 +140,6 @@ public class CacheContinuousQueryLostPartitionTest extends GridCommonAbstractTes
// node2 now becomes the primary for the key.
stopGrid(0);
- awaitPartitionMapExchange();
-
cache2.put(key, "2");
// Sanity check.
http://git-wip-us.apache.org/repos/asf/ignite/blob/49725e9d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java
new file mode 100644
index 0000000..29b351b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryConcurrentTest.java
@@ -0,0 +1,466 @@
+/*
+ * 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.query.continuous;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.configuration.CacheEntryListenerConfiguration;
+import javax.cache.configuration.FactoryBuilder.SingletonFactory;
+import javax.cache.configuration.MutableCacheEntryListenerConfiguration;
+import javax.cache.event.CacheEntryCreatedListener;
+import javax.cache.event.CacheEntryEvent;
+import javax.cache.event.CacheEntryEventFilter;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.future.IgniteFinishedFutureImpl;
+import org.apache.ignite.internal.util.future.IgniteFutureImpl;
+import org.apache.ignite.internal.util.typedef.PA;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteInClosure;
+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 org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static java.util.concurrent.Executors.newSingleThreadExecutor;
+import static java.util.concurrent.TimeUnit.MINUTES;
+import static javax.cache.configuration.FactoryBuilder.factoryOf;
+
+/**
+ *
+ */
+public class GridCacheContinuousQueryConcurrentTest extends GridCommonAbstractTest {
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final int NODES = 2;
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ startGridsMultiThreaded(NODES);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+
+ super.afterTestsStopped();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ cfg.setPeerClassLoadingEnabled(false);
+
+ if (gridName.endsWith(String.valueOf(NODES)))
+ cfg.setClientMode(ThreadLocalRandom.current().nextBoolean());
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplicatedTx() throws Exception {
+ testRegistration(cacheConfiguration(CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL, 1));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartReplicated() throws Exception {
+ testRestartRegistration(cacheConfiguration(CacheMode.REPLICATED, CacheAtomicityMode.ATOMIC, 2));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartPartition() throws Exception {
+ testRestartRegistration(cacheConfiguration(CacheMode.PARTITIONED, CacheAtomicityMode.ATOMIC, 2));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartPartitionTx() throws Exception {
+ testRestartRegistration(cacheConfiguration(CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL, 2));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testReplicatedAtomic() throws Exception {
+ testRegistration(cacheConfiguration(CacheMode.REPLICATED, CacheAtomicityMode.ATOMIC, 2));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPartitionTx() throws Exception {
+ testRegistration(cacheConfiguration(CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL, 2));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testPartitionAtomic() throws Exception {
+ testRegistration(cacheConfiguration(CacheMode.PARTITIONED, CacheAtomicityMode.ATOMIC, 2));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRegistration(CacheConfiguration ccfg) throws Exception {
+ ExecutorService execSrv = newSingleThreadExecutor();
+
+ try {
+ final IgniteCache<Integer, String> cache = grid(0).getOrCreateCache(ccfg);
+
+ for (int i = 0; i < 10; i++) {
+ log.info("Start iteration: " + i);
+
+ final int i0 = i;
+ final AtomicBoolean stop = new AtomicBoolean(false);
+ final CountDownLatch latch = new CountDownLatch(1);
+ final int conQryCnt = 50;
+
+ Future<List<IgniteFuture<String>>> fut = execSrv.submit(
+ new Callable<List<IgniteFuture<String>>>() {
+ @Override public List<IgniteFuture<String>> call() throws Exception {
+ int count = 0;
+ List<IgniteFuture<String>> futures = new ArrayList<>();
+
+ while (!stop.get()) {
+ futures.add(waitForKey(i0, cache, count));
+
+ if (log.isDebugEnabled())
+ log.debug("Started cont query count: " + count);
+
+ if (++count >= conQryCnt)
+ latch.countDown();
+ }
+
+ return futures;
+ }
+ });
+
+ assert U.await(latch, 1, MINUTES);
+
+ cache.put(i, "v");
+
+ stop.set(true);
+
+ List<IgniteFuture<String>> contQries = fut.get();
+
+ for (IgniteFuture<String> contQry : contQries)
+ contQry.get(2, TimeUnit.SECONDS);
+ }
+ }
+ finally {
+ execSrv.shutdownNow();
+
+ grid(0).destroyCache(ccfg.getName());
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testRestartRegistration(CacheConfiguration ccfg) throws Exception {
+ ExecutorService execSrv = newSingleThreadExecutor();
+
+ final AtomicBoolean stopRes = new AtomicBoolean(false);
+
+ IgniteInternalFuture<?> restartFut = null;
+
+ try {
+ final IgniteCache<Integer, String> cache = grid(0).getOrCreateCache(ccfg);
+
+ restartFut = GridTestUtils.runAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ while (!stopRes.get()) {
+ startGrid(NODES);
+
+ assert GridTestUtils.waitForCondition(new PA() {
+ @Override public boolean apply() {
+ return grid(0).cluster().nodes().size() == NODES + 1;
+ }
+ }, 5000L);
+
+ Thread.sleep(300);
+
+ stopGrid(NODES);
+
+ assert GridTestUtils.waitForCondition(new PA() {
+ @Override public boolean apply() {
+ return grid(0).cluster().nodes().size() == NODES;
+ }
+ }, 5000L);
+
+ Thread.sleep(300);
+ }
+
+ return null;
+ }
+ });
+
+ U.sleep(100);
+
+ for (int i = 0; i < 10; i++) {
+ log.info("Start iteration: " + i);
+
+ final int i0 = i;
+ final AtomicBoolean stop = new AtomicBoolean(false);
+ final CountDownLatch latch = new CountDownLatch(1);
+ final int conQryCnt = 50;
+
+ Future<List<IgniteFuture<String>>> fut = execSrv.submit(
+ new Callable<List<IgniteFuture<String>>>() {
+ @Override public List<IgniteFuture<String>> call() throws Exception {
+ int count = 0;
+ List<IgniteFuture<String>> futures = new ArrayList<>();
+
+ while (!stop.get()) {
+ futures.add(waitForKey(i0, cache, count));
+
+ if (log.isDebugEnabled())
+ log.debug("Started cont query count: " + count);
+
+ if (++count >= conQryCnt)
+ latch.countDown();
+ }
+
+ return futures;
+ }
+ });
+
+ latch.await();
+
+ cache.put(i, "v");
+
+ assertEquals("v", cache.get(i));
+
+ stop.set(true);
+
+ List<IgniteFuture<String>> contQries = fut.get();
+
+ for (IgniteFuture<String> contQry : contQries)
+ contQry.get(5, TimeUnit.SECONDS);
+ }
+ }
+ finally {
+ execSrv.shutdownNow();
+
+ grid(0).destroyCache(ccfg.getName());
+
+ if (restartFut != null) {
+ stopRes.set(true);
+
+ restartFut.get();
+
+ stopGrid(NODES);
+ }
+ }
+ }
+
+ /**
+ * @param key Key
+ * @param cache Cache.
+ * @param id ID.
+ * @return Future.
+ */
+ public IgniteFuture<String> waitForKey(Integer key, final IgniteCache<Integer, String> cache, final int id) {
+ String v = cache.get(key);
+
+ // From now on, all futures will be completed immediately (since the key has been
+ // inserted).
+ if (v != null)
+ return new IgniteFinishedFutureImpl<>("immediately");
+
+ final IgniteFuture<String> promise = new IgniteFutureImpl<>(new GridFutureAdapter<String>());
+
+ final CacheEntryListenerConfiguration<Integer, String> cfg =
+ createCacheListener(key, promise, id);
+
+ promise.listen(new IgniteInClosure<IgniteFuture<String>>() {
+ @Override public void apply(IgniteFuture<String> future) {
+ GridTestUtils.runAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ cache.deregisterCacheEntryListener(cfg);
+
+ return null;
+ }
+ });
+ }
+ });
+
+ // Start listening.
+ // Assumption: When the call returns, the listener is guaranteed to have been registered.
+ cache.registerCacheEntryListener(cfg);
+
+ // Now must check the cache again, to make sure that we didn't miss the key insert while we
+ // were busy setting up the cache listener.
+ // Check asynchronously.
+ IgniteCache<Integer, String> asyncCache = cache.withAsync();
+ asyncCache.get(key);
+
+ // Complete the promise if the key was inserted concurrently.
+ asyncCache.<String>future().listen(new IgniteInClosure<IgniteFuture<String>>() {
+ @Override public void apply(IgniteFuture<String> f) {
+ String value = f.get();
+
+ if (value != null) {
+ log.info("Completed by get: " + id);
+
+ (((GridFutureAdapter)((IgniteFutureImpl)promise).internalFuture())).onDone("by get");
+ }
+ }
+ });
+
+ return promise;
+ }
+
+ /**
+ * @param key Key.
+ * @param result Result.
+ * @param id Listener ID.
+ * @return Listener
+ */
+ private CacheEntryListenerConfiguration<Integer, String> createCacheListener(
+ Integer key,
+ IgniteFuture<String> result,
+ int id) {
+ return new MutableCacheEntryListenerConfiguration<>(
+ factoryOf(new CacheListener(result, id)),
+ new SingletonFactory<>(new KeyEventFilter(key, id)), false, true);
+ }
+
+
+
+ /**
+ * @param cacheMode Cache mode.
+ * @param atomicMode Atomicy mode.
+ * @param backups Backups.
+ * @return Cache configuration.
+ */
+ private CacheConfiguration<Integer, String> cacheConfiguration(CacheMode cacheMode,
+ CacheAtomicityMode atomicMode, int backups) {
+ CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>("test-" + cacheMode + atomicMode + backups);
+
+ cfg.setCacheMode(cacheMode);
+ cfg.setAtomicityMode(atomicMode);
+ cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
+ cfg.setBackups(backups);
+ cfg.setReadFromBackup(false);
+
+ return cfg;
+ }
+
+ /**
+ *
+ */
+ private static class CacheListener implements CacheEntryCreatedListener<Integer, String>, Serializable {
+ /** */
+ final IgniteFuture<String> result;
+
+ /** */
+ private final int id;
+
+ /**
+ * @param result Result.
+ * @param id ID.
+ */
+ CacheListener(IgniteFuture<String> result, int id) {
+ this.result = result;
+ this.id = id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onCreated(Iterable<CacheEntryEvent<? extends Integer, ? extends String>> evts) {
+ (((GridFutureAdapter)((IgniteFutureImpl)result).internalFuture())).onDone("by listener");
+ }
+ }
+
+ /**
+ *
+ */
+ private static class KeyEventFilter implements CacheEntryEventFilter<Integer, String>, Serializable {
+ /** */
+ private static final long serialVersionUID = 42L;
+
+ /** */
+ private final Object key;
+
+ /** */
+ private final int id;
+
+ /**
+ * @param key Key.
+ * @param id ID.
+ */
+ KeyEventFilter(Object key, int id) {
+ this.key = key;
+ this.id = id;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean evaluate(CacheEntryEvent<? extends Integer, ? extends String> e) {
+ return e.getKey().equals(key);
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || !(o == null || getClass() != o.getClass())
+ && key.equals(((KeyEventFilter) o).key);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return key.hashCode();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/49725e9d/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 083af1e..0aa3560 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -93,6 +93,7 @@ import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheCon
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicOffheapValuesTest;
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicP2PDisabledSelfTest;
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicSelfTest;
+import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryConcurrentTest;
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryLocalAtomicSelfTest;
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryLocalSelfTest;
import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryPartitionAtomicOneNodeTest;
@@ -228,6 +229,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
suite.addTestSuite(CacheContinuousQueryFailoverTxOffheapTieredTest.class);
suite.addTestSuite(CacheContinuousQueryRandomOperationsTest.class);
suite.addTestSuite(CacheContinuousQueryFactoryFilterTest.class);
+ suite.addTestSuite(GridCacheContinuousQueryConcurrentTest.class);
suite.addTestSuite(CacheContinuousQueryOperationP2PTest.class);
suite.addTestSuite(CacheContinuousBatchAckTest.class);
suite.addTestSuite(CacheContinuousBatchForceServerModeAckTest.class);
[12/25] ignite git commit: Added ability to dump comm SPI recovery
descriptors (cherry picked from commit f76a313)
Posted by dm...@apache.org.
Added ability to dump comm SPI recovery descriptors
(cherry picked from commit f76a313)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/61a0a5f8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/61a0a5f8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/61a0a5f8
Branch: refs/heads/ignite-2849
Commit: 61a0a5f8c0d05001071d40fbaf365fa231ed0e70
Parents: 046a188
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Mar 22 15:58:49 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Mar 22 16:00:25 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/util/nio/GridNioServer.java | 13 ++++++++-----
.../spi/communication/tcp/TcpCommunicationSpi.java | 16 ++++++++++++++++
2 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/61a0a5f8/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 42c7ac7..0d5c5de 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
@@ -1455,16 +1455,19 @@ public class GridNioServer<T> {
for (SelectionKey key : keys) {
GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
- sb.append(" Conn [")
+ sb.append(" Connection info [")
.append("rmtAddr=").append(ses.remoteAddress())
.append(", locAddr=").append(ses.localAddress())
.append(", bytesRcvd=").append(ses.bytesReceived())
.append(", bytesSent=").append(ses.bytesSent());
- if (ses.recoveryDescriptor() != null) {
- sb.append(", msgsSent=").append(ses.recoveryDescriptor().sent())
- .append(", msgsAckedByRmt=").append(ses.recoveryDescriptor().acked())
- .append(", msgsRcvd=").append(ses.recoveryDescriptor().received());
+ GridNioRecoveryDescriptor desc = ses.recoveryDescriptor();
+
+ if (desc != null) {
+ sb.append(", msgsSent=").append(desc.sent())
+ .append(", msgsAckedByRmt=").append(desc.acked())
+ .append(", msgsRcvd=").append(desc.received())
+ .append(", descIdHash=").append(System.identityHashCode(desc));
}
else
sb.append(", recoveryDesc=null");
http://git-wip-us.apache.org/repos/asf/ignite/blob/61a0a5f8/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 b283b82..df60982 100644
--- 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
@@ -1381,6 +1381,22 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
/** {@inheritDoc} */
@Override public void dumpStats() {
+ StringBuilder sb = new StringBuilder("Communication SPI recovery descriptors: ").append(U.nl());
+
+ for (Map.Entry<ClientKey, 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(", descIdHash=").append(System.identityHashCode(desc))
+ .append(']').append(U.nl());
+ }
+
+ if (log.isInfoEnabled())
+ log.info(sb.toString());
+
GridNioServer<Message> nioSrvr1 = nioSrvr;
if (nioSrvr1 != null)
[06/25] ignite git commit: IGNITE-2811: IGFS: Optimized properties
handling.
Posted by dm...@apache.org.
IGNITE-2811: IGFS: Optimized properties handling.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5f7a46e3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5f7a46e3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5f7a46e3
Branch: refs/heads/ignite-2849
Commit: 5f7a46e3e85c6e3121592c7e2a57d8f7ee30828e
Parents: f0fe3e0
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Mar 22 10:28:13 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Mar 22 10:28:13 2016 +0300
----------------------------------------------------------------------
.../internal/processors/igfs/IgfsEntryInfo.java | 8 +-
.../ignite/internal/processors/igfs/IgfsEx.java | 12 --
.../internal/processors/igfs/IgfsImpl.java | 2 +-
.../processors/igfs/IgfsOutputStreamImpl.java | 2 +-
.../internal/processors/igfs/IgfsUtils.java | 113 +++++++++++++++++++
.../meta/IgfsMetaDirectoryCreateProcessor.java | 8 +-
.../igfs/meta/IgfsMetaFileCreateProcessor.java | 8 +-
.../meta/IgfsMetaUpdatePropertiesProcessor.java | 5 +-
.../processors/igfs/IgfsAbstractSelfTest.java | 20 ++--
.../igfs/IgfsDualAbstractSelfTest.java | 13 ++-
.../processors/igfs/IgfsStreamsSelfTest.java | 2 +-
.../fs/IgniteHadoopIgfsSecondaryFileSystem.java | 8 +-
.../hadoop/fs/v1/IgniteHadoopFileSystem.java | 19 ++--
.../hadoop/fs/v2/IgniteHadoopFileSystem.java | 21 ++--
.../hadoop/igfs/HadoopIgfsProperties.java | 11 +-
...oopFileSystemUniversalFileSystemAdapter.java | 8 +-
.../processors/hadoop/HadoopMapReduceTest.java | 5 +-
17 files changed, 187 insertions(+), 78 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
index d31ef72..45cf828 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEntryInfo.java
@@ -314,7 +314,9 @@ public abstract class IgfsEntryInfo implements Externalizable {
*/
protected void writeBinary(BinaryRawWriter out) {
BinaryUtils.writeIgniteUuid(out, id);
- out.writeMap(props);
+
+ IgfsUtils.writeProperties(out, props);
+
out.writeLong(accessTime);
out.writeLong(modificationTime);
out.writeObject(path);
@@ -327,7 +329,9 @@ public abstract class IgfsEntryInfo implements Externalizable {
*/
protected void readBinary(BinaryRawReader in) {
id = BinaryUtils.readIgniteUuid(in);
- props = in.readMap();
+
+ props = IgfsUtils.readProperties(in);
+
accessTime = in.readLong();
modificationTime = in.readLong();
path = in.readObject();
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEx.java
index cf268e0..fb67e20 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEx.java
@@ -31,18 +31,6 @@ import org.jetbrains.annotations.Nullable;
* Internal API extension for {@link org.apache.ignite.IgniteFileSystem}.
*/
public interface IgfsEx extends IgniteFileSystem {
- /** File property: user name. */
- public static final String PROP_USER_NAME = "usrName";
-
- /** File property: group name. */
- public static final String PROP_GROUP_NAME = "grpName";
-
- /** File property: permission. */
- public static final String PROP_PERMISSION = "permission";
-
- /** File property: prefer writes to local node. */
- public static final String PROP_PREFER_LOCAL_WRITES = "locWrite";
-
/**
* Stops IGFS cleaning all used resources.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 398428a..e3a82a5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -121,7 +121,7 @@ public final class IgfsImpl implements IgfsEx {
private static final String PERMISSION_DFLT_VAL = "0777";
/** Default directory metadata. */
- static final Map<String, String> DFLT_DIR_META = F.asMap(PROP_PERMISSION, PERMISSION_DFLT_VAL);
+ static final Map<String, String> DFLT_DIR_META = F.asMap(IgfsUtils.PROP_PERMISSION, PERMISSION_DFLT_VAL);
/** Handshake message. */
private final IgfsPaths secondaryPaths;
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
index ef2826b..f7c85e8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsOutputStreamImpl.java
@@ -412,7 +412,7 @@ class IgfsOutputStreamImpl extends IgfsOutputStreamAdapter {
if (!igfsCtx.configuration().isFragmentizerEnabled())
return null;
- if (!Boolean.parseBoolean(fileInfo.properties().get(IgfsEx.PROP_PREFER_LOCAL_WRITES)))
+ if (!Boolean.parseBoolean(fileInfo.properties().get(IgfsUtils.PROP_PREFER_LOCAL_WRITES)))
return null;
int blockSize = fileInfo.blockSize();
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
index 94e1cef..9b813b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsUtils.java
@@ -46,6 +46,7 @@ import org.apache.ignite.transactions.Transaction;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Constructor;
+import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
@@ -67,6 +68,33 @@ public class IgfsUtils {
/** Constant trash concurrency level. */
public static final int TRASH_CONCURRENCY = 64;
+ /** File property: user name. */
+ public static final String PROP_USER_NAME = "usrName";
+
+ /** File property: group name. */
+ public static final String PROP_GROUP_NAME = "grpName";
+
+ /** File property: permission. */
+ public static final String PROP_PERMISSION = "permission";
+
+ /** File property: prefer writes to local node. */
+ public static final String PROP_PREFER_LOCAL_WRITES = "locWrite";
+
+ /** Generic property index. */
+ private static final byte PROP_IDX = 0;
+
+ /** User name property index. */
+ private static final byte PROP_USER_NAME_IDX = 1;
+
+ /** Group name property index. */
+ private static final byte PROP_GROUP_NAME_IDX = 2;
+
+ /** Permission property index. */
+ private static final byte PROP_PERMISSION_IDX = 3;
+
+ /** Prefer local writes property index. */
+ private static final byte PROP_PREFER_LOCAL_WRITES_IDX = 4;
+
/** Trash directory IDs. */
private static final IgniteUuid[] TRASH_IDS;
@@ -427,4 +455,89 @@ public class IgfsUtils {
else
return null;
}
+
+ /**
+ * Write entry properties. Rely on reference equality for well-known properties.
+ *
+ * @param out Writer.
+ * @param props Properties.
+ */
+ @SuppressWarnings("StringEquality")
+ public static void writeProperties(BinaryRawWriter out, @Nullable Map<String, String> props) {
+ if (props != null) {
+ out.writeInt(props.size());
+
+ for (Map.Entry<String, String> entry : props.entrySet()) {
+ String key = entry.getKey();
+
+ if (key == PROP_PERMISSION)
+ out.writeByte(PROP_PERMISSION_IDX);
+ else if (key == PROP_PREFER_LOCAL_WRITES)
+ out.writeByte(PROP_PREFER_LOCAL_WRITES_IDX);
+ else if (key == PROP_USER_NAME)
+ out.writeByte(PROP_USER_NAME_IDX);
+ else if (key == PROP_GROUP_NAME)
+ out.writeByte(PROP_GROUP_NAME_IDX);
+ else {
+ out.writeByte(PROP_IDX);
+ out.writeString(key);
+ }
+
+ out.writeString(entry.getValue());
+ }
+ }
+ else
+ out.writeInt(-1);
+ }
+
+ /**
+ * Read entry properties.
+ *
+ * @param in Reader.
+ * @return Properties.
+ */
+ @Nullable public static Map<String, String> readProperties(BinaryRawReader in) {
+ int size = in.readInt();
+
+ if (size >= 0) {
+ Map<String, String> props = new HashMap<>(size);
+
+ for (int i = 0; i < size; i++) {
+ byte idx = in.readByte();
+
+ String key;
+
+ switch (idx) {
+ case PROP_PERMISSION_IDX:
+ key = PROP_PERMISSION;
+
+ break;
+
+ case PROP_PREFER_LOCAL_WRITES_IDX:
+ key = PROP_PREFER_LOCAL_WRITES;
+
+ break;
+
+ case PROP_USER_NAME_IDX:
+ key = PROP_USER_NAME;
+
+ break;
+
+ case PROP_GROUP_NAME_IDX:
+ key = PROP_GROUP_NAME;
+
+ break;
+
+ default:
+ key = in.readString();
+ }
+
+ props.put(key, in.readString());
+ }
+
+ return props;
+ }
+ else
+ return null;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
index 907019c..5f4fe73 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaDirectoryCreateProcessor.java
@@ -144,7 +144,9 @@ public class IgfsMetaDirectoryCreateProcessor implements EntryProcessor<IgniteUu
BinaryRawWriter out = writer.rawWriter();
out.writeLong(createTime);
- out.writeMap(props);
+
+ IgfsUtils.writeProperties(out, props);
+
out.writeString(childName);
if (childName != null)
@@ -156,7 +158,9 @@ public class IgfsMetaDirectoryCreateProcessor implements EntryProcessor<IgniteUu
BinaryRawReader in = reader.rawReader();
createTime = in.readLong();
- props = in.readMap();
+
+ props = IgfsUtils.readProperties(in);
+
childName = in.readString();
if (childName != null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
index 41745f1..9fd16aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaFileCreateProcessor.java
@@ -138,7 +138,9 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
BinaryRawWriter out = writer.rawWriter();
out.writeLong(createTime);
- out.writeMap(props);
+
+ IgfsUtils.writeProperties(out, props);
+
out.writeInt(blockSize);
BinaryUtils.writeIgniteUuid(out, affKey);
BinaryUtils.writeIgniteUuid(out, lockId);
@@ -150,7 +152,9 @@ public class IgfsMetaFileCreateProcessor implements EntryProcessor<IgniteUuid, I
BinaryRawReader in = reader.rawReader();
createTime = in.readLong();
- props = in.readMap();
+
+ props = IgfsUtils.readProperties(in);
+
blockSize = in.readInt();
affKey = BinaryUtils.readIgniteUuid(in);
lockId = BinaryUtils.readIgniteUuid(in);
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
index fb4466b..e0d5b8b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/meta/IgfsMetaUpdatePropertiesProcessor.java
@@ -24,6 +24,7 @@ import org.apache.ignite.binary.BinaryReader;
import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.internal.processors.igfs.IgfsEntryInfo;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
import org.apache.ignite.internal.util.GridLeanMap;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -104,14 +105,14 @@ public class IgfsMetaUpdatePropertiesProcessor implements EntryProcessor<IgniteU
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
BinaryRawWriter out = writer.rawWriter();
- out.writeMap(props);
+ IgfsUtils.writeProperties(out, props);
}
/** {@inheritDoc} */
@Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
BinaryRawReader in = reader.rawReader();
- props = in.readMap();
+ props = IgfsUtils.readProperties(in);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index edec572..5894fa2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -86,9 +86,6 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
import static org.apache.ignite.cache.CacheMode.REPLICATED;
import static org.apache.ignite.igfs.IgfsMode.PRIMARY;
import static org.apache.ignite.igfs.IgfsMode.PROXY;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_GROUP_NAME;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_PERMISSION;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_USER_NAME;
/**
* Test fo regular igfs operations.
@@ -803,10 +800,12 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
if (dual)
// Check only permissions because user and group will always be present in Hadoop Fs.
- assertEquals(props.get(PROP_PERMISSION), igfsSecondary.properties(SUBSUBDIR.toString()).get(PROP_PERMISSION));
+ assertEquals(props.get(IgfsUtils.PROP_PERMISSION),
+ igfsSecondary.properties(SUBSUBDIR.toString()).get(IgfsUtils.PROP_PERMISSION));
// We check only permission because IGFS client adds username and group name explicitly.
- assertEquals(props.get(PROP_PERMISSION), igfs.info(SUBSUBDIR).properties().get(PROP_PERMISSION));
+ assertEquals(props.get(IgfsUtils.PROP_PERMISSION),
+ igfs.info(SUBSUBDIR).properties().get(IgfsUtils.PROP_PERMISSION));
}
/**
@@ -824,10 +823,11 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
if (dual)
// check permission only since Hadoop Fs will always have user and group:
- assertEquals(props.get(PROP_PERMISSION), igfsSecondary.properties(DIR.toString()).get(PROP_PERMISSION));
+ assertEquals(props.get(IgfsUtils.PROP_PERMISSION),
+ igfsSecondary.properties(DIR.toString()).get(IgfsUtils.PROP_PERMISSION));
// We check only permission because IGFS client adds username and group name explicitly.
- assertEquals(props.get(PROP_PERMISSION), igfs.info(DIR).properties().get(PROP_PERMISSION));
+ assertEquals(props.get(IgfsUtils.PROP_PERMISSION), igfs.info(DIR).properties().get(IgfsUtils.PROP_PERMISSION));
}
/**
@@ -3026,13 +3026,13 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest {
Map<String, String> props = new HashMap<>();
if (username != null)
- props.put(PROP_USER_NAME, username);
+ props.put(IgfsUtils.PROP_USER_NAME, username);
if (grpName != null)
- props.put(PROP_GROUP_NAME, grpName);
+ props.put(IgfsUtils.PROP_GROUP_NAME, grpName);
if (perm != null)
- props.put(PROP_PERMISSION, perm);
+ props.put(IgfsUtils.PROP_PERMISSION, perm);
return props;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
index 6e13280..b8c8978 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java
@@ -39,7 +39,6 @@ import java.util.concurrent.CyclicBarrier;
import static org.apache.ignite.igfs.IgfsMode.DUAL_ASYNC;
import static org.apache.ignite.igfs.IgfsMode.DUAL_SYNC;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_PERMISSION;
/**
* Tests for IGFS working in mode when remote file system exists: DUAL_SYNC, DUAL_ASYNC.
@@ -973,10 +972,12 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
checkExist(igfs, igfsSecondary, SUBSUBDIR);
// Check only permissions because user and group will always be present in Hadoop secondary filesystem.
- assertEquals(props.get(PROP_PERMISSION), igfsSecondary.properties(SUBSUBDIR.toString()).get(PROP_PERMISSION));
+ assertEquals(props.get(IgfsUtils.PROP_PERMISSION),
+ igfsSecondary.properties(SUBSUBDIR.toString()).get(IgfsUtils.PROP_PERMISSION));
// We check only permission because IGFS client adds username and group name explicitly.
- assertEquals(props.get(PROP_PERMISSION), igfs.info(SUBSUBDIR).properties().get(PROP_PERMISSION));
+ assertEquals(props.get(IgfsUtils.PROP_PERMISSION),
+ igfs.info(SUBSUBDIR).properties().get(IgfsUtils.PROP_PERMISSION));
}
/**
@@ -998,10 +999,12 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest {
checkExist(igfs, igfsSecondary, SUBSUBDIR);
// Check only permission because in case of Hadoop secondary Fs user and group will always be present:
- assertEquals(props.get(PROP_PERMISSION), igfsSecondary.properties(SUBSUBDIR.toString()).get(PROP_PERMISSION));
+ assertEquals(props.get(IgfsUtils.PROP_PERMISSION),
+ igfsSecondary.properties(SUBSUBDIR.toString()).get(IgfsUtils.PROP_PERMISSION));
// We check only permission because IGFS client adds username and group name explicitly.
- assertEquals(props.get(PROP_PERMISSION), igfs.info(SUBSUBDIR).properties().get(PROP_PERMISSION));
+ assertEquals(props.get(IgfsUtils.PROP_PERMISSION),
+ igfs.info(SUBSUBDIR).properties().get(IgfsUtils.PROP_PERMISSION));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
index 7b7078f..724e80a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
@@ -254,7 +254,7 @@ public class IgfsStreamsSelfTest extends IgfsCommonAbstractTest {
IgniteFileSystem fs2 = grid(2).fileSystem("igfs");
try (IgfsOutputStream out = fs0.create(path, 128, false, 1, CFG_GRP_SIZE,
- F.asMap(IgfsEx.PROP_PREFER_LOCAL_WRITES, "true"))) {
+ F.asMap(IgfsUtils.PROP_PREFER_LOCAL_WRITES, "true"))) {
// 1.5 blocks
byte[] data = new byte[CFG_BLOCK_SIZE * 3 / 2];
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
index 7a4648a..dfd4611 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
@@ -60,10 +60,6 @@ import java.util.Collections;
import java.util.Map;
import java.util.concurrent.Callable;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_GROUP_NAME;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_PERMISSION;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_USER_NAME;
-
/**
* Secondary file system which delegates calls to an instance of Hadoop {@link FileSystem}.
* <p>
@@ -238,8 +234,8 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
if (perm == null)
perm = FsPermission.getDefault();
- return F.asMap(PROP_PERMISSION, String.format("%04o", perm.toShort()), PROP_USER_NAME, status.getOwner(),
- PROP_GROUP_NAME, status.getGroup());
+ return F.asMap(IgfsUtils.PROP_PERMISSION, String.format("%04o", perm.toShort()), IgfsUtils.PROP_USER_NAME,
+ status.getOwner(), IgfsUtils.PROP_GROUP_NAME, status.getGroup());
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
index 45b968c..83991aa 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
@@ -86,10 +86,6 @@ import static org.apache.ignite.internal.processors.hadoop.fs.HadoopParameters.P
import static org.apache.ignite.internal.processors.hadoop.fs.HadoopParameters.PARAM_IGFS_SEQ_READS_BEFORE_PREFETCH;
import static org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsUtils.parameter;
import static org.apache.ignite.internal.processors.igfs.IgfsEx.IGFS_SCHEME;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_GROUP_NAME;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_PERMISSION;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_PREFER_LOCAL_WRITES;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_USER_NAME;
/**
* {@code IGFS} Hadoop 1.x file system driver over file system API. To use
@@ -509,9 +505,12 @@ public class IgniteHadoopFileSystem extends FileSystem {
}
secondaryFs.setOwner(toSecondary(p), username, grpName);
- } else if (rmtClient.update(convert(p), F.asMap(PROP_USER_NAME, username, PROP_GROUP_NAME, grpName)) == null)
+ }
+ else if (rmtClient.update(convert(p), F.asMap(IgfsUtils.PROP_USER_NAME, username,
+ IgfsUtils.PROP_GROUP_NAME, grpName)) == null) {
throw new IOException("Failed to set file permission (file not found?)" +
" [path=" + p + ", userName=" + username + ", groupName=" + grpName + ']');
+ }
}
finally {
leaveBusy();
@@ -627,7 +626,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
else {
Map<String,String> propMap = permission(perm);
- propMap.put(PROP_PREFER_LOCAL_WRITES, Boolean.toString(preferLocFileWrites));
+ propMap.put(IgfsUtils.PROP_PREFER_LOCAL_WRITES, Boolean.toString(preferLocFileWrites));
// Create stream and close it in the 'finally' section if any sequential operation failed.
HadoopIgfsStreamDelegate stream = rmtClient.create(path, overwrite, colocateFileWrites,
@@ -1282,8 +1281,8 @@ public class IgniteHadoopFileSystem extends FileSystem {
file.modificationTime(),
file.accessTime(),
permission(file),
- file.property(PROP_USER_NAME, user),
- file.property(PROP_GROUP_NAME, "users"),
+ file.property(IgfsUtils.PROP_USER_NAME, user),
+ file.property(IgfsUtils.PROP_GROUP_NAME, "users"),
convert(file.path())) {
@Override public String toString() {
return "FileStatus [path=" + getPath() + ", isDir=" + isDir() + ", len=" + getLen() +
@@ -1302,7 +1301,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
if (perm == null)
perm = FsPermission.getDefault();
- return F.asMap(PROP_PERMISSION, toString(perm));
+ return F.asMap(IgfsUtils.PROP_PERMISSION, toString(perm));
}
/**
@@ -1320,7 +1319,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
* @return Hadoop permission.
*/
private FsPermission permission(IgfsFile file) {
- String perm = file.property(PROP_PERMISSION, null);
+ String perm = file.property(IgfsUtils.PROP_PERMISSION, null);
if (perm == null)
return FsPermission.getDefault();
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
index ac457a4..66255c9 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
@@ -57,6 +57,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsHandshakeResponse;
import org.apache.ignite.internal.processors.igfs.IgfsModeResolver;
import org.apache.ignite.internal.processors.igfs.IgfsPaths;
import org.apache.ignite.internal.processors.igfs.IgfsStatus;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.A;
@@ -94,10 +95,6 @@ import static org.apache.ignite.internal.processors.hadoop.fs.HadoopParameters.P
import static org.apache.ignite.internal.processors.hadoop.fs.HadoopParameters.PARAM_IGFS_SEQ_READS_BEFORE_PREFETCH;
import static org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsUtils.parameter;
import static org.apache.ignite.internal.processors.igfs.IgfsEx.IGFS_SCHEME;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_GROUP_NAME;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_PERMISSION;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_PREFER_LOCAL_WRITES;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_USER_NAME;
/**
* {@code IGFS} Hadoop 2.x file system driver over file system API. To use
@@ -463,9 +460,11 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
try {
if (mode(p) == PROXY)
secondaryFileSystem().setOwner(toSecondary(p), usr, grp);
- else if (rmtClient.update(convert(p), F.asMap(PROP_USER_NAME, usr, PROP_GROUP_NAME, grp)) == null)
+ else if (rmtClient.update(convert(p), F.asMap(IgfsUtils.PROP_USER_NAME, usr,
+ IgfsUtils.PROP_GROUP_NAME, grp)) == null) {
throw new IOException("Failed to set file permission (file not found?)" +
" [path=" + p + ", username=" + usr + ", grpName=" + grp + ']');
+ }
}
finally {
leaveBusy();
@@ -579,8 +578,8 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
return os;
}
else {
- Map<String, String> permMap = F.asMap(PROP_PERMISSION, toString(perm),
- PROP_PREFER_LOCAL_WRITES, Boolean.toString(preferLocFileWrites));
+ Map<String, String> permMap = F.asMap(IgfsUtils.PROP_PERMISSION, toString(perm),
+ IgfsUtils.PROP_PREFER_LOCAL_WRITES, Boolean.toString(preferLocFileWrites));
// Create stream and close it in the 'finally' section if any sequential operation failed.
HadoopIgfsStreamDelegate stream;
@@ -1002,8 +1001,8 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
file.modificationTime(),
file.accessTime(),
permission(file),
- file.property(PROP_USER_NAME, user),
- file.property(PROP_GROUP_NAME, "users"),
+ file.property(IgfsUtils.PROP_USER_NAME, user),
+ file.property(IgfsUtils.PROP_GROUP_NAME, "users"),
convert(file.path())) {
@Override public String toString() {
return "FileStatus [path=" + getPath() + ", isDir=" + isDirectory() + ", len=" + getLen() + "]";
@@ -1021,7 +1020,7 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
if (perm == null)
perm = FsPermission.getDefault();
- return F.asMap(PROP_PERMISSION, toString(perm));
+ return F.asMap(IgfsUtils.PROP_PERMISSION, toString(perm));
}
/**
@@ -1039,7 +1038,7 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
* @return Hadoop permission.
*/
private FsPermission permission(IgfsFile file) {
- String perm = file.property(PROP_PERMISSION, null);
+ String perm = file.property(IgfsUtils.PROP_PERMISSION, null);
if (perm == null)
return FsPermission.getDefault();
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsProperties.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsProperties.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsProperties.java
index c8929a3..90f6bca 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsProperties.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/igfs/HadoopIgfsProperties.java
@@ -20,10 +20,7 @@ package org.apache.ignite.internal.processors.hadoop.igfs;
import java.util.Map;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.ignite.IgniteException;
-
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_GROUP_NAME;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_PERMISSION;
-import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_USER_NAME;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
/**
* Hadoop file system properties.
@@ -45,10 +42,10 @@ public class HadoopIgfsProperties {
* @throws IgniteException In case of error.
*/
public HadoopIgfsProperties(Map<String, String> props) throws IgniteException {
- usrName = props.get(PROP_USER_NAME);
- grpName = props.get(PROP_GROUP_NAME);
+ usrName = props.get(IgfsUtils.PROP_USER_NAME);
+ grpName = props.get(IgfsUtils.PROP_GROUP_NAME);
- String permStr = props.get(PROP_PERMISSION);
+ String permStr = props.get(IgfsUtils.PROP_PERMISSION);
if (permStr != null) {
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopFileSystemUniversalFileSystemAdapter.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopFileSystemUniversalFileSystemAdapter.java b/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopFileSystemUniversalFileSystemAdapter.java
index 5b6fd81..44b8f40 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopFileSystemUniversalFileSystemAdapter.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/igfs/HadoopFileSystemUniversalFileSystemAdapter.java
@@ -29,7 +29,7 @@ import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.hadoop.fs.HadoopFileSystemFactory;
import org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsUtils;
-import org.apache.ignite.internal.processors.igfs.IgfsEx;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
import org.apache.ignite.internal.processors.igfs.UniversalFileSystemAdapter;
/**
@@ -84,12 +84,12 @@ public class HadoopFileSystemUniversalFileSystemAdapter implements UniversalFile
Map<String,String> m = new HashMap<>(3); // max size == 4
- m.put(IgfsEx.PROP_USER_NAME, status.getOwner());
- m.put(IgfsEx.PROP_GROUP_NAME, status.getGroup());
+ m.put(IgfsUtils.PROP_USER_NAME, status.getOwner());
+ m.put(IgfsUtils.PROP_GROUP_NAME, status.getGroup());
FsPermission perm = status.getPermission();
- m.put(IgfsEx.PROP_PERMISSION, "0" + perm.getUserAction().ordinal() + perm.getGroupAction().ordinal() +
+ m.put(IgfsUtils.PROP_PERMISSION, "0" + perm.getUserAction().ordinal() + perm.getGroupAction().ordinal() +
perm.getOtherAction().ordinal());
return m;
http://git-wip-us.apache.org/repos/asf/ignite/blob/5f7a46e3/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
index 7fd8272..4426847 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopMapReduceTest.java
@@ -52,6 +52,7 @@ import org.apache.ignite.internal.processors.hadoop.counter.HadoopPerformanceCou
import org.apache.ignite.internal.processors.hadoop.examples.HadoopWordCount1;
import org.apache.ignite.internal.processors.hadoop.examples.HadoopWordCount2;
import org.apache.ignite.internal.processors.igfs.IgfsEx;
+import org.apache.ignite.internal.processors.igfs.IgfsUtils;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.T2;
@@ -110,7 +111,7 @@ public class HadoopMapReduceTest extends HadoopAbstractWordCountTest {
* @return The owner.
*/
private static String getOwner(IgfsEx i, IgfsPath p) {
- return i.info(p).property(IgfsEx.PROP_USER_NAME);
+ return i.info(p).property(IgfsUtils.PROP_USER_NAME);
}
/**
@@ -122,7 +123,7 @@ public class HadoopMapReduceTest extends HadoopAbstractWordCountTest {
private static String getOwnerSecondary(final IgfsSecondaryFileSystem secFs, final IgfsPath p) {
return IgfsUserContext.doAs(USER, new IgniteOutClosure<String>() {
@Override public String apply() {
- return secFs.info(p).property(IgfsEx.PROP_USER_NAME);
+ return secFs.info(p).property(IgfsUtils.PROP_USER_NAME);
}
});
}