You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2017/09/05 08:52:42 UTC
[01/23] ignite git commit: IGNITE-6233 .NET: Extract type codes to a
separate class
Repository: ignite
Updated Branches:
refs/heads/ignite-5896 50f6bdcb2 -> 4f8f08522
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/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 73b4136..f59f17c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -75,7 +75,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Boolean value.</param>
public void WriteBoolean(string fieldName, bool val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeBool);
+ WriteFieldId(fieldName, BinaryTypeId.Bool);
WriteBooleanField(val);
}
@@ -85,7 +85,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">if set to <c>true</c> [value].</param>
internal void WriteBooleanField(bool val)
{
- _stream.WriteByte(BinaryUtils.TypeBool);
+ _stream.WriteByte(BinaryTypeId.Bool);
_stream.WriteBool(val);
}
@@ -105,13 +105,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Boolean array.</param>
public void WriteBooleanArray(string fieldName, bool[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayBool);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayBool);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayBool);
+ _stream.WriteByte(BinaryTypeId.ArrayBool);
BinaryUtils.WriteBooleanArray(val, _stream);
}
}
@@ -126,7 +126,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayBool);
+ _stream.WriteByte(BinaryTypeId.ArrayBool);
BinaryUtils.WriteBooleanArray(val, _stream);
}
}
@@ -138,7 +138,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Byte value.</param>
public void WriteByte(string fieldName, byte val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeByte);
+ WriteFieldId(fieldName, BinaryTypeId.Byte);
WriteByteField(val);
}
@@ -148,7 +148,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Byte value.</param>
internal void WriteByteField(byte val)
{
- _stream.WriteByte(BinaryUtils.TypeByte);
+ _stream.WriteByte(BinaryTypeId.Byte);
_stream.WriteByte(val);
}
@@ -168,13 +168,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Byte array.</param>
public void WriteByteArray(string fieldName, byte[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayByte);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayByte);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayByte);
+ _stream.WriteByte(BinaryTypeId.ArrayByte);
BinaryUtils.WriteByteArray(val, _stream);
}
}
@@ -189,7 +189,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayByte);
+ _stream.WriteByte(BinaryTypeId.ArrayByte);
BinaryUtils.WriteByteArray(val, _stream);
}
}
@@ -201,7 +201,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Short value.</param>
public void WriteShort(string fieldName, short val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeShort);
+ WriteFieldId(fieldName, BinaryTypeId.Short);
WriteShortField(val);
}
@@ -211,7 +211,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Short value.</param>
internal void WriteShortField(short val)
{
- _stream.WriteByte(BinaryUtils.TypeShort);
+ _stream.WriteByte(BinaryTypeId.Short);
_stream.WriteShort(val);
}
@@ -231,13 +231,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Short array.</param>
public void WriteShortArray(string fieldName, short[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayShort);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayShort);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayShort);
+ _stream.WriteByte(BinaryTypeId.ArrayShort);
BinaryUtils.WriteShortArray(val, _stream);
}
}
@@ -252,7 +252,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayShort);
+ _stream.WriteByte(BinaryTypeId.ArrayShort);
BinaryUtils.WriteShortArray(val, _stream);
}
}
@@ -264,7 +264,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Char value.</param>
public void WriteChar(string fieldName, char val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeChar);
+ WriteFieldId(fieldName, BinaryTypeId.Char);
WriteCharField(val);
}
@@ -274,7 +274,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Char value.</param>
internal void WriteCharField(char val)
{
- _stream.WriteByte(BinaryUtils.TypeChar);
+ _stream.WriteByte(BinaryTypeId.Char);
_stream.WriteChar(val);
}
@@ -294,13 +294,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Char array.</param>
public void WriteCharArray(string fieldName, char[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayChar);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayChar);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayChar);
+ _stream.WriteByte(BinaryTypeId.ArrayChar);
BinaryUtils.WriteCharArray(val, _stream);
}
}
@@ -315,7 +315,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayChar);
+ _stream.WriteByte(BinaryTypeId.ArrayChar);
BinaryUtils.WriteCharArray(val, _stream);
}
}
@@ -327,7 +327,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Int value.</param>
public void WriteInt(string fieldName, int val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeInt);
+ WriteFieldId(fieldName, BinaryTypeId.Int);
WriteIntField(val);
}
@@ -337,7 +337,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">The value.</param>
internal void WriteIntField(int val)
{
- _stream.WriteByte(BinaryUtils.TypeInt);
+ _stream.WriteByte(BinaryTypeId.Int);
_stream.WriteInt(val);
}
@@ -357,13 +357,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Int array.</param>
public void WriteIntArray(string fieldName, int[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayInt);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayInt);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayInt);
+ _stream.WriteByte(BinaryTypeId.ArrayInt);
BinaryUtils.WriteIntArray(val, _stream);
}
}
@@ -378,7 +378,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayInt);
+ _stream.WriteByte(BinaryTypeId.ArrayInt);
BinaryUtils.WriteIntArray(val, _stream);
}
}
@@ -390,7 +390,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Long value.</param>
public void WriteLong(string fieldName, long val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeLong);
+ WriteFieldId(fieldName, BinaryTypeId.Long);
WriteLongField(val);
}
@@ -400,7 +400,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">The value.</param>
internal void WriteLongField(long val)
{
- _stream.WriteByte(BinaryUtils.TypeLong);
+ _stream.WriteByte(BinaryTypeId.Long);
_stream.WriteLong(val);
}
@@ -420,13 +420,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Long array.</param>
public void WriteLongArray(string fieldName, long[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayLong);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayLong);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayLong);
+ _stream.WriteByte(BinaryTypeId.ArrayLong);
BinaryUtils.WriteLongArray(val, _stream);
}
}
@@ -441,7 +441,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayLong);
+ _stream.WriteByte(BinaryTypeId.ArrayLong);
BinaryUtils.WriteLongArray(val, _stream);
}
}
@@ -453,7 +453,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Float value.</param>
public void WriteFloat(string fieldName, float val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeFloat);
+ WriteFieldId(fieldName, BinaryTypeId.Float);
WriteFloatField(val);
}
@@ -463,7 +463,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">The value.</param>
internal void WriteFloatField(float val)
{
- _stream.WriteByte(BinaryUtils.TypeFloat);
+ _stream.WriteByte(BinaryTypeId.Float);
_stream.WriteFloat(val);
}
@@ -483,13 +483,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Float array.</param>
public void WriteFloatArray(string fieldName, float[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayFloat);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayFloat);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayFloat);
+ _stream.WriteByte(BinaryTypeId.ArrayFloat);
BinaryUtils.WriteFloatArray(val, _stream);
}
}
@@ -504,7 +504,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayFloat);
+ _stream.WriteByte(BinaryTypeId.ArrayFloat);
BinaryUtils.WriteFloatArray(val, _stream);
}
}
@@ -516,7 +516,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Double value.</param>
public void WriteDouble(string fieldName, double val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeDouble);
+ WriteFieldId(fieldName, BinaryTypeId.Double);
WriteDoubleField(val);
}
@@ -526,7 +526,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">The value.</param>
internal void WriteDoubleField(double val)
{
- _stream.WriteByte(BinaryUtils.TypeDouble);
+ _stream.WriteByte(BinaryTypeId.Double);
_stream.WriteDouble(val);
}
@@ -546,13 +546,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Double array.</param>
public void WriteDoubleArray(string fieldName, double[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayDouble);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayDouble);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayDouble);
+ _stream.WriteByte(BinaryTypeId.ArrayDouble);
BinaryUtils.WriteDoubleArray(val, _stream);
}
}
@@ -567,7 +567,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayDouble);
+ _stream.WriteByte(BinaryTypeId.ArrayDouble);
BinaryUtils.WriteDoubleArray(val, _stream);
}
}
@@ -579,13 +579,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Decimal value.</param>
public void WriteDecimal(string fieldName, decimal? val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeDecimal);
+ WriteFieldId(fieldName, BinaryTypeId.Decimal);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeDecimal);
+ _stream.WriteByte(BinaryTypeId.Decimal);
BinaryUtils.WriteDecimal(val.Value, _stream);
}
}
@@ -600,7 +600,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeDecimal);
+ _stream.WriteByte(BinaryTypeId.Decimal);
BinaryUtils.WriteDecimal(val.Value, _stream);
}
}
@@ -612,13 +612,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Decimal array.</param>
public void WriteDecimalArray(string fieldName, decimal?[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayDecimal);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayDecimal);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayDecimal);
+ _stream.WriteByte(BinaryTypeId.ArrayDecimal);
BinaryUtils.WriteDecimalArray(val, _stream);
}
}
@@ -633,7 +633,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayDecimal);
+ _stream.WriteByte(BinaryTypeId.ArrayDecimal);
BinaryUtils.WriteDecimalArray(val, _stream);
}
}
@@ -645,13 +645,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Date value.</param>
public void WriteTimestamp(string fieldName, DateTime? val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeTimestamp);
+ WriteFieldId(fieldName, BinaryTypeId.Timestamp);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeTimestamp);
+ _stream.WriteByte(BinaryTypeId.Timestamp);
BinaryUtils.WriteTimestamp(val.Value, _stream);
}
}
@@ -666,7 +666,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeTimestamp);
+ _stream.WriteByte(BinaryTypeId.Timestamp);
BinaryUtils.WriteTimestamp(val.Value, _stream);
}
}
@@ -678,13 +678,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Date array.</param>
public void WriteTimestampArray(string fieldName, DateTime?[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeTimestamp);
+ WriteFieldId(fieldName, BinaryTypeId.Timestamp);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayTimestamp);
+ _stream.WriteByte(BinaryTypeId.ArrayTimestamp);
BinaryUtils.WriteTimestampArray(val, _stream);
}
}
@@ -699,7 +699,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayTimestamp);
+ _stream.WriteByte(BinaryTypeId.ArrayTimestamp);
BinaryUtils.WriteTimestampArray(val, _stream);
}
}
@@ -711,13 +711,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">String value.</param>
public void WriteString(string fieldName, string val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeString);
+ WriteFieldId(fieldName, BinaryTypeId.String);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeString);
+ _stream.WriteByte(BinaryTypeId.String);
BinaryUtils.WriteString(val, _stream);
}
}
@@ -732,7 +732,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeString);
+ _stream.WriteByte(BinaryTypeId.String);
BinaryUtils.WriteString(val, _stream);
}
}
@@ -744,13 +744,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">String array.</param>
public void WriteStringArray(string fieldName, string[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayString);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayString);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayString);
+ _stream.WriteByte(BinaryTypeId.ArrayString);
BinaryUtils.WriteStringArray(val, _stream);
}
}
@@ -765,7 +765,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayString);
+ _stream.WriteByte(BinaryTypeId.ArrayString);
BinaryUtils.WriteStringArray(val, _stream);
}
}
@@ -777,13 +777,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">GUID value.</param>
public void WriteGuid(string fieldName, Guid? val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeGuid);
+ WriteFieldId(fieldName, BinaryTypeId.Guid);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeGuid);
+ _stream.WriteByte(BinaryTypeId.Guid);
BinaryUtils.WriteGuid(val.Value, _stream);
}
}
@@ -798,7 +798,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeGuid);
+ _stream.WriteByte(BinaryTypeId.Guid);
BinaryUtils.WriteGuid(val.Value, _stream);
}
}
@@ -810,13 +810,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">GUID array.</param>
public void WriteGuidArray(string fieldName, Guid?[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayGuid);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayGuid);
if (val == null)
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayGuid);
+ _stream.WriteByte(BinaryTypeId.ArrayGuid);
BinaryUtils.WriteGuidArray(val, _stream);
}
}
@@ -831,7 +831,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullRawField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayGuid);
+ _stream.WriteByte(BinaryTypeId.ArrayGuid);
BinaryUtils.WriteGuidArray(val, _stream);
}
}
@@ -844,7 +844,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Enum value.</param>
public void WriteEnum<T>(string fieldName, T val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeEnum);
+ WriteFieldId(fieldName, BinaryTypeId.Enum);
WriteEnum(val);
}
@@ -895,7 +895,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
var desc = _marsh.GetDescriptor(type);
- _stream.WriteByte(BinaryUtils.TypeEnum);
+ _stream.WriteByte(BinaryTypeId.Enum);
_stream.WriteInt(desc.TypeId);
_stream.WriteInt(val);
@@ -911,7 +911,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Enum array.</param>
public void WriteEnumArray<T>(string fieldName, T[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArrayEnum);
+ WriteFieldId(fieldName, BinaryTypeId.ArrayEnum);
WriteEnumArray(val);
}
@@ -937,7 +937,7 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullField();
else
{
- _stream.WriteByte(BinaryUtils.TypeArrayEnum);
+ _stream.WriteByte(BinaryTypeId.ArrayEnum);
BinaryUtils.WriteArray(val, this, elementTypeId);
}
@@ -951,7 +951,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Object value.</param>
public void WriteObject<T>(string fieldName, T val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeObject);
+ WriteFieldId(fieldName, BinaryTypeId.Object);
// ReSharper disable once CompareNonConstrainedGenericWithNull
if (val == null)
@@ -978,7 +978,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Object array.</param>
public void WriteArray<T>(string fieldName, T[] val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeArray);
+ WriteFieldId(fieldName, BinaryTypeId.Array);
WriteArray(val);
}
@@ -1006,7 +1006,7 @@ namespace Apache.Ignite.Core.Impl.Binary
if (WriteHandle(_stream.Position, val))
return;
- _stream.WriteByte(BinaryUtils.TypeArray);
+ _stream.WriteByte(BinaryTypeId.Array);
BinaryUtils.WriteArray(val, this);
}
}
@@ -1018,7 +1018,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Collection.</param>
public void WriteCollection(string fieldName, ICollection val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeCollection);
+ WriteFieldId(fieldName, BinaryTypeId.Collection);
WriteCollection(val);
}
@@ -1036,7 +1036,7 @@ namespace Apache.Ignite.Core.Impl.Binary
if (WriteHandle(_stream.Position, val))
return;
- WriteByte(BinaryUtils.TypeCollection);
+ WriteByte(BinaryTypeId.Collection);
BinaryUtils.WriteCollection(val, this);
}
}
@@ -1048,7 +1048,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="val">Dictionary.</param>
public void WriteDictionary(string fieldName, IDictionary val)
{
- WriteFieldId(fieldName, BinaryUtils.TypeDictionary);
+ WriteFieldId(fieldName, BinaryTypeId.Dictionary);
WriteDictionary(val);
}
@@ -1066,7 +1066,7 @@ namespace Apache.Ignite.Core.Impl.Binary
if (WriteHandle(_stream.Position, val))
return;
- WriteByte(BinaryUtils.TypeDictionary);
+ WriteByte(BinaryTypeId.Dictionary);
BinaryUtils.WriteDictionary(val, this);
}
}
@@ -1264,7 +1264,7 @@ namespace Apache.Ignite.Core.Impl.Binary
var hashCode = BinaryArrayEqualityComparer.GetHashCode(Stream, pos + BinaryObjectHeader.Size,
dataEnd - pos - BinaryObjectHeader.Size);
- var header = new BinaryObjectHeader(desc.IsRegistered ? desc.TypeId : BinaryUtils.TypeUnregistered,
+ var header = new BinaryObjectHeader(desc.IsRegistered ? desc.TypeId : BinaryTypeId.Unregistered,
hashCode, len, schemaId, schemaOffset, flags);
BinaryObjectHeader.Write(header, _stream, pos);
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index d78276d..1f11e9e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -720,22 +720,22 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
private void AddSystemTypes()
{
- AddSystemType(BinaryUtils.TypeNativeJobHolder, r => new ComputeJobHolder(r));
- AddSystemType(BinaryUtils.TypeComputeJobWrapper, r => new ComputeJobWrapper(r));
- AddSystemType(BinaryUtils.TypeComputeOutFuncJob, r => new ComputeOutFuncJob(r));
- AddSystemType(BinaryUtils.TypeComputeOutFuncWrapper, r => new ComputeOutFuncWrapper(r));
- AddSystemType(BinaryUtils.TypeComputeFuncWrapper, r => new ComputeFuncWrapper(r));
- AddSystemType(BinaryUtils.TypeComputeFuncJob, r => new ComputeFuncJob(r));
- AddSystemType(BinaryUtils.TypeComputeActionJob, r => new ComputeActionJob(r));
- AddSystemType(BinaryUtils.TypeContinuousQueryRemoteFilterHolder, r => new ContinuousQueryFilterHolder(r));
- AddSystemType(BinaryUtils.TypeCacheEntryProcessorHolder, r => new CacheEntryProcessorHolder(r));
- AddSystemType(BinaryUtils.TypeCacheEntryPredicateHolder, r => new CacheEntryFilterHolder(r));
- AddSystemType(BinaryUtils.TypeMessageListenerHolder, r => new MessageListenerHolder(r));
- AddSystemType(BinaryUtils.TypeStreamReceiverHolder, r => new StreamReceiverHolder(r));
+ AddSystemType(BinaryTypeId.NativeJobHolder, r => new ComputeJobHolder(r));
+ AddSystemType(BinaryTypeId.ComputeJobWrapper, r => new ComputeJobWrapper(r));
+ AddSystemType(BinaryTypeId.ComputeOutFuncJob, r => new ComputeOutFuncJob(r));
+ AddSystemType(BinaryTypeId.ComputeOutFuncWrapper, r => new ComputeOutFuncWrapper(r));
+ AddSystemType(BinaryTypeId.ComputeFuncWrapper, r => new ComputeFuncWrapper(r));
+ AddSystemType(BinaryTypeId.ComputeFuncJob, r => new ComputeFuncJob(r));
+ AddSystemType(BinaryTypeId.ComputeActionJob, r => new ComputeActionJob(r));
+ AddSystemType(BinaryTypeId.ContinuousQueryRemoteFilterHolder, r => new ContinuousQueryFilterHolder(r));
+ AddSystemType(BinaryTypeId.CacheEntryProcessorHolder, r => new CacheEntryProcessorHolder(r));
+ AddSystemType(BinaryTypeId.CacheEntryPredicateHolder, r => new CacheEntryFilterHolder(r));
+ AddSystemType(BinaryTypeId.MessageListenerHolder, r => new MessageListenerHolder(r));
+ AddSystemType(BinaryTypeId.StreamReceiverHolder, r => new StreamReceiverHolder(r));
AddSystemType(0, r => new AffinityKey(r), "affKey");
- AddSystemType(BinaryUtils.TypePlatformJavaObjectFactoryProxy, r => new PlatformJavaObjectFactoryProxy());
+ AddSystemType(BinaryTypeId.PlatformJavaObjectFactoryProxy, r => new PlatformJavaObjectFactoryProxy());
AddSystemType(0, r => new ObjectInfoHolder(r));
- AddSystemType(BinaryUtils.TypeIgniteUuid, r => new IgniteGuid(r));
+ AddSystemType(BinaryTypeId.IgniteUuid, r => new IgniteGuid(r));
AddSystemType(0, r => new GetAssemblyFunc());
AddSystemType(0, r => new AssemblyRequest(r));
AddSystemType(0, r => new AssemblyRequestResult(r));
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
index db54ce7..7306474 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
@@ -32,7 +32,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
{
/** Empty metadata. */
public static readonly BinaryType Empty =
- new BinaryType(BinaryUtils.TypeObject, BinaryTypeNames.TypeNameObject, null, null, false, null, null);
+ new BinaryType(BinaryTypeId.Object, BinaryTypeNames.TypeNameObject, null, null, false, null, null);
/** Empty dictionary. */
private static readonly IDictionary<string, BinaryField> EmptyDict = new Dictionary<string, BinaryField>();
@@ -77,36 +77,36 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
Justification = "Readability.")]
static BinaryType()
{
- TypeNames[BinaryUtils.TypeBool] = BinaryTypeNames.TypeNameBool;
- TypeNames[BinaryUtils.TypeByte] = BinaryTypeNames.TypeNameByte;
- TypeNames[BinaryUtils.TypeShort] = BinaryTypeNames.TypeNameShort;
- TypeNames[BinaryUtils.TypeChar] = BinaryTypeNames.TypeNameChar;
- TypeNames[BinaryUtils.TypeInt] = BinaryTypeNames.TypeNameInt;
- TypeNames[BinaryUtils.TypeLong] = BinaryTypeNames.TypeNameLong;
- TypeNames[BinaryUtils.TypeFloat] = BinaryTypeNames.TypeNameFloat;
- TypeNames[BinaryUtils.TypeDouble] = BinaryTypeNames.TypeNameDouble;
- TypeNames[BinaryUtils.TypeDecimal] = BinaryTypeNames.TypeNameDecimal;
- TypeNames[BinaryUtils.TypeString] = BinaryTypeNames.TypeNameString;
- TypeNames[BinaryUtils.TypeGuid] = BinaryTypeNames.TypeNameGuid;
- TypeNames[BinaryUtils.TypeTimestamp] = BinaryTypeNames.TypeNameTimestamp;
- TypeNames[BinaryUtils.TypeEnum] = BinaryTypeNames.TypeNameEnum;
- TypeNames[BinaryUtils.TypeObject] = BinaryTypeNames.TypeNameObject;
- TypeNames[BinaryUtils.TypeArrayBool] = BinaryTypeNames.TypeNameArrayBool;
- TypeNames[BinaryUtils.TypeArrayByte] = BinaryTypeNames.TypeNameArrayByte;
- TypeNames[BinaryUtils.TypeArrayShort] = BinaryTypeNames.TypeNameArrayShort;
- TypeNames[BinaryUtils.TypeArrayChar] = BinaryTypeNames.TypeNameArrayChar;
- TypeNames[BinaryUtils.TypeArrayInt] = BinaryTypeNames.TypeNameArrayInt;
- TypeNames[BinaryUtils.TypeArrayLong] = BinaryTypeNames.TypeNameArrayLong;
- TypeNames[BinaryUtils.TypeArrayFloat] = BinaryTypeNames.TypeNameArrayFloat;
- TypeNames[BinaryUtils.TypeArrayDouble] = BinaryTypeNames.TypeNameArrayDouble;
- TypeNames[BinaryUtils.TypeArrayDecimal] = BinaryTypeNames.TypeNameArrayDecimal;
- TypeNames[BinaryUtils.TypeArrayString] = BinaryTypeNames.TypeNameArrayString;
- TypeNames[BinaryUtils.TypeArrayGuid] = BinaryTypeNames.TypeNameArrayGuid;
- TypeNames[BinaryUtils.TypeArrayTimestamp] = BinaryTypeNames.TypeNameArrayTimestamp;
- TypeNames[BinaryUtils.TypeArrayEnum] = BinaryTypeNames.TypeNameArrayEnum;
- TypeNames[BinaryUtils.TypeArray] = BinaryTypeNames.TypeNameArrayObject;
- TypeNames[BinaryUtils.TypeCollection] = BinaryTypeNames.TypeNameCollection;
- TypeNames[BinaryUtils.TypeDictionary] = BinaryTypeNames.TypeNameMap;
+ TypeNames[BinaryTypeId.Bool] = BinaryTypeNames.TypeNameBool;
+ TypeNames[BinaryTypeId.Byte] = BinaryTypeNames.TypeNameByte;
+ TypeNames[BinaryTypeId.Short] = BinaryTypeNames.TypeNameShort;
+ TypeNames[BinaryTypeId.Char] = BinaryTypeNames.TypeNameChar;
+ TypeNames[BinaryTypeId.Int] = BinaryTypeNames.TypeNameInt;
+ TypeNames[BinaryTypeId.Long] = BinaryTypeNames.TypeNameLong;
+ TypeNames[BinaryTypeId.Float] = BinaryTypeNames.TypeNameFloat;
+ TypeNames[BinaryTypeId.Double] = BinaryTypeNames.TypeNameDouble;
+ TypeNames[BinaryTypeId.Decimal] = BinaryTypeNames.TypeNameDecimal;
+ TypeNames[BinaryTypeId.String] = BinaryTypeNames.TypeNameString;
+ TypeNames[BinaryTypeId.Guid] = BinaryTypeNames.TypeNameGuid;
+ TypeNames[BinaryTypeId.Timestamp] = BinaryTypeNames.TypeNameTimestamp;
+ TypeNames[BinaryTypeId.Enum] = BinaryTypeNames.TypeNameEnum;
+ TypeNames[BinaryTypeId.Object] = BinaryTypeNames.TypeNameObject;
+ TypeNames[BinaryTypeId.ArrayBool] = BinaryTypeNames.TypeNameArrayBool;
+ TypeNames[BinaryTypeId.ArrayByte] = BinaryTypeNames.TypeNameArrayByte;
+ TypeNames[BinaryTypeId.ArrayShort] = BinaryTypeNames.TypeNameArrayShort;
+ TypeNames[BinaryTypeId.ArrayChar] = BinaryTypeNames.TypeNameArrayChar;
+ TypeNames[BinaryTypeId.ArrayInt] = BinaryTypeNames.TypeNameArrayInt;
+ TypeNames[BinaryTypeId.ArrayLong] = BinaryTypeNames.TypeNameArrayLong;
+ TypeNames[BinaryTypeId.ArrayFloat] = BinaryTypeNames.TypeNameArrayFloat;
+ TypeNames[BinaryTypeId.ArrayDouble] = BinaryTypeNames.TypeNameArrayDouble;
+ TypeNames[BinaryTypeId.ArrayDecimal] = BinaryTypeNames.TypeNameArrayDecimal;
+ TypeNames[BinaryTypeId.ArrayString] = BinaryTypeNames.TypeNameArrayString;
+ TypeNames[BinaryTypeId.ArrayGuid] = BinaryTypeNames.TypeNameArrayGuid;
+ TypeNames[BinaryTypeId.ArrayTimestamp] = BinaryTypeNames.TypeNameArrayTimestamp;
+ TypeNames[BinaryTypeId.ArrayEnum] = BinaryTypeNames.TypeNameArrayEnum;
+ TypeNames[BinaryTypeId.Array] = BinaryTypeNames.TypeNameArrayObject;
+ TypeNames[BinaryTypeId.Collection] = BinaryTypeNames.TypeNameCollection;
+ TypeNames[BinaryTypeId.Dictionary] = BinaryTypeNames.TypeNameMap;
}
/// <summary>
[18/23] ignite git commit: ignite-5999 : Fixed calculation of moving
partitions count.
Posted by pt...@apache.org.
ignite-5999 : Fixed calculation of moving partitions count.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a2a90268
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a2a90268
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a2a90268
Branch: refs/heads/ignite-5896
Commit: a2a90268410340506aa9468f13c045dae78dc40a
Parents: 872a959
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Fri Sep 1 14:25:34 2017 +0300
Committer: Andrey Gura <ag...@apache.org>
Committed: Mon Sep 4 17:46:23 2017 +0300
----------------------------------------------------------------------
.../dht/preloader/GridDhtPartitionMap.java | 24 ++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a2a90268/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
index 410caf6..5173a01 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
@@ -24,6 +24,7 @@ import java.io.ObjectOutput;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
@@ -55,6 +56,10 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
/** */
private volatile int moving;
+ /** */
+ private static final AtomicIntegerFieldUpdater<GridDhtPartitionMap> MOVING_FIELD_UPDATER =
+ AtomicIntegerFieldUpdater.newUpdater(GridDhtPartitionMap.class, "moving");
+
/**
* Empty constructor required for {@link Externalizable}.
*/
@@ -82,6 +87,16 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
this.top = top;
map = new GridPartitionStateMap(m, onlyActive);
+
+ int moving0 = 0;
+
+ for (GridDhtPartitionState state : map.values()) {
+ if (state == MOVING)
+ moving0++;
+ }
+
+ if (moving0 > 0)
+ MOVING_FIELD_UPDATER.set(this, moving0);
}
/**
@@ -121,11 +136,12 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
public void put(Integer part, GridDhtPartitionState state) {
GridDhtPartitionState old = map.put(part, state);
- if (old == MOVING)
- moving--;
+ if (old == MOVING && state != MOVING)
+ MOVING_FIELD_UPDATER.decrementAndGet(this);
+ else if (old != MOVING && state == MOVING)
+ MOVING_FIELD_UPDATER.incrementAndGet(this);
- if (state == MOVING)
- moving++;
+ assert moving >= 0 : moving;
}
/**
[02/23] ignite git commit: IGNITE-6233 .NET: Extract type codes to a
separate class
Posted by pt...@apache.org.
IGNITE-6233 .NET: Extract type codes to a separate class
This closes #2570
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/55e0b5c9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/55e0b5c9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/55e0b5c9
Branch: refs/heads/ignite-5896
Commit: 55e0b5c9bf3b0b12ed930dbffea8e5bfced1ef18
Parents: 5738d7e
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Sep 1 11:49:48 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Sep 1 11:49:48 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.csproj | 1 +
.../Impl/Binary/BinaryObjectBuilder.cs | 132 +++++------
.../Impl/Binary/BinaryObjectSchemaSerializer.cs | 2 +-
.../Impl/Binary/BinaryProcessor.cs | 2 +-
.../Impl/Binary/BinaryReader.cs | 110 ++++-----
.../Impl/Binary/BinarySystemHandlers.cs | 157 ++++---------
.../Impl/Binary/BinaryTypeId.cs | 228 +++++++++++++++++++
.../Impl/Binary/BinaryUtils.cs | 155 +------------
.../Impl/Binary/BinaryWriter.cs | 152 ++++++-------
.../Impl/Binary/Marshaller.cs | 28 +--
.../Impl/Binary/Metadata/BinaryType.cs | 62 ++---
11 files changed, 528 insertions(+), 501 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/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 ee301be..241e1c6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -99,6 +99,7 @@
<Compile Include="Cache\IMemoryMetrics.cs" />
<Compile Include="Common\ExceptionFactory.cs" />
<Compile Include="Configuration\Package-Info.cs" />
+ <Compile Include="Impl\Binary\BinaryTypeId.cs" />
<Compile Include="Impl\IIgniteInternal.cs" />
<Compile Include="Impl\IPlatformTargetInternal.cs" />
<Compile Include="Impl\PersistentStore\PersistentStoreMetrics.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
index c310b3a..fac7d18 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectBuilder.cs
@@ -124,209 +124,209 @@ namespace Apache.Ignite.Core.Impl.Binary
public IBinaryObjectBuilder SetField<T>(string fieldName, T val)
{
return SetField0(fieldName,
- new BinaryBuilderField(typeof (T), val, BinarySystemHandlers.GetTypeId(typeof (T))));
+ new BinaryBuilderField(typeof (T), val, BinaryTypeId.GetTypeId(typeof (T))));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetArrayField<T>(string fieldName, T[] val)
{
return SetField0(fieldName,
- new BinaryBuilderField(typeof (T[]), val, BinaryUtils.TypeArray, WriteArrayAction));
+ new BinaryBuilderField(typeof (T[]), val, BinaryTypeId.Array, WriteArrayAction));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetBooleanField(string fieldName, bool val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (bool), val, BinaryUtils.TypeBool,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (bool), val, BinaryTypeId.Bool,
(w, o) => w.WriteBooleanField((bool) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetBooleanArrayField(string fieldName, bool[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (bool[]), val, BinaryUtils.TypeArrayBool,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (bool[]), val, BinaryTypeId.ArrayBool,
(w, o) => w.WriteBooleanArray((bool[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetByteField(string fieldName, byte val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (byte), val, BinaryUtils.TypeByte,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (byte), val, BinaryTypeId.Byte,
(w, o) => w.WriteByteField((byte) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetByteArrayField(string fieldName, byte[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (byte[]), val, BinaryUtils.TypeArrayByte,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (byte[]), val, BinaryTypeId.ArrayByte,
(w, o) => w.WriteByteArray((byte[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetCharField(string fieldName, char val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (char), val, BinaryUtils.TypeChar,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (char), val, BinaryTypeId.Char,
(w, o) => w.WriteCharField((char) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetCharArrayField(string fieldName, char[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (char[]), val, BinaryUtils.TypeArrayChar,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (char[]), val, BinaryTypeId.ArrayChar,
(w, o) => w.WriteCharArray((char[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetCollectionField(string fieldName, ICollection val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (ICollection), val, BinaryUtils.TypeCollection,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (ICollection), val, BinaryTypeId.Collection,
WriteCollectionAction));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetDecimalField(string fieldName, decimal? val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (decimal?), val, BinaryUtils.TypeDecimal,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (decimal?), val, BinaryTypeId.Decimal,
(w, o) => w.WriteDecimal((decimal?) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetDecimalArrayField(string fieldName, decimal?[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (decimal?[]), val, BinaryUtils.TypeArrayDecimal,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (decimal?[]), val, BinaryTypeId.ArrayDecimal,
(w, o) => w.WriteDecimalArray((decimal?[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetDictionaryField(string fieldName, IDictionary val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (IDictionary), val, BinaryUtils.TypeDictionary,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (IDictionary), val, BinaryTypeId.Dictionary,
(w, o) => w.WriteDictionary((IDictionary) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetDoubleField(string fieldName, double val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (double), val, BinaryUtils.TypeDouble,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (double), val, BinaryTypeId.Double,
(w, o) => w.WriteDoubleField((double) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetDoubleArrayField(string fieldName, double[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (double[]), val, BinaryUtils.TypeArrayDouble,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (double[]), val, BinaryTypeId.ArrayDouble,
(w, o) => w.WriteDoubleArray((double[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetEnumField<T>(string fieldName, T val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (T), val, BinaryUtils.TypeEnum,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (T), val, BinaryTypeId.Enum,
(w, o) => w.WriteEnum((T) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetEnumArrayField<T>(string fieldName, T[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (T[]), val, BinaryUtils.TypeArrayEnum,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (T[]), val, BinaryTypeId.ArrayEnum,
(w, o) => w.WriteEnumArray((T[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetFloatField(string fieldName, float val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (float), val, BinaryUtils.TypeFloat,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (float), val, BinaryTypeId.Float,
(w, o) => w.WriteFloatField((float) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetFloatArrayField(string fieldName, float[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (float[]), val, BinaryUtils.TypeArrayFloat,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (float[]), val, BinaryTypeId.ArrayFloat,
(w, o) => w.WriteFloatArray((float[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetGuidField(string fieldName, Guid? val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (Guid?), val, BinaryUtils.TypeGuid,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (Guid?), val, BinaryTypeId.Guid,
(w, o) => w.WriteGuid((Guid?) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetGuidArrayField(string fieldName, Guid?[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (Guid?[]), val, BinaryUtils.TypeArrayGuid,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (Guid?[]), val, BinaryTypeId.ArrayGuid,
(w, o) => w.WriteGuidArray((Guid?[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetIntField(string fieldName, int val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (int), val, BinaryUtils.TypeInt,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (int), val, BinaryTypeId.Int,
(w, o) => w.WriteIntField((int) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetIntArrayField(string fieldName, int[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (int[]), val, BinaryUtils.TypeArrayInt,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (int[]), val, BinaryTypeId.ArrayInt,
(w, o) => w.WriteIntArray((int[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetLongField(string fieldName, long val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (long), val, BinaryUtils.TypeLong,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (long), val, BinaryTypeId.Long,
(w, o) => w.WriteLongField((long) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetLongArrayField(string fieldName, long[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (long[]), val, BinaryUtils.TypeArrayLong,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (long[]), val, BinaryTypeId.ArrayLong,
(w, o) => w.WriteLongArray((long[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetShortField(string fieldName, short val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (short), val, BinaryUtils.TypeShort,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (short), val, BinaryTypeId.Short,
(w, o) => w.WriteShortField((short) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetShortArrayField(string fieldName, short[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (short[]), val, BinaryUtils.TypeArrayShort,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (short[]), val, BinaryTypeId.ArrayShort,
(w, o) => w.WriteShortArray((short[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetStringField(string fieldName, string val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (string), val, BinaryUtils.TypeString,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (string), val, BinaryTypeId.String,
(w, o) => w.WriteString((string) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetStringArrayField(string fieldName, string[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (string[]), val, BinaryUtils.TypeArrayString,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (string[]), val, BinaryTypeId.ArrayString,
(w, o) => w.WriteStringArray((string[]) o)));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetTimestampField(string fieldName, DateTime? val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (DateTime?), val, BinaryUtils.TypeTimestamp,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (DateTime?), val, BinaryTypeId.Timestamp,
WriteTimestampAction));
}
/** <inheritDoc /> */
public IBinaryObjectBuilder SetTimestampArrayField(string fieldName, DateTime?[] val)
{
- return SetField0(fieldName, new BinaryBuilderField(typeof (DateTime?[]), val, BinaryUtils.TypeArrayTimestamp,
+ return SetField0(fieldName, new BinaryBuilderField(typeof (DateTime?[]), val, BinaryTypeId.ArrayTimestamp,
WriteTimestampArrayAction));
}
@@ -440,19 +440,19 @@ namespace Apache.Ignite.Core.Impl.Binary
switch (header)
{
- case BinaryUtils.TypeArray:
+ case BinaryTypeId.Array:
return WriteArrayAction;
- case BinaryUtils.TypeCollection:
+ case BinaryTypeId.Collection:
return WriteCollectionAction;
- case BinaryUtils.TypeTimestamp:
+ case BinaryTypeId.Timestamp:
return WriteTimestampAction;
- case BinaryUtils.TypeArrayTimestamp:
+ case BinaryTypeId.ArrayTimestamp:
return WriteTimestampArrayAction;
- case BinaryUtils.TypeArrayEnum:
+ case BinaryTypeId.ArrayEnum:
using (var stream = new BinaryHeapStream(_obj.Data))
{
stream.Seek(pos, SeekOrigin.Begin + 1);
@@ -826,47 +826,47 @@ namespace Apache.Ignite.Core.Impl.Binary
{
switch (hdr)
{
- case BinaryUtils.TypeByte:
+ case BinaryTypeId.Byte:
TransferBytes(inStream, outStream, 1);
break;
- case BinaryUtils.TypeShort:
+ case BinaryTypeId.Short:
TransferBytes(inStream, outStream, 2);
break;
- case BinaryUtils.TypeInt:
+ case BinaryTypeId.Int:
TransferBytes(inStream, outStream, 4);
break;
- case BinaryUtils.TypeLong:
+ case BinaryTypeId.Long:
TransferBytes(inStream, outStream, 8);
break;
- case BinaryUtils.TypeFloat:
+ case BinaryTypeId.Float:
TransferBytes(inStream, outStream, 4);
break;
- case BinaryUtils.TypeDouble:
+ case BinaryTypeId.Double:
TransferBytes(inStream, outStream, 8);
break;
- case BinaryUtils.TypeChar:
+ case BinaryTypeId.Char:
TransferBytes(inStream, outStream, 2);
break;
- case BinaryUtils.TypeBool:
+ case BinaryTypeId.Bool:
TransferBytes(inStream, outStream, 1);
break;
- case BinaryUtils.TypeDecimal:
+ case BinaryTypeId.Decimal:
TransferBytes(inStream, outStream, 4); // Transfer scale
int magLen = inStream.ReadInt(); // Transfer magnitude length.
@@ -877,65 +877,65 @@ namespace Apache.Ignite.Core.Impl.Binary
break;
- case BinaryUtils.TypeString:
+ case BinaryTypeId.String:
BinaryUtils.WriteString(BinaryUtils.ReadString(inStream), outStream);
break;
- case BinaryUtils.TypeGuid:
+ case BinaryTypeId.Guid:
TransferBytes(inStream, outStream, 16);
break;
- case BinaryUtils.TypeTimestamp:
+ case BinaryTypeId.Timestamp:
TransferBytes(inStream, outStream, 12);
break;
- case BinaryUtils.TypeArrayByte:
+ case BinaryTypeId.ArrayByte:
TransferArray(inStream, outStream, 1);
break;
- case BinaryUtils.TypeArrayShort:
+ case BinaryTypeId.ArrayShort:
TransferArray(inStream, outStream, 2);
break;
- case BinaryUtils.TypeArrayInt:
+ case BinaryTypeId.ArrayInt:
TransferArray(inStream, outStream, 4);
break;
- case BinaryUtils.TypeArrayLong:
+ case BinaryTypeId.ArrayLong:
TransferArray(inStream, outStream, 8);
break;
- case BinaryUtils.TypeArrayFloat:
+ case BinaryTypeId.ArrayFloat:
TransferArray(inStream, outStream, 4);
break;
- case BinaryUtils.TypeArrayDouble:
+ case BinaryTypeId.ArrayDouble:
TransferArray(inStream, outStream, 8);
break;
- case BinaryUtils.TypeArrayChar:
+ case BinaryTypeId.ArrayChar:
TransferArray(inStream, outStream, 2);
break;
- case BinaryUtils.TypeArrayBool:
+ case BinaryTypeId.ArrayBool:
TransferArray(inStream, outStream, 1);
break;
- case BinaryUtils.TypeArrayDecimal:
- case BinaryUtils.TypeArrayString:
- case BinaryUtils.TypeArrayGuid:
- case BinaryUtils.TypeArrayTimestamp:
+ case BinaryTypeId.ArrayDecimal:
+ case BinaryTypeId.ArrayString:
+ case BinaryTypeId.ArrayGuid:
+ case BinaryTypeId.ArrayTimestamp:
int arrLen = inStream.ReadInt();
outStream.WriteInt(arrLen);
@@ -945,13 +945,13 @@ namespace Apache.Ignite.Core.Impl.Binary
break;
- case BinaryUtils.TypeArrayEnum:
- case BinaryUtils.TypeArray:
+ case BinaryTypeId.ArrayEnum:
+ case BinaryTypeId.Array:
int type = inStream.ReadInt();
outStream.WriteInt(type);
- if (type == BinaryUtils.TypeUnregistered)
+ if (type == BinaryTypeId.Unregistered)
{
outStream.WriteByte(inStream.ReadByte()); // String header.
@@ -967,7 +967,7 @@ namespace Apache.Ignite.Core.Impl.Binary
break;
- case BinaryUtils.TypeCollection:
+ case BinaryTypeId.Collection:
int colLen = inStream.ReadInt();
outStream.WriteInt(colLen);
@@ -979,7 +979,7 @@ namespace Apache.Ignite.Core.Impl.Binary
break;
- case BinaryUtils.TypeDictionary:
+ case BinaryTypeId.Dictionary:
int dictLen = inStream.ReadInt();
outStream.WriteInt(dictLen);
@@ -994,13 +994,13 @@ namespace Apache.Ignite.Core.Impl.Binary
break;
- case BinaryUtils.TypeBinary:
+ case BinaryTypeId.Binary:
TransferArray(inStream, outStream, 1); // Data array.
TransferBytes(inStream, outStream, 4); // Offset in array.
break;
- case BinaryUtils.TypeEnum:
+ case BinaryTypeId.Enum:
TransferBytes(inStream, outStream, 8); // int typeId, int value.
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
index 2f66f66..0a1b2d1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObjectSchemaSerializer.cs
@@ -254,7 +254,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
private static int[] GetFieldIds(BinaryObjectHeader hdr, IIgniteInternal ignite)
{
- Debug.Assert(hdr.TypeId != BinaryUtils.TypeUnregistered);
+ Debug.Assert(hdr.TypeId != BinaryTypeId.Unregistered);
int[] fieldIds = null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
index 69056b3..26b3f15 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
@@ -183,7 +183,7 @@ namespace Apache.Ignite.Core.Impl.Binary
public bool RegisterType(int id, string typeName)
{
Debug.Assert(typeName != null);
- Debug.Assert(id != BinaryUtils.TypeUnregistered);
+ Debug.Assert(id != BinaryTypeId.Unregistered);
return DoOutOp((int) Op.RegisterType, w =>
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/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 76237c4..c0fcc7f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReader.cs
@@ -98,7 +98,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public bool ReadBoolean(string fieldName)
{
- return ReadField(fieldName, r => r.ReadBoolean(), BinaryUtils.TypeBool);
+ return ReadField(fieldName, r => r.ReadBoolean(), BinaryTypeId.Bool);
}
/** <inheritdoc /> */
@@ -110,19 +110,19 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public bool[] ReadBooleanArray(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadBooleanArray, BinaryUtils.TypeArrayBool);
+ return ReadField(fieldName, BinaryUtils.ReadBooleanArray, BinaryTypeId.ArrayBool);
}
/** <inheritdoc /> */
public bool[] ReadBooleanArray()
{
- return Read(BinaryUtils.ReadBooleanArray, BinaryUtils.TypeArrayBool);
+ return Read(BinaryUtils.ReadBooleanArray, BinaryTypeId.ArrayBool);
}
/** <inheritdoc /> */
public byte ReadByte(string fieldName)
{
- return ReadField(fieldName, ReadByte, BinaryUtils.TypeByte);
+ return ReadField(fieldName, ReadByte, BinaryTypeId.Byte);
}
/** <inheritdoc /> */
@@ -134,19 +134,19 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public byte[] ReadByteArray(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadByteArray, BinaryUtils.TypeArrayByte);
+ return ReadField(fieldName, BinaryUtils.ReadByteArray, BinaryTypeId.ArrayByte);
}
/** <inheritdoc /> */
public byte[] ReadByteArray()
{
- return Read(BinaryUtils.ReadByteArray, BinaryUtils.TypeArrayByte);
+ return Read(BinaryUtils.ReadByteArray, BinaryTypeId.ArrayByte);
}
/** <inheritdoc /> */
public short ReadShort(string fieldName)
{
- return ReadField(fieldName, ReadShort, BinaryUtils.TypeShort);
+ return ReadField(fieldName, ReadShort, BinaryTypeId.Short);
}
/** <inheritdoc /> */
@@ -158,19 +158,19 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public short[] ReadShortArray(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadShortArray, BinaryUtils.TypeArrayShort);
+ return ReadField(fieldName, BinaryUtils.ReadShortArray, BinaryTypeId.ArrayShort);
}
/** <inheritdoc /> */
public short[] ReadShortArray()
{
- return Read(BinaryUtils.ReadShortArray, BinaryUtils.TypeArrayShort);
+ return Read(BinaryUtils.ReadShortArray, BinaryTypeId.ArrayShort);
}
/** <inheritdoc /> */
public char ReadChar(string fieldName)
{
- return ReadField(fieldName, ReadChar, BinaryUtils.TypeChar);
+ return ReadField(fieldName, ReadChar, BinaryTypeId.Char);
}
/** <inheritdoc /> */
@@ -182,19 +182,19 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public char[] ReadCharArray(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadCharArray, BinaryUtils.TypeArrayChar);
+ return ReadField(fieldName, BinaryUtils.ReadCharArray, BinaryTypeId.ArrayChar);
}
/** <inheritdoc /> */
public char[] ReadCharArray()
{
- return Read(BinaryUtils.ReadCharArray, BinaryUtils.TypeArrayChar);
+ return Read(BinaryUtils.ReadCharArray, BinaryTypeId.ArrayChar);
}
/** <inheritdoc /> */
public int ReadInt(string fieldName)
{
- return ReadField(fieldName, ReadInt, BinaryUtils.TypeInt);
+ return ReadField(fieldName, ReadInt, BinaryTypeId.Int);
}
/** <inheritdoc /> */
@@ -206,19 +206,19 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public int[] ReadIntArray(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadIntArray, BinaryUtils.TypeArrayInt);
+ return ReadField(fieldName, BinaryUtils.ReadIntArray, BinaryTypeId.ArrayInt);
}
/** <inheritdoc /> */
public int[] ReadIntArray()
{
- return Read(BinaryUtils.ReadIntArray, BinaryUtils.TypeArrayInt);
+ return Read(BinaryUtils.ReadIntArray, BinaryTypeId.ArrayInt);
}
/** <inheritdoc /> */
public long ReadLong(string fieldName)
{
- return ReadField(fieldName, ReadLong, BinaryUtils.TypeLong);
+ return ReadField(fieldName, ReadLong, BinaryTypeId.Long);
}
/** <inheritdoc /> */
@@ -230,19 +230,19 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public long[] ReadLongArray(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadLongArray, BinaryUtils.TypeArrayLong);
+ return ReadField(fieldName, BinaryUtils.ReadLongArray, BinaryTypeId.ArrayLong);
}
/** <inheritdoc /> */
public long[] ReadLongArray()
{
- return Read(BinaryUtils.ReadLongArray, BinaryUtils.TypeArrayLong);
+ return Read(BinaryUtils.ReadLongArray, BinaryTypeId.ArrayLong);
}
/** <inheritdoc /> */
public float ReadFloat(string fieldName)
{
- return ReadField(fieldName, ReadFloat, BinaryUtils.TypeFloat);
+ return ReadField(fieldName, ReadFloat, BinaryTypeId.Float);
}
/** <inheritdoc /> */
@@ -254,19 +254,19 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public float[] ReadFloatArray(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadFloatArray, BinaryUtils.TypeArrayFloat);
+ return ReadField(fieldName, BinaryUtils.ReadFloatArray, BinaryTypeId.ArrayFloat);
}
/** <inheritdoc /> */
public float[] ReadFloatArray()
{
- return Read(BinaryUtils.ReadFloatArray, BinaryUtils.TypeArrayFloat);
+ return Read(BinaryUtils.ReadFloatArray, BinaryTypeId.ArrayFloat);
}
/** <inheritdoc /> */
public double ReadDouble(string fieldName)
{
- return ReadField(fieldName, ReadDouble, BinaryUtils.TypeDouble);
+ return ReadField(fieldName, ReadDouble, BinaryTypeId.Double);
}
/** <inheritdoc /> */
@@ -278,109 +278,109 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public double[] ReadDoubleArray(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadDoubleArray, BinaryUtils.TypeArrayDouble);
+ return ReadField(fieldName, BinaryUtils.ReadDoubleArray, BinaryTypeId.ArrayDouble);
}
/** <inheritdoc /> */
public double[] ReadDoubleArray()
{
- return Read(BinaryUtils.ReadDoubleArray, BinaryUtils.TypeArrayDouble);
+ return Read(BinaryUtils.ReadDoubleArray, BinaryTypeId.ArrayDouble);
}
/** <inheritdoc /> */
public decimal? ReadDecimal(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadDecimal, BinaryUtils.TypeDecimal);
+ return ReadField(fieldName, BinaryUtils.ReadDecimal, BinaryTypeId.Decimal);
}
/** <inheritdoc /> */
public decimal? ReadDecimal()
{
- return Read(BinaryUtils.ReadDecimal, BinaryUtils.TypeDecimal);
+ return Read(BinaryUtils.ReadDecimal, BinaryTypeId.Decimal);
}
/** <inheritdoc /> */
public decimal?[] ReadDecimalArray(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadDecimalArray, BinaryUtils.TypeArrayDecimal);
+ return ReadField(fieldName, BinaryUtils.ReadDecimalArray, BinaryTypeId.ArrayDecimal);
}
/** <inheritdoc /> */
public decimal?[] ReadDecimalArray()
{
- return Read(BinaryUtils.ReadDecimalArray, BinaryUtils.TypeArrayDecimal);
+ return Read(BinaryUtils.ReadDecimalArray, BinaryTypeId.ArrayDecimal);
}
/** <inheritdoc /> */
public DateTime? ReadTimestamp(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadTimestamp, BinaryUtils.TypeTimestamp);
+ return ReadField(fieldName, BinaryUtils.ReadTimestamp, BinaryTypeId.Timestamp);
}
/** <inheritdoc /> */
public DateTime? ReadTimestamp()
{
- return Read(BinaryUtils.ReadTimestamp, BinaryUtils.TypeTimestamp);
+ return Read(BinaryUtils.ReadTimestamp, BinaryTypeId.Timestamp);
}
/** <inheritdoc /> */
public DateTime?[] ReadTimestampArray(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadTimestampArray, BinaryUtils.TypeArrayTimestamp);
+ return ReadField(fieldName, BinaryUtils.ReadTimestampArray, BinaryTypeId.ArrayTimestamp);
}
/** <inheritdoc /> */
public DateTime?[] ReadTimestampArray()
{
- return Read(BinaryUtils.ReadTimestampArray, BinaryUtils.TypeArrayTimestamp);
+ return Read(BinaryUtils.ReadTimestampArray, BinaryTypeId.ArrayTimestamp);
}
/** <inheritdoc /> */
public string ReadString(string fieldName)
{
- return ReadField(fieldName, BinaryUtils.ReadString, BinaryUtils.TypeString);
+ return ReadField(fieldName, BinaryUtils.ReadString, BinaryTypeId.String);
}
/** <inheritdoc /> */
public string ReadString()
{
- return Read(BinaryUtils.ReadString, BinaryUtils.TypeString);
+ return Read(BinaryUtils.ReadString, BinaryTypeId.String);
}
/** <inheritdoc /> */
public string[] ReadStringArray(string fieldName)
{
- return ReadField(fieldName, r => BinaryUtils.ReadArray<string>(r, false), BinaryUtils.TypeArrayString);
+ return ReadField(fieldName, r => BinaryUtils.ReadArray<string>(r, false), BinaryTypeId.ArrayString);
}
/** <inheritdoc /> */
public string[] ReadStringArray()
{
- return Read(r => BinaryUtils.ReadArray<string>(r, false), BinaryUtils.TypeArrayString);
+ return Read(r => BinaryUtils.ReadArray<string>(r, false), BinaryTypeId.ArrayString);
}
/** <inheritdoc /> */
public Guid? ReadGuid(string fieldName)
{
- return ReadField<Guid?>(fieldName, r => BinaryUtils.ReadGuid(r), BinaryUtils.TypeGuid);
+ return ReadField<Guid?>(fieldName, r => BinaryUtils.ReadGuid(r), BinaryTypeId.Guid);
}
/** <inheritdoc /> */
public Guid? ReadGuid()
{
- return Read<Guid?>(r => BinaryUtils.ReadGuid(r), BinaryUtils.TypeGuid);
+ return Read<Guid?>(r => BinaryUtils.ReadGuid(r), BinaryTypeId.Guid);
}
/** <inheritdoc /> */
public Guid?[] ReadGuidArray(string fieldName)
{
- return ReadField(fieldName, r => BinaryUtils.ReadArray<Guid?>(r, false), BinaryUtils.TypeArrayGuid);
+ return ReadField(fieldName, r => BinaryUtils.ReadArray<Guid?>(r, false), BinaryTypeId.ArrayGuid);
}
/** <inheritdoc /> */
public Guid?[] ReadGuidArray()
{
- return Read(r => BinaryUtils.ReadArray<Guid?>(r, false), BinaryUtils.TypeArrayGuid);
+ return Read(r => BinaryUtils.ReadArray<Guid?>(r, false), BinaryTypeId.ArrayGuid);
}
/** <inheritdoc /> */
@@ -399,10 +399,10 @@ namespace Apache.Ignite.Core.Impl.Binary
case BinaryUtils.HdrNull:
return default(T);
- case BinaryUtils.TypeEnum:
+ case BinaryTypeId.Enum:
return ReadEnum0<T>(this, _mode == BinaryMode.ForceBinary);
- case BinaryUtils.TypeBinaryEnum:
+ case BinaryTypeId.BinaryEnum:
return ReadEnum0<T>(this, _mode != BinaryMode.Deserialize);
case BinaryUtils.HdrFull:
@@ -414,20 +414,20 @@ namespace Apache.Ignite.Core.Impl.Binary
default:
throw new BinaryObjectException(string.Format(
"Invalid header on enum deserialization. Expected: {0} or {1} or {2} but was: {3}",
- BinaryUtils.TypeEnum, BinaryUtils.TypeBinaryEnum, BinaryUtils.HdrFull, hdr));
+ BinaryTypeId.Enum, BinaryTypeId.BinaryEnum, BinaryUtils.HdrFull, hdr));
}
}
/** <inheritdoc /> */
public T[] ReadEnumArray<T>(string fieldName)
{
- return ReadField(fieldName, r => BinaryUtils.ReadArray<T>(r, true), BinaryUtils.TypeArrayEnum);
+ return ReadField(fieldName, r => BinaryUtils.ReadArray<T>(r, true), BinaryTypeId.ArrayEnum);
}
/** <inheritdoc /> */
public T[] ReadEnumArray<T>()
{
- return Read(r => BinaryUtils.ReadArray<T>(r, true), BinaryUtils.TypeArrayEnum);
+ return Read(r => BinaryUtils.ReadArray<T>(r, true), BinaryTypeId.ArrayEnum);
}
/** <inheritdoc /> */
@@ -451,13 +451,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public T[] ReadArray<T>(string fieldName)
{
- return ReadField(fieldName, r => BinaryUtils.ReadArray<T>(r, true), BinaryUtils.TypeArray);
+ return ReadField(fieldName, r => BinaryUtils.ReadArray<T>(r, true), BinaryTypeId.Array);
}
/** <inheritdoc /> */
public T[] ReadArray<T>()
{
- return Read(r => BinaryUtils.ReadArray<T>(r, true), BinaryUtils.TypeArray);
+ return Read(r => BinaryUtils.ReadArray<T>(r, true), BinaryTypeId.Array);
}
/** <inheritdoc /> */
@@ -476,13 +476,13 @@ namespace Apache.Ignite.Core.Impl.Binary
public ICollection ReadCollection(string fieldName, Func<int, ICollection> factory,
Action<ICollection, object> adder)
{
- return ReadField(fieldName, r => BinaryUtils.ReadCollection(r, factory, adder), BinaryUtils.TypeCollection);
+ return ReadField(fieldName, r => BinaryUtils.ReadCollection(r, factory, adder), BinaryTypeId.Collection);
}
/** <inheritdoc /> */
public ICollection ReadCollection(Func<int, ICollection> factory, Action<ICollection, object> adder)
{
- return Read(r => BinaryUtils.ReadCollection(r, factory, adder), BinaryUtils.TypeCollection);
+ return Read(r => BinaryUtils.ReadCollection(r, factory, adder), BinaryTypeId.Collection);
}
/** <inheritdoc /> */
@@ -500,13 +500,13 @@ namespace Apache.Ignite.Core.Impl.Binary
/** <inheritdoc /> */
public IDictionary ReadDictionary(string fieldName, Func<int, IDictionary> factory)
{
- return ReadField(fieldName, r => BinaryUtils.ReadDictionary(r, factory), BinaryUtils.TypeDictionary);
+ return ReadField(fieldName, r => BinaryUtils.ReadDictionary(r, factory), BinaryTypeId.Dictionary);
}
/** <inheritdoc /> */
public IDictionary ReadDictionary(Func<int, IDictionary> factory)
{
- return Read(r => BinaryUtils.ReadDictionary(r, factory), BinaryUtils.TypeDictionary);
+ return Read(r => BinaryUtils.ReadDictionary(r, factory), BinaryTypeId.Dictionary);
}
/// <summary>
@@ -577,17 +577,17 @@ namespace Apache.Ignite.Core.Impl.Binary
return true;
- case BinaryUtils.TypeBinary:
+ case BinaryTypeId.Binary:
res = ReadBinaryObject<T>(doDetach);
return true;
- case BinaryUtils.TypeEnum:
+ case BinaryTypeId.Enum:
res = ReadEnum0<T>(this, _mode == BinaryMode.ForceBinary);
return true;
- case BinaryUtils.TypeBinaryEnum:
+ case BinaryTypeId.BinaryEnum:
res = ReadEnum0<T>(this, _mode != BinaryMode.Deserialize);
return true;
@@ -716,7 +716,7 @@ namespace Apache.Ignite.Core.Impl.Binary
else
{
// Find descriptor.
- var desc = hdr.TypeId == BinaryUtils.TypeUnregistered
+ var desc = hdr.TypeId == BinaryTypeId.Unregistered
? _marsh.GetDescriptor(ReadUnregisteredType(typeOverride))
: _marsh.GetDescriptor(hdr.IsUserType, hdr.TypeId, true, null, typeOverride);
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/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 95a0be3..f55a11f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
@@ -19,7 +19,6 @@ namespace Apache.Ignite.Core.Impl.Binary
{
using System;
using System.Collections;
- using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Impl.Binary.IO;
@@ -37,45 +36,6 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Read handlers. */
private static readonly IBinarySystemReader[] ReadHandlers = new IBinarySystemReader[255];
- /** Type ids. */
- private static readonly Dictionary<Type, byte> TypeIds = new Dictionary<Type, byte>
- {
- {typeof (bool), BinaryUtils.TypeBool},
- {typeof (byte), BinaryUtils.TypeByte},
- {typeof (sbyte), BinaryUtils.TypeByte},
- {typeof (short), BinaryUtils.TypeShort},
- {typeof (ushort), BinaryUtils.TypeShort},
- {typeof (char), BinaryUtils.TypeChar},
- {typeof (int), BinaryUtils.TypeInt},
- {typeof (uint), BinaryUtils.TypeInt},
- {typeof (long), BinaryUtils.TypeLong},
- {typeof (ulong), BinaryUtils.TypeLong},
- {typeof (float), BinaryUtils.TypeFloat},
- {typeof (double), BinaryUtils.TypeDouble},
- {typeof (string), BinaryUtils.TypeString},
- {typeof (decimal), BinaryUtils.TypeDecimal},
- {typeof (Guid), BinaryUtils.TypeGuid},
- {typeof (Guid?), BinaryUtils.TypeGuid},
- {typeof (ArrayList), BinaryUtils.TypeCollection},
- {typeof (Hashtable), BinaryUtils.TypeDictionary},
- {typeof (bool[]), BinaryUtils.TypeArrayBool},
- {typeof (byte[]), BinaryUtils.TypeArrayByte},
- {typeof (sbyte[]), BinaryUtils.TypeArrayByte},
- {typeof (short[]), BinaryUtils.TypeArrayShort},
- {typeof (ushort[]), BinaryUtils.TypeArrayShort},
- {typeof (char[]), BinaryUtils.TypeArrayChar},
- {typeof (int[]), BinaryUtils.TypeArrayInt},
- {typeof (uint[]), BinaryUtils.TypeArrayInt},
- {typeof (long[]), BinaryUtils.TypeArrayLong},
- {typeof (ulong[]), BinaryUtils.TypeArrayLong},
- {typeof (float[]), BinaryUtils.TypeArrayFloat},
- {typeof (double[]), BinaryUtils.TypeArrayDouble},
- {typeof (string[]), BinaryUtils.TypeArrayString},
- {typeof (decimal?[]), BinaryUtils.TypeArrayDecimal},
- {typeof (Guid?[]), BinaryUtils.TypeArrayGuid},
- {typeof (object[]), BinaryUtils.TypeArray}
- };
-
/// <summary>
/// Initializes the <see cref="BinarySystemHandlers"/> class.
/// </summary>
@@ -84,75 +44,75 @@ namespace Apache.Ignite.Core.Impl.Binary
static BinarySystemHandlers()
{
// 1. Primitives.
- ReadHandlers[BinaryUtils.TypeBool] = new BinarySystemReader<bool>(s => s.ReadBool());
- ReadHandlers[BinaryUtils.TypeByte] = new BinarySystemReader<byte>(s => s.ReadByte());
- ReadHandlers[BinaryUtils.TypeShort] = new BinarySystemReader<short>(s => s.ReadShort());
- ReadHandlers[BinaryUtils.TypeChar] = new BinarySystemReader<char>(s => s.ReadChar());
- ReadHandlers[BinaryUtils.TypeInt] = new BinarySystemReader<int>(s => s.ReadInt());
- ReadHandlers[BinaryUtils.TypeLong] = new BinarySystemReader<long>(s => s.ReadLong());
- ReadHandlers[BinaryUtils.TypeFloat] = new BinarySystemReader<float>(s => s.ReadFloat());
- ReadHandlers[BinaryUtils.TypeDouble] = new BinarySystemReader<double>(s => s.ReadDouble());
- ReadHandlers[BinaryUtils.TypeDecimal] = new BinarySystemReader<decimal?>(BinaryUtils.ReadDecimal);
+ ReadHandlers[BinaryTypeId.Bool] = new BinarySystemReader<bool>(s => s.ReadBool());
+ ReadHandlers[BinaryTypeId.Byte] = new BinarySystemReader<byte>(s => s.ReadByte());
+ ReadHandlers[BinaryTypeId.Short] = new BinarySystemReader<short>(s => s.ReadShort());
+ ReadHandlers[BinaryTypeId.Char] = new BinarySystemReader<char>(s => s.ReadChar());
+ ReadHandlers[BinaryTypeId.Int] = new BinarySystemReader<int>(s => s.ReadInt());
+ ReadHandlers[BinaryTypeId.Long] = new BinarySystemReader<long>(s => s.ReadLong());
+ ReadHandlers[BinaryTypeId.Float] = new BinarySystemReader<float>(s => s.ReadFloat());
+ ReadHandlers[BinaryTypeId.Double] = new BinarySystemReader<double>(s => s.ReadDouble());
+ ReadHandlers[BinaryTypeId.Decimal] = new BinarySystemReader<decimal?>(BinaryUtils.ReadDecimal);
// 2. Date.
- ReadHandlers[BinaryUtils.TypeTimestamp] = new BinarySystemReader<DateTime?>(BinaryUtils.ReadTimestamp);
+ ReadHandlers[BinaryTypeId.Timestamp] = new BinarySystemReader<DateTime?>(BinaryUtils.ReadTimestamp);
// 3. String.
- ReadHandlers[BinaryUtils.TypeString] = new BinarySystemReader<string>(BinaryUtils.ReadString);
+ ReadHandlers[BinaryTypeId.String] = new BinarySystemReader<string>(BinaryUtils.ReadString);
// 4. Guid.
- ReadHandlers[BinaryUtils.TypeGuid] = new BinarySystemReader<Guid?>(s => BinaryUtils.ReadGuid(s));
+ ReadHandlers[BinaryTypeId.Guid] = new BinarySystemReader<Guid?>(s => BinaryUtils.ReadGuid(s));
// 5. Primitive arrays.
- ReadHandlers[BinaryUtils.TypeArrayBool] = new BinarySystemReader<bool[]>(BinaryUtils.ReadBooleanArray);
+ ReadHandlers[BinaryTypeId.ArrayBool] = new BinarySystemReader<bool[]>(BinaryUtils.ReadBooleanArray);
- ReadHandlers[BinaryUtils.TypeArrayByte] =
+ ReadHandlers[BinaryTypeId.ArrayByte] =
new BinarySystemDualReader<byte[], sbyte[]>(BinaryUtils.ReadByteArray, BinaryUtils.ReadSbyteArray);
- ReadHandlers[BinaryUtils.TypeArrayShort] =
+ ReadHandlers[BinaryTypeId.ArrayShort] =
new BinarySystemDualReader<short[], ushort[]>(BinaryUtils.ReadShortArray,
BinaryUtils.ReadUshortArray);
- ReadHandlers[BinaryUtils.TypeArrayChar] =
+ ReadHandlers[BinaryTypeId.ArrayChar] =
new BinarySystemReader<char[]>(BinaryUtils.ReadCharArray);
- ReadHandlers[BinaryUtils.TypeArrayInt] =
+ ReadHandlers[BinaryTypeId.ArrayInt] =
new BinarySystemDualReader<int[], uint[]>(BinaryUtils.ReadIntArray, BinaryUtils.ReadUintArray);
- ReadHandlers[BinaryUtils.TypeArrayLong] =
+ ReadHandlers[BinaryTypeId.ArrayLong] =
new BinarySystemDualReader<long[], ulong[]>(BinaryUtils.ReadLongArray,
BinaryUtils.ReadUlongArray);
- ReadHandlers[BinaryUtils.TypeArrayFloat] =
+ ReadHandlers[BinaryTypeId.ArrayFloat] =
new BinarySystemReader<float[]>(BinaryUtils.ReadFloatArray);
- ReadHandlers[BinaryUtils.TypeArrayDouble] =
+ ReadHandlers[BinaryTypeId.ArrayDouble] =
new BinarySystemReader<double[]>(BinaryUtils.ReadDoubleArray);
- ReadHandlers[BinaryUtils.TypeArrayDecimal] =
+ ReadHandlers[BinaryTypeId.ArrayDecimal] =
new BinarySystemReader<decimal?[]>(BinaryUtils.ReadDecimalArray);
// 6. Date array.
- ReadHandlers[BinaryUtils.TypeArrayTimestamp] =
+ ReadHandlers[BinaryTypeId.ArrayTimestamp] =
new BinarySystemReader<DateTime?[]>(BinaryUtils.ReadTimestampArray);
// 7. String array.
- ReadHandlers[BinaryUtils.TypeArrayString] = new BinarySystemTypedArrayReader<string>();
+ ReadHandlers[BinaryTypeId.ArrayString] = new BinarySystemTypedArrayReader<string>();
// 8. Guid array.
- ReadHandlers[BinaryUtils.TypeArrayGuid] = new BinarySystemTypedArrayReader<Guid?>();
+ ReadHandlers[BinaryTypeId.ArrayGuid] = new BinarySystemTypedArrayReader<Guid?>();
// 9. Array.
- ReadHandlers[BinaryUtils.TypeArray] = new BinarySystemReader(ReadArray);
+ ReadHandlers[BinaryTypeId.Array] = new BinarySystemReader(ReadArray);
// 11. Arbitrary collection.
- ReadHandlers[BinaryUtils.TypeCollection] = new BinarySystemReader(ReadCollection);
+ ReadHandlers[BinaryTypeId.Collection] = new BinarySystemReader(ReadCollection);
// 13. Arbitrary dictionary.
- ReadHandlers[BinaryUtils.TypeDictionary] = new BinarySystemReader(ReadDictionary);
+ ReadHandlers[BinaryTypeId.Dictionary] = new BinarySystemReader(ReadDictionary);
// 14. Enum.
- ReadHandlers[BinaryUtils.TypeArrayEnum] = new BinarySystemReader(ReadEnumArray);
+ ReadHandlers[BinaryTypeId.ArrayEnum] = new BinarySystemReader(ReadEnumArray);
}
/// <summary>
@@ -266,27 +226,6 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/// <summary>
- /// Find write handler for type.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Write handler or NULL.</returns>
- public static byte GetTypeId(Type type)
- {
- byte res;
-
- if (TypeIds.TryGetValue(type, out res))
- return res;
-
- if (BinaryUtils.IsIgniteEnum(type))
- return BinaryUtils.TypeEnum;
-
- if (type.IsArray && BinaryUtils.IsIgniteEnum(type.GetElementType()))
- return BinaryUtils.TypeArrayEnum;
-
- return BinaryUtils.TypeObject;
- }
-
- /// <summary>
/// Reads an object of predefined type.
/// </summary>
public static bool TryReadSystemType<T>(byte typeId, BinaryReader ctx, out T res)
@@ -310,7 +249,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteDecimal(BinaryWriter ctx, decimal obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeDecimal);
+ ctx.Stream.WriteByte(BinaryTypeId.Decimal);
BinaryUtils.WriteDecimal(obj, ctx.Stream);
}
@@ -322,7 +261,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Object.</param>
private static void WriteString(BinaryWriter ctx, string obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeString);
+ ctx.Stream.WriteByte(BinaryTypeId.String);
BinaryUtils.WriteString(obj, ctx.Stream);
}
@@ -334,7 +273,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteGuid(BinaryWriter ctx, Guid obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeGuid);
+ ctx.Stream.WriteByte(BinaryTypeId.Guid);
BinaryUtils.WriteGuid(obj, ctx.Stream);
}
@@ -346,7 +285,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteBoolArray(BinaryWriter ctx, bool[] obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayBool);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayBool);
BinaryUtils.WriteBooleanArray(obj, ctx.Stream);
}
@@ -358,7 +297,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteByteArray(BinaryWriter ctx, byte[] obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayByte);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayByte);
BinaryUtils.WriteByteArray(obj, ctx.Stream);
}
@@ -370,7 +309,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteShortArray(BinaryWriter ctx, short[] obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayShort);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayShort);
BinaryUtils.WriteShortArray(obj, ctx.Stream);
}
@@ -382,7 +321,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteCharArray(BinaryWriter ctx, object obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayChar);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayChar);
BinaryUtils.WriteCharArray((char[])obj, ctx.Stream);
}
@@ -394,7 +333,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteIntArray(BinaryWriter ctx, int[] obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayInt);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayInt);
BinaryUtils.WriteIntArray(obj, ctx.Stream);
}
@@ -406,7 +345,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteLongArray(BinaryWriter ctx, long[] obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayLong);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayLong);
BinaryUtils.WriteLongArray(obj, ctx.Stream);
}
@@ -418,7 +357,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteFloatArray(BinaryWriter ctx, float[] obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayFloat);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayFloat);
BinaryUtils.WriteFloatArray(obj, ctx.Stream);
}
@@ -430,7 +369,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteDoubleArray(BinaryWriter ctx, double[] obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayDouble);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayDouble);
BinaryUtils.WriteDoubleArray(obj, ctx.Stream);
}
@@ -442,7 +381,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteDecimalArray(BinaryWriter ctx, decimal?[] obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayDecimal);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayDecimal);
BinaryUtils.WriteDecimalArray(obj, ctx.Stream);
}
@@ -454,7 +393,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteStringArray(BinaryWriter ctx, string[] obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayString);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayString);
BinaryUtils.WriteStringArray(obj, ctx.Stream);
}
@@ -466,7 +405,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <param name="obj">Value.</param>
private static void WriteGuidArray(BinaryWriter ctx, Guid?[] obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayGuid);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayGuid);
BinaryUtils.WriteGuidArray(obj, ctx.Stream);
}
@@ -476,7 +415,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
private static void WriteEnumArray(BinaryWriter ctx, object obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayEnum);
+ ctx.Stream.WriteByte(BinaryTypeId.ArrayEnum);
BinaryUtils.WriteArray((Array) obj, ctx);
}
@@ -486,7 +425,7 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
private static void WriteArray(BinaryWriter ctx, object obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeArray);
+ ctx.Stream.WriteByte(BinaryTypeId.Array);
BinaryUtils.WriteArray((Array) obj, ctx);
}
@@ -496,7 +435,7 @@ namespace Apache.Ignite.Core.Impl.Binary
*/
private static void WriteArrayList(BinaryWriter ctx, ICollection obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeCollection);
+ ctx.Stream.WriteByte(BinaryTypeId.Collection);
BinaryUtils.WriteCollection(obj, ctx, BinaryUtils.CollectionArrayList);
}
@@ -506,7 +445,7 @@ namespace Apache.Ignite.Core.Impl.Binary
*/
private static void WriteHashtable(BinaryWriter ctx, IDictionary obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeDictionary);
+ ctx.Stream.WriteByte(BinaryTypeId.Dictionary);
BinaryUtils.WriteDictionary(obj, ctx, BinaryUtils.MapHashMap);
}
@@ -516,7 +455,7 @@ namespace Apache.Ignite.Core.Impl.Binary
*/
private static void WriteBinary(BinaryWriter ctx, BinaryObject obj)
{
- ctx.Stream.WriteByte(BinaryUtils.TypeBinary);
+ ctx.Stream.WriteByte(BinaryTypeId.Binary);
BinaryUtils.WriteBinary(ctx.Stream, obj);
}
@@ -528,7 +467,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
var binEnum = obj;
- ctx.Stream.WriteByte(BinaryUtils.TypeBinaryEnum);
+ ctx.Stream.WriteByte(BinaryTypeId.BinaryEnum);
ctx.WriteInt(binEnum.TypeId);
ctx.WriteInt(binEnum.EnumValue);
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryTypeId.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryTypeId.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryTypeId.cs
new file mode 100644
index 0000000..1d3d9c4
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryTypeId.cs
@@ -0,0 +1,228 @@
+/*
+ * 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;
+ using System.Collections;
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// Binary type IDs.
+ /// </summary>
+ internal static class BinaryTypeId
+ {
+ /** Type: object. */
+ public const byte Object = BinaryUtils.HdrFull;
+
+ /** Type: unregistered. */
+ public const byte Unregistered = 0;
+
+ /** Type: unsigned byte. */
+ public const byte Byte = 1;
+
+ /** Type: short. */
+ public const byte Short = 2;
+
+ /** Type: int. */
+ public const byte Int = 3;
+
+ /** Type: long. */
+ public const byte Long = 4;
+
+ /** Type: float. */
+ public const byte Float = 5;
+
+ /** Type: double. */
+ public const byte Double = 6;
+
+ /** Type: char. */
+ public const byte Char = 7;
+
+ /** Type: boolean. */
+ public const byte Bool = 8;
+
+ /** Type: decimal. */
+ public const byte Decimal = 30;
+
+ /** Type: string. */
+ public const byte String = 9;
+
+ /** Type: GUID. */
+ public const byte Guid = 10;
+
+ /** Type: date. */
+ public const byte Timestamp = 33;
+
+ /** Type: unsigned byte array. */
+ public const byte ArrayByte = 12;
+
+ /** Type: short array. */
+ public const byte ArrayShort = 13;
+
+ /** Type: int array. */
+ public const byte ArrayInt = 14;
+
+ /** Type: long array. */
+ public const byte ArrayLong = 15;
+
+ /** Type: float array. */
+ public const byte ArrayFloat = 16;
+
+ /** Type: double array. */
+ public const byte ArrayDouble = 17;
+
+ /** Type: char array. */
+ public const byte ArrayChar = 18;
+
+ /** Type: boolean array. */
+ public const byte ArrayBool = 19;
+
+ /** Type: decimal array. */
+ public const byte ArrayDecimal = 31;
+
+ /** Type: string array. */
+ public const byte ArrayString = 20;
+
+ /** Type: GUID array. */
+ public const byte ArrayGuid = 21;
+
+ /** Type: date array. */
+ public const byte ArrayTimestamp = 34;
+
+ /** Type: object array. */
+ public const byte Array = 23;
+
+ /** Type: collection. */
+ public const byte Collection = 24;
+
+ /** Type: map. */
+ public const byte Dictionary = 25;
+
+ /** Type: binary object. */
+ public const byte Binary = 27;
+
+ /** Type: enum. */
+ public const byte Enum = 28;
+
+ /** Type: enum array. */
+ public const byte ArrayEnum = 29;
+
+ /** Type: binary enum. */
+ public const byte BinaryEnum = 38;
+
+ /** Type: native job holder. */
+ public const byte NativeJobHolder = 77;
+
+ /** Type: function wrapper. */
+ public const byte ComputeOutFuncJob = 80;
+
+ /** Type: function wrapper. */
+ public const byte ComputeFuncJob = 81;
+
+ /** Type: continuous query remote filter. */
+ public const byte ContinuousQueryRemoteFilterHolder = 82;
+
+ /** Type: Compute out func wrapper. */
+ public const byte ComputeOutFuncWrapper = 83;
+
+ /** Type: Compute func wrapper. */
+ public const byte ComputeFuncWrapper = 85;
+
+ /** Type: Compute job wrapper. */
+ public const byte ComputeJobWrapper = 86;
+
+ /** Type: action wrapper. */
+ public const byte ComputeActionJob = 88;
+
+ /** Type: entry processor holder. */
+ public const byte CacheEntryProcessorHolder = 89;
+
+ /** Type: entry predicate holder. */
+ public const byte CacheEntryPredicateHolder = 90;
+
+ /** Type: message filter holder. */
+ public const byte MessageListenerHolder = 92;
+
+ /** Type: stream receiver holder. */
+ public const byte StreamReceiverHolder = 94;
+
+ /** Type: platform object proxy. */
+ public const byte PlatformJavaObjectFactoryProxy = 99;
+
+ /** Type: platform object proxy. */
+ public const int IgniteUuid = 2018070327;
+
+ /** Type ids. */
+ private static readonly Dictionary<Type, byte> TypeIds = new Dictionary<Type, byte>
+ {
+ {typeof (bool), Bool},
+ {typeof (byte), Byte},
+ {typeof (sbyte), Byte},
+ {typeof (short), Short},
+ {typeof (ushort), Short},
+ {typeof (char), Char},
+ {typeof (int), Int},
+ {typeof (uint), Int},
+ {typeof (long), Long},
+ {typeof (ulong), Long},
+ {typeof (float), Float},
+ {typeof (double), Double},
+ {typeof (string), String},
+ {typeof (decimal), Decimal},
+ {typeof (Guid), Guid},
+ {typeof (Guid?), Guid},
+ {typeof (ArrayList), Collection},
+ {typeof (Hashtable), Dictionary},
+ {typeof (bool[]), ArrayBool},
+ {typeof (byte[]), ArrayByte},
+ {typeof (sbyte[]), ArrayByte},
+ {typeof (short[]), ArrayShort},
+ {typeof (ushort[]), ArrayShort},
+ {typeof (char[]), ArrayChar},
+ {typeof (int[]), ArrayInt},
+ {typeof (uint[]), ArrayInt},
+ {typeof (long[]), ArrayLong},
+ {typeof (ulong[]), ArrayLong},
+ {typeof (float[]), ArrayFloat},
+ {typeof (double[]), ArrayDouble},
+ {typeof (string[]), ArrayString},
+ {typeof (decimal?[]), ArrayDecimal},
+ {typeof (Guid?[]), ArrayGuid},
+ {typeof (object[]), Array}
+ };
+
+ /// <summary>
+ /// Get binary type id for a type.
+ /// </summary>
+ internal static byte GetTypeId(Type type)
+ {
+ byte res;
+
+ if (TypeIds.TryGetValue(type, out res))
+ return res;
+
+ if (BinaryUtils.IsIgniteEnum(type))
+ return Enum;
+
+ if (type.IsArray && BinaryUtils.IsIgniteEnum(type.GetElementType()))
+ return ArrayEnum;
+
+ return Object;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/55e0b5c9/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 91a536e..1146f35 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -47,147 +47,6 @@ namespace Apache.Ignite.Core.Impl.Binary
/** Protocol versnion. */
public const byte ProtoVer = 1;
- /** Type: object. */
- public const byte TypeObject = HdrFull;
-
- /** Type: unregistered. */
- public const byte TypeUnregistered = 0;
-
- /** Type: unsigned byte. */
- public const byte TypeByte = 1;
-
- /** Type: short. */
- public const byte TypeShort = 2;
-
- /** Type: int. */
- public const byte TypeInt = 3;
-
- /** Type: long. */
- public const byte TypeLong = 4;
-
- /** Type: float. */
- public const byte TypeFloat = 5;
-
- /** Type: double. */
- public const byte TypeDouble = 6;
-
- /** Type: char. */
- public const byte TypeChar = 7;
-
- /** Type: boolean. */
- public const byte TypeBool = 8;
-
- /** Type: decimal. */
- public const byte TypeDecimal = 30;
-
- /** Type: string. */
- public const byte TypeString = 9;
-
- /** Type: GUID. */
- public const byte TypeGuid = 10;
-
- /** Type: date. */
- public const byte TypeTimestamp = 33;
-
- /** Type: unsigned byte array. */
- public const byte TypeArrayByte = 12;
-
- /** Type: short array. */
- public const byte TypeArrayShort = 13;
-
- /** Type: int array. */
- public const byte TypeArrayInt = 14;
-
- /** Type: long array. */
- public const byte TypeArrayLong = 15;
-
- /** Type: float array. */
- public const byte TypeArrayFloat = 16;
-
- /** Type: double array. */
- public const byte TypeArrayDouble = 17;
-
- /** Type: char array. */
- public const byte TypeArrayChar = 18;
-
- /** Type: boolean array. */
- public const byte TypeArrayBool = 19;
-
- /** Type: decimal array. */
- public const byte TypeArrayDecimal = 31;
-
- /** Type: string array. */
- public const byte TypeArrayString = 20;
-
- /** Type: GUID array. */
- public const byte TypeArrayGuid = 21;
-
- /** Type: date array. */
- public const byte TypeArrayTimestamp = 34;
-
- /** Type: object array. */
- public const byte TypeArray = 23;
-
- /** Type: collection. */
- public const byte TypeCollection = 24;
-
- /** Type: map. */
- public const byte TypeDictionary = 25;
-
- /** Type: binary object. */
- public const byte TypeBinary = 27;
-
- /** Type: enum. */
- public const byte TypeEnum = 28;
-
- /** Type: enum array. */
- public const byte TypeArrayEnum = 29;
-
- /** Type: binary enum. */
- public const byte TypeBinaryEnum = 38;
-
- /** Type: native job holder. */
- public const byte TypeNativeJobHolder = 77;
-
- /** Type: function wrapper. */
- public const byte TypeComputeOutFuncJob = 80;
-
- /** Type: function wrapper. */
- public const byte TypeComputeFuncJob = 81;
-
- /** Type: continuous query remote filter. */
- public const byte TypeContinuousQueryRemoteFilterHolder = 82;
-
- /** Type: Compute out func wrapper. */
- public const byte TypeComputeOutFuncWrapper = 83;
-
- /** Type: Compute func wrapper. */
- public const byte TypeComputeFuncWrapper = 85;
-
- /** Type: Compute job wrapper. */
- public const byte TypeComputeJobWrapper = 86;
-
- /** Type: action wrapper. */
- public const byte TypeComputeActionJob = 88;
-
- /** Type: entry processor holder. */
- public const byte TypeCacheEntryProcessorHolder = 89;
-
- /** Type: entry predicate holder. */
- public const byte TypeCacheEntryPredicateHolder = 90;
-
- /** Type: message filter holder. */
- public const byte TypeMessageListenerHolder = 92;
-
- /** Type: stream receiver holder. */
- public const byte TypeStreamReceiverHolder = 94;
-
- /** Type: platform object proxy. */
- public const byte TypePlatformJavaObjectFactoryProxy = 99;
-
- /** Type: platform object proxy. */
- public const int TypeIgniteUuid = 2018070327;
-
/** Collection: custom. */
public const byte CollectionCustom = 0;
@@ -563,7 +422,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
if (val.HasValue)
{
- stream.WriteByte(TypeTimestamp);
+ stream.WriteByte(BinaryTypeId.Timestamp);
WriteTimestamp(val.Value, stream);
}
@@ -781,7 +640,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
if (val != null)
{
- stream.WriteByte(TypeString);
+ stream.WriteByte(BinaryTypeId.String);
WriteString(val, stream);
}
else
@@ -985,7 +844,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
if (val.HasValue)
{
- stream.WriteByte(TypeDecimal);
+ stream.WriteByte(BinaryTypeId.Decimal);
WriteDecimal(val.Value, stream);
}
@@ -1147,7 +1006,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
if (val.HasValue)
{
- stream.WriteByte(TypeGuid);
+ stream.WriteByte(BinaryTypeId.Guid);
WriteGuid(val.Value, stream);
}
@@ -1168,7 +1027,7 @@ namespace Apache.Ignite.Core.Impl.Binary
IBinaryStream stream = ctx.Stream;
- if (elemTypeId != null && elemTypeId != TypeUnregistered)
+ if (elemTypeId != null && elemTypeId != BinaryTypeId.Unregistered)
{
stream.WriteInt(elemTypeId.Value);
}
@@ -1183,7 +1042,7 @@ namespace Apache.Ignite.Core.Impl.Binary
stream.WriteInt(typeId);
- if (typeId == TypeUnregistered)
+ if (typeId == BinaryTypeId.Unregistered)
ctx.WriteString(elemType.FullName);
}
@@ -1229,7 +1088,7 @@ namespace Apache.Ignite.Core.Impl.Binary
{
int typeId = stream.ReadInt();
- if (typeId == TypeUnregistered)
+ if (typeId == BinaryTypeId.Unregistered)
ctx.ReadString();
}
[10/23] ignite git commit: IGNITE-6170: JDBC: now all drivers return
"Apache Ignite" as product name. This closes #2514.
Posted by pt...@apache.org.
IGNITE-6170: JDBC: now all drivers return "Apache Ignite" as product name. This closes #2514.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1d0d6f84
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1d0d6f84
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1d0d6f84
Branch: refs/heads/ignite-5896
Commit: 1d0d6f84a7e263bfc41716fc603d9bd263e79875
Parents: fe656eb
Author: Roman Shtykh <ap...@gmail.com>
Authored: Mon Sep 4 13:35:34 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Sep 4 13:35:34 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java | 2 +-
.../ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java | 2 +-
.../org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java | 2 +-
.../ignite/yardstick/cache/jdbc/JdbcAbstractBenchmark.java | 4 ++--
.../org/apache/ignite/yardstick/cache/jdbc/RdbmsBenchmark.java | 6 +++---
5 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/1d0d6f84/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java
index e2fbe05..f76c4fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcDatabaseMetadata.java
@@ -113,7 +113,7 @@ public class JdbcDatabaseMetadata implements DatabaseMetaData {
/** {@inheritDoc} */
@Override public String getDatabaseProductName() throws SQLException {
- return "Ignite Cache";
+ return "Apache Ignite";
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/1d0d6f84/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
index 32e1858..b27fee6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinDatabaseMetadata.java
@@ -111,7 +111,7 @@ public class JdbcThinDatabaseMetadata implements DatabaseMetaData {
/** {@inheritDoc} */
@Override public String getDatabaseProductName() throws SQLException {
- return "Ignite";
+ return "Apache Ignite";
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/1d0d6f84/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
index aad6daa..ac8d9ce 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
@@ -112,7 +112,7 @@ public class JdbcDatabaseMetadata implements DatabaseMetaData {
/** {@inheritDoc} */
@Override public String getDatabaseProductName() {
- return "Ignite Cache";
+ return "Apache Ignite";
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/1d0d6f84/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcAbstractBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcAbstractBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcAbstractBenchmark.java
index 87c2cab..1e83b58 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcAbstractBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/JdbcAbstractBenchmark.java
@@ -123,7 +123,7 @@ public abstract class JdbcAbstractBenchmark extends IgniteAbstractBenchmark {
private void dropTestDatabase() throws SQLException {
try (Connection conn = connection()) {
try (Statement stmt = conn.createStatement()) {
- if (!conn.getMetaData().getDatabaseProductName().equals("Ignite Cache"))
+ if (!conn.getMetaData().getDatabaseProductName().equals("Apache Ignite"))
stmt.executeUpdate("drop database " + dbName);
}
}
@@ -194,7 +194,7 @@ public abstract class JdbcAbstractBenchmark extends IgniteAbstractBenchmark {
void clearTable(String tblName) throws SQLException {
try (Connection conn = connection()) {
try (PreparedStatement stmt = conn.prepareStatement("drop table " + tblName)) {
- if (!conn.getMetaData().getDatabaseProductName().equals("Ignite Cache"))
+ if (!conn.getMetaData().getDatabaseProductName().equals("Apache Ignite"))
stmt.executeUpdate();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/1d0d6f84/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/RdbmsBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/RdbmsBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/RdbmsBenchmark.java
index 341e5a7..5b93d04 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/RdbmsBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/jdbc/RdbmsBenchmark.java
@@ -48,7 +48,7 @@ public class RdbmsBenchmark extends JdbcAbstractBenchmark {
@Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
super.setUp(cfg);
- isIgnite = conn.get().getMetaData().getDatabaseProductName().equals("Ignite Cache");
+ isIgnite = conn.get().getMetaData().getDatabaseProductName().equals("Apache Ignite");
if (isIgnite)
clearCaches();
@@ -124,7 +124,7 @@ public class RdbmsBenchmark extends JdbcAbstractBenchmark {
case "H2":
return conn.prepareStatement("merge into " + tblName + " (id, val) values(?, ?)");
- case "Ignite Cache":
+ case "Apache Ignite":
return conn.prepareStatement("merge into " + '"' + tblName + '"' + '.' + tblName + " (_key, val) values(?, ?)");
case "MySQL":
@@ -156,7 +156,7 @@ public class RdbmsBenchmark extends JdbcAbstractBenchmark {
// No-op.
break;
- case "Ignite Cache":
+ case "Apache Ignite":
// No-op.
break;
[17/23] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by pt...@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/872a9599
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/872a9599
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/872a9599
Branch: refs/heads/ignite-5896
Commit: 872a959987ad154a4627ea5b4d91c6e965e3d694
Parents: 3a33095 075f48d
Author: devozerov <vo...@gridgain.com>
Authored: Mon Sep 4 17:41:44 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Sep 4 17:41:44 2017 +0300
----------------------------------------------------------------------
.../internal/DuplicateTypeIdException.java | 74 +++++++++++++++++++
.../ignite/internal/MarshallerContextImpl.java | 24 +------
.../ignite/internal/binary/BinaryContext.java | 52 ++++++++++----
.../binary/builder/BinaryObjectBuilderImpl.java | 2 +
.../odbc/odbc/OdbcRequestHandler.java | 17 ++---
.../processors/odbc/odbc/OdbcUtils.java | 22 ++++++
.../BinaryObjectBuilderAdditionalSelfTest.java | 22 ++++++
modules/platforms/cpp/odbc-test/Makefile.am | 3 +-
.../cpp/odbc-test/project/vs/odbc-test.vcxproj | 8 +--
.../cpp/odbc-test/src/queries_test.cpp | 75 +++++++++++++++++++-
.../cpp/odbc/include/ignite/odbc/cursor.h | 7 ++
modules/platforms/cpp/odbc/src/cursor.cpp | 5 ++
.../platforms/cpp/odbc/src/query/data_query.cpp | 2 +-
13 files changed, 260 insertions(+), 53 deletions(-)
----------------------------------------------------------------------
[16/23] ignite git commit: IGNITE-6182: Improved message.
Posted by pt...@apache.org.
IGNITE-6182: Improved message.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3a33095a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3a33095a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3a33095a
Branch: refs/heads/ignite-5896
Commit: 3a33095ade910794f8385e43a651b0d922293c3b
Parents: 9d35ea0
Author: devozerov <vo...@gridgain.com>
Authored: Mon Sep 4 17:41:30 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Sep 4 17:41:30 2017 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/IgniteKernal.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3a33095a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 549fcb5..cfad8b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -1408,9 +1408,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
long safeToUse = ram - Math.max(4L << 30, (long)(ram * 0.2));
if (total > safeToUse) {
- U.quietAndWarn(log, "Attempting to start more nodes than physical RAM available on the host " +
- "what can lead to significant slowdown (please decrease JVM heap size, memory policy size or " +
- "checkpoint buffer size) [required=" + (total >> 20) + "MB, available=" + (ram >> 20) + "MB]");
+ U.quietAndWarn(log, "Nodes started on local machine require more than 80% of physical RAM what can " +
+ "lead to significant slowdown due to swapping (please decrease JVM heap size, memory policy " +
+ "size or checkpoint buffer size) [required=" + (total >> 20) + "MB, available=" +
+ (ram >> 20) + "MB]");
}
}
}
[03/23] ignite git commit: IGNITE-6182 Change default max memory size
from 80% to 20%
Posted by pt...@apache.org.
IGNITE-6182 Change default max memory size from 80% to 20%
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bd7bd226
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bd7bd226
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bd7bd226
Branch: refs/heads/ignite-5896
Commit: bd7bd226d959fbc686f6104a048106b7b944347b
Parents: 55e0b5c
Author: Igor Seliverstov <gv...@gmail.com>
Authored: Fri Sep 1 12:56:56 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Sep 1 12:56:56 2017 +0300
----------------------------------------------------------------------
.../configuration/MemoryConfiguration.java | 4 +-
.../apache/ignite/internal/IgniteKernal.java | 21 +++++++--
.../ignite/internal/IgniteNodeAttributes.java | 3 ++
.../discovery/GridDiscoveryManager.java | 49 +++++++++++++++++++-
.../GridCacheDatabaseSharedManager.java | 39 +++++++++-------
.../Configuration/MemoryPolicyConfiguration.cs | 4 +-
6 files changed, 95 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd7bd226/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
index f83d7d0..8b59c4f 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/MemoryConfiguration.java
@@ -67,9 +67,9 @@ public class MemoryConfiguration implements Serializable {
public static final long DFLT_MEMORY_POLICY_INITIAL_SIZE = 256L * 1024 * 1024;
/** Fraction of available memory to allocate for default MemoryPolicy. */
- private static final double DFLT_MEMORY_POLICY_FRACTION = 0.8;
+ private static final double DFLT_MEMORY_POLICY_FRACTION = 0.2;
- /** Default memory policy's size is 80% of physical memory available on current machine. */
+ /** Default memory policy's size is 20% of physical memory available on current machine. */
public static final long DFLT_MEMORY_POLICY_MAX_SIZE = Math.max(
(long)(DFLT_MEMORY_POLICY_FRACTION * U.getTotalMemoryAvailable()),
DFLT_MEMORY_POLICY_INITIAL_SIZE);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd7bd226/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index e926653..549fcb5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -233,6 +233,7 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_NODE_CONSISTE
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PHY_RAM;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PREFIX;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_OFFHEAP_SIZE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_RESTART_ENABLED;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_PORT_RANGE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SPI_CLASS;
@@ -1383,19 +1384,33 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
String macs = ctx.discovery().localNode().attribute(ATTR_MACS);
long totalHeap = 0;
+ long totalOffheap = 0;
for (ClusterNode node : ctx.discovery().allNodes()) {
if (macs.equals(node.attribute(ATTR_MACS))) {
long heap = node.metrics().getHeapMemoryMaximum();
+ Long offheap = node.<Long>attribute(ATTR_OFFHEAP_SIZE);
if (heap != -1)
totalHeap += heap;
+
+ if (offheap != null)
+ totalOffheap += offheap;
}
}
- if (totalHeap > ram) {
- U.quietAndWarn(log, "Attempting to start more nodes than physical RAM " +
- "available on current host (this can cause significant slowdown)");
+ long total = totalHeap + totalOffheap;
+
+ if (total < 0)
+ total = Long.MAX_VALUE;
+
+ // 4GB or 20% of available memory is expected to be used by OS and user applications
+ long safeToUse = ram - Math.max(4L << 30, (long)(ram * 0.2));
+
+ if (total > safeToUse) {
+ U.quietAndWarn(log, "Attempting to start more nodes than physical RAM available on the host " +
+ "what can lead to significant slowdown (please decrease JVM heap size, memory policy size or " +
+ "checkpoint buffer size) [required=" + (total >> 20) + "MB, available=" + (ram >> 20) + "MB]");
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd7bd226/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index ab6c290..024f339 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -124,6 +124,9 @@ public final class IgniteNodeAttributes {
public static final String ATTR_PHY_RAM = ATTR_PREFIX + ".phy.ram";
/** Internal attribute name constant. */
+ public static final String ATTR_OFFHEAP_SIZE = ATTR_PREFIX + ".offheap.size";
+
+ /** Internal attribute name constant. */
public static final String ATTR_JVM_PID = ATTR_PREFIX + ".jvm.pid";
/** Internal attribute name constant. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd7bd226/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index d426ca5..74f7fa6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -55,6 +55,8 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.ClusterMetricsSnapshot;
@@ -64,7 +66,6 @@ import org.apache.ignite.internal.GridNodeOrderComparator;
import org.apache.ignite.internal.IgniteClientDisconnectedCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.IgniteNodeAttributes;
import org.apache.ignite.internal.events.DiscoveryCustomEvent;
import org.apache.ignite.internal.managers.GridManagerAdapter;
import org.apache.ignite.internal.managers.communication.GridIoManager;
@@ -76,6 +77,7 @@ import org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage;
import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage;
import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
@@ -141,7 +143,9 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_LATE_AFFINITY
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_BINARY_STRING_SER_VER_2;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER_USE_DFLT_SUID;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_OFFHEAP_SIZE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
+import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PHY_RAM;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SECURITY_COMPATIBILITY_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_SERVICES_COMPATIBILITY_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_USER_NAME;
@@ -485,7 +489,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
// No-op.
}
- ctx.addNodeAttribute(IgniteNodeAttributes.ATTR_PHY_RAM, totSysMemory);
+ ctx.addNodeAttribute(ATTR_PHY_RAM, totSysMemory);
+ ctx.addNodeAttribute(ATTR_OFFHEAP_SIZE, requiredOffheap());
DiscoverySpi spi = getSpi();
@@ -1518,6 +1523,46 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
}
/**
+ * @return Required offheap memory in bytes.
+ */
+ private long requiredOffheap() {
+ if(ctx.config().isClientMode())
+ return 0;
+
+ MemoryConfiguration memCfg = ctx.config().getMemoryConfiguration();
+
+ assert memCfg != null;
+
+ long res = memCfg.getSystemCacheMaxSize();
+
+ // Add memory policies.
+ MemoryPolicyConfiguration[] memPlcCfgs = memCfg.getMemoryPolicies();
+
+ if (memPlcCfgs != null) {
+ String dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
+
+ boolean customDflt = false;
+
+ for (MemoryPolicyConfiguration memPlcCfg : memPlcCfgs) {
+ if(F.eq(dfltMemPlcName, memPlcCfg.getName()))
+ customDflt = true;
+
+ res += memPlcCfg.getMaxSize();
+ }
+
+ if(!customDflt)
+ res += memCfg.getDefaultMemoryPolicySize();
+ }
+ else
+ res += memCfg.getDefaultMemoryPolicySize();
+
+ // Add persistence (if any).
+ res += GridCacheDatabaseSharedManager.checkpointBufferSize(ctx.config());
+
+ return res;
+ }
+
+ /**
* @param topVer Topology version.
* @param srvNodesNum Server nodes number.
* @param clientNodesNum Client nodes number.
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd7bd226/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index c59cccc..4db0bf8 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -380,8 +380,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
*
*/
private void initDataBase() {
- long cpBufSize = persistenceCfg.getCheckpointingPageBufferSize();
-
if (persistenceCfg.getCheckpointingThreads() > 1)
asyncRunner = new IgniteThreadPoolExecutor(
"checkpoint-runner",
@@ -392,12 +390,27 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
new LinkedBlockingQueue<Runnable>()
);
- // Intentionally use identity comparison to check if configuration default has changed.
- //noinspection NumberEquality
- if (cpBufSize == 0L) {
- cpBufSize = DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE;
+ checkpointPageBufSize = checkpointBufferSize(cctx.kernalContext().config());
+ }
+
+ /**
+ * Get checkpoint buffer size for the given configuration.
+ *
+ * @param cfg Configuration.
+ * @return Checkpoint buffer size.
+ */
+ public static long checkpointBufferSize(IgniteConfiguration cfg) {
+ PersistentStoreConfiguration persistenceCfg = cfg.getPersistentStoreConfiguration();
- MemoryConfiguration memCfg = cctx.kernalContext().config().getMemoryConfiguration();
+ if (persistenceCfg == null)
+ return 0L;
+
+ long res = persistenceCfg.getCheckpointingPageBufferSize();
+
+ if (res == 0L) {
+ res = DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE;
+
+ MemoryConfiguration memCfg = cfg.getMemoryConfiguration();
assert memCfg != null;
@@ -424,17 +437,11 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
long adjusted = Math.min(totalSize / 4, dfltSize);
- if (cpBufSize < adjusted) {
- U.quietAndInfo(log,
- "Default checkpoint page buffer size is too small, setting to an adjusted value: "
- + U.readableSize(adjusted, false)
- );
-
- cpBufSize = adjusted;
- }
+ if (res < adjusted)
+ res = adjusted;
}
- checkpointPageBufSize = cpBufSize;
+ return res;
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd7bd226/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
index c1fcaa2..16d8dcc 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
@@ -45,9 +45,9 @@ namespace Apache.Ignite.Core.Cache.Configuration
public const long DefaultInitialSize = 256 * 1024 * 1024;
/// <summary>
- /// The default maximum size, equals to 80% of total RAM.
+ /// The default maximum size, equals to 20% of total RAM.
/// </summary>
- public static readonly long DefaultMaxSize = (long) ((long) NativeMethods.GetTotalPhysicalMemory() * 0.8);
+ public static readonly long DefaultMaxSize = (long) ((long) NativeMethods.GetTotalPhysicalMemory() * 0.2);
/// <summary>
/// The default sub intervals.
[22/23] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by pt...@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/e7912543
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e7912543
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e7912543
Branch: refs/heads/ignite-5896
Commit: e79125436e04d1d1fd13ed935e3064d998685d83
Parents: 35d3d61 ce2a98c
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 5 10:54:31 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 5 10:54:31 2017 +0300
----------------------------------------------------------------------
.../internal/jdbc2/JdbcMetadataSelfTest.java | 19 +
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 6 +
.../thin/JdbcThinComplexDmlDdlSelfTest.java | 486 +++++++++++++++++++
.../JdbcThinMissingLongArrayResultsTest.java | 341 +++++++++++++
.../org/apache/ignite/cache/QueryIndex.java | 5 +-
.../configuration/MemoryConfiguration.java | 4 +-
.../internal/DuplicateTypeIdException.java | 74 +++
.../apache/ignite/internal/IgniteKernal.java | 22 +-
.../ignite/internal/IgniteNodeAttributes.java | 3 +
.../ignite/internal/MarshallerContextImpl.java | 24 +-
.../ignite/internal/binary/BinaryContext.java | 52 +-
.../binary/builder/BinaryObjectBuilderImpl.java | 2 +
.../internal/jdbc/JdbcDatabaseMetadata.java | 2 +-
.../internal/jdbc/thin/JdbcThinConnection.java | 6 +-
.../jdbc/thin/JdbcThinDatabaseMetadata.java | 3 +-
.../internal/jdbc/thin/JdbcThinStatement.java | 2 +-
.../internal/jdbc2/JdbcDatabaseMetadata.java | 35 +-
.../discovery/GridDiscoveryManager.java | 49 +-
.../cache/binary/BinaryMetadataTransport.java | 14 +-
.../dht/preloader/GridDhtPartitionMap.java | 24 +-
.../GridCacheDatabaseSharedManager.java | 39 +-
.../processors/odbc/SqlListenerUtils.java | 6 +
.../odbc/odbc/OdbcRequestHandler.java | 17 +-
.../processors/odbc/odbc/OdbcUtils.java | 22 +
.../apache/ignite/internal/util/typedef/X.java | 4 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 16 +-
.../BinaryObjectBuilderAdditionalSelfTest.java | 22 +
.../binary/BinaryMetadataUpdatesFlowTest.java | 48 ++
...pClientDiscoveryMarshallerCheckSelfTest.java | 84 +++-
modules/platforms/cpp/odbc-test/Makefile.am | 3 +-
.../cpp/odbc-test/project/vs/odbc-test.vcxproj | 8 +-
.../cpp/odbc-test/src/queries_test.cpp | 126 ++++-
.../cpp/odbc/include/ignite/odbc/cursor.h | 7 +
modules/platforms/cpp/odbc/src/cursor.cpp | 5 +
.../platforms/cpp/odbc/src/query/data_query.cpp | 2 +-
modules/platforms/cpp/odbc/src/statement.cpp | 32 +-
.../Binary/BinarySelfTest.cs | 7 +-
.../Cache/CacheAbstractTest.cs | 50 +-
.../Compute/ComputeApiTest.cs | 6 +
.../Apache.Ignite.Core.csproj | 2 +
.../Configuration/MemoryPolicyConfiguration.cs | 4 +-
.../Impl/Binary/BinaryObjectBuilder.cs | 132 ++---
.../Impl/Binary/BinaryObjectSchemaSerializer.cs | 12 +-
.../Impl/Binary/BinaryProcessor.cs | 2 +-
.../Impl/Binary/BinaryReader.cs | 110 ++---
.../Impl/Binary/BinarySystemHandlers.cs | 157 ++----
.../Impl/Binary/BinaryTypeId.cs | 228 +++++++++
.../Impl/Binary/BinaryUtils.cs | 155 +-----
.../Impl/Binary/BinaryWriter.cs | 161 +++---
.../Impl/Binary/BinaryWriterExtensions.cs | 4 +-
.../Impl/Binary/Marshaller.cs | 32 +-
.../Impl/Binary/Metadata/BinaryType.cs | 62 +--
.../Impl/Cache/CacheAffinityImpl.cs | 2 +-
.../Impl/Cache/CacheEntryFilterHolder.cs | 2 +-
.../Impl/Cache/CacheEntryProcessorHolder.cs | 4 +-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 2 +-
.../Impl/Cache/Store/CacheStoreInternal.cs | 14 +-
.../Impl/Cluster/ClusterGroupImpl.cs | 2 +-
.../Impl/Compute/Closure/ComputeActionJob.cs | 4 +-
.../Impl/Compute/Closure/ComputeFuncJob.cs | 6 +-
.../Impl/Compute/Closure/ComputeOutFuncJob.cs | 4 +-
.../Closure/ComputeReducingClosureTask.cs | 2 +-
.../Compute/Closure/IComputeResourceInjector.cs | 2 +-
.../Impl/Compute/ComputeFunc.cs | 2 +-
.../Impl/Compute/ComputeJob.cs | 2 +-
.../Impl/Compute/ComputeJobHolder.cs | 21 +-
.../Impl/Compute/ComputeOutFunc.cs | 2 +-
.../Impl/Deployment/PeerAssemblyResolver.cs | 13 +-
.../Impl/Deployment/PeerLoadingExtensions.cs | 4 +-
.../Impl/Deployment/PeerLoadingObjectHolder.cs | 4 +-
.../Apache.Ignite.Core/Impl/ExceptionUtils.cs | 8 +-
.../Apache.Ignite.Core/Impl/IIgniteInternal.cs | 69 +++
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 13 +-
.../Impl/Messaging/MessageListenerHolder.cs | 4 +-
.../Impl/PlatformTargetAdapter.cs | 13 +-
.../Impl/Resource/ResourceProcessor.cs | 2 +-
.../Impl/Resource/ResourceTypeDescriptor.cs | 2 +-
modules/platforms/dotnet/README.md | 2 +-
.../cache/jdbc/JdbcAbstractBenchmark.java | 4 +-
.../yardstick/cache/jdbc/RdbmsBenchmark.java | 6 +-
80 files changed, 2211 insertions(+), 742 deletions(-)
----------------------------------------------------------------------
[06/23] ignite git commit: IGNITE-5869 Client hangs in case of binary
configuration compact footer of client node differs from server node
Posted by pt...@apache.org.
IGNITE-5869 Client hangs in case of binary configuration compact footer of client node differs from server node
Signed-off-by: Andrey Gura <ag...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ccc334d6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ccc334d6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ccc334d6
Branch: refs/heads/ignite-5896
Commit: ccc334d62de5b51f5d31d7064d1de4b0245e8232
Parents: 72608a5
Author: Evgeny Stanilovskiy <es...@gridgain.com>
Authored: Fri Sep 1 15:46:57 2017 +0300
Committer: Andrey Gura <ag...@apache.org>
Committed: Fri Sep 1 17:25:53 2017 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ServerImpl.java | 12 ++-
...pClientDiscoveryMarshallerCheckSelfTest.java | 85 ++++++++++++++++++--
2 files changed, 89 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ccc334d6/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 5d7e39e..7dc94d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -3534,7 +3534,7 @@ class ServerImpl extends TcpDiscoveryImpl {
try {
trySendMessageDirectly(node,
- new TcpDiscoveryCheckFailedMessage(locNodeId, err.sendMessage()));
+ new TcpDiscoveryCheckFailedMessage(err.nodeId(), err.sendMessage()));
}
catch (IgniteSpiException e) {
if (log.isDebugEnabled())
@@ -6073,6 +6073,16 @@ class ServerImpl extends TcpDiscoveryImpl {
else {
ignored = true;
+ ClientMessageWorker worker = clientMsgWorkers.get(msg.creatorNodeId());
+
+ if (worker != null) {
+ msg.verify(getLocalNodeId());
+ worker.addMessage(msg);
+ }
+ else if (log.isDebugEnabled())
+ log.debug("Failed to find client message worker " +
+ "[clientNode=" + msg.creatorNodeId() + ']');
+
state = spiState;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ccc334d6/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
index 1a88b11..f88a9ea 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
@@ -17,8 +17,11 @@
package org.apache.ignite.spi.discovery.tcp;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.marshaller.jdk.JdkMarshaller;
import org.apache.ignite.spi.IgniteSpiException;
@@ -33,19 +36,41 @@ public class TcpClientDiscoveryMarshallerCheckSelfTest extends GridCommonAbstrac
/** */
private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+ /** */
+ private boolean testFooter;
+
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
- if (igniteInstanceName.endsWith("0"))
- cfg.setMarshaller(new JdkMarshaller());
- else {
- cfg.setClientMode(true);
-
+ if (testFooter) {
cfg.setMarshaller(new BinaryMarshaller());
+
+ TcpDiscoverySpi spi = new TcpDiscoverySpi();
+
+ spi.setJoinTimeout(-1); // IGNITE-605, and further tests limitation bypass
+
+ cfg.setDiscoverySpi(spi);
+
+ if (igniteInstanceName.endsWith("0")) {
+ cfg.setClientMode(true);
+ BinaryConfiguration bc = new BinaryConfiguration();
+ bc.setCompactFooter(false);
+ cfg.setBinaryConfiguration(bc);
+ }
}
+ else {
+ if (igniteInstanceName.endsWith("0"))
+ cfg.setMarshaller(new JdkMarshaller());
+ else {
+ cfg.setClientMode(true);
+ cfg.setMarshaller(new BinaryMarshaller());
+ }
- cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder));
+ TcpDiscoverySpi spi = new TcpDiscoverySpi().setIpFinder(ipFinder);
+
+ cfg.setDiscoverySpi(spi);
+ }
return cfg;
}
@@ -73,4 +98,50 @@ public class TcpClientDiscoveryMarshallerCheckSelfTest extends GridCommonAbstrac
assertTrue(ex.getMessage().contains("Local node's marshaller differs from remote node's marshaller"));
}
}
-}
\ No newline at end of file
+
+ /**
+ * Starts client-server grid with different binary configurations.
+ *
+ * @throws Exception If failed.
+ */
+ private void clientServerInconsistentConfigFail(boolean multiNodes) throws Exception {
+ testFooter = true;
+
+ IgniteEx ig0 = startGrid(1);
+ IgniteCache ic = ig0.getOrCreateCache("cahe_name");
+ if (multiNodes)
+ startGrid(2);
+
+ try {
+ IgniteEx ig = startGrid(0);
+
+ for (String c : ig.cacheNames())
+ System.out.println(c);
+
+ fail("Expected SPI exception was not thrown, multiNodes=" + multiNodes);
+ } catch (IgniteCheckedException expect) {
+ Throwable ex = expect.getCause().getCause();
+
+ assertTrue(ex instanceof IgniteSpiException);
+ assertTrue("Catched exception: " + ex.getMessage(), ex.getMessage().contains("Local node's binary " +
+ "configuration is not equal to remote node's binary configuration"));
+ } finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInconsistentFooterConfigSingle() throws Exception {
+ clientServerInconsistentConfigFail(false);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testInconsistentFooterConfigMulti() throws Exception {
+ for (int i = 0; i < 10; ++i)
+ clientServerInconsistentConfigFail(true);
+ }
+}
[12/23] ignite git commit: IGNITE-6139: JDBC thick driver: fixed
driver versions. This closes #2552.
Posted by pt...@apache.org.
IGNITE-6139: JDBC thick driver: fixed driver versions. This closes #2552.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9d35ea0e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9d35ea0e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9d35ea0e
Branch: refs/heads/ignite-5896
Commit: 9d35ea0e000059b7d63e7558534efa87055afab1
Parents: 4b655a0
Author: Ilya Kasnacheev <il...@gmail.com>
Authored: Mon Sep 4 13:56:25 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Sep 4 13:56:25 2017 +0300
----------------------------------------------------------------------
.../internal/jdbc2/JdbcMetadataSelfTest.java | 19 +++++++++++
.../internal/jdbc2/JdbcDatabaseMetadata.java | 33 ++++++++++----------
2 files changed, 36 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9d35ea0e/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
index bc4ef5b..a8611b9 100755
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
@@ -41,6 +41,7 @@ import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteVersionUtils;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
@@ -397,6 +398,24 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testVersions() throws Exception {
+ try (Connection conn = DriverManager.getConnection(BASE_URL)) {
+ assertEquals("Apache Ignite", conn.getMetaData().getDatabaseProductName());
+ assertEquals("Ignite JDBC Driver", conn.getMetaData().getDriverName());
+ assertEquals(IgniteVersionUtils.VER.toString(), conn.getMetaData().getDatabaseProductVersion());
+ assertEquals(IgniteVersionUtils.VER.toString(), conn.getMetaData().getDriverVersion());
+ assertEquals(IgniteVersionUtils.VER.major(), conn.getMetaData().getDatabaseMajorVersion());
+ assertEquals(IgniteVersionUtils.VER.major(), conn.getMetaData().getDriverMajorVersion());
+ assertEquals(IgniteVersionUtils.VER.minor(), conn.getMetaData().getDatabaseMinorVersion());
+ assertEquals(IgniteVersionUtils.VER.minor(), conn.getMetaData().getDriverMinorVersion());
+ assertEquals(4, conn.getMetaData().getJDBCMajorVersion());
+ assertEquals(1, conn.getMetaData().getJDBCMinorVersion());
+ }
+ }
+
+ /**
* Person.
*/
@SuppressWarnings("UnusedDeclaration")
http://git-wip-us.apache.org/repos/asf/ignite/blob/9d35ea0e/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
index ac8d9ce..1ccdbcd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc2/JdbcDatabaseMetadata.java
@@ -32,6 +32,7 @@ import java.util.Map;
import java.util.UUID;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
+import org.apache.ignite.internal.IgniteVersionUtils;
import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata;
import org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata;
@@ -117,7 +118,17 @@ public class JdbcDatabaseMetadata implements DatabaseMetaData {
/** {@inheritDoc} */
@Override public String getDatabaseProductVersion() {
- return "4.1.0";
+ return IgniteVersionUtils.VER.toString();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getDatabaseMajorVersion() {
+ return IgniteVersionUtils.VER.major();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getDatabaseMinorVersion() {
+ return IgniteVersionUtils.VER.minor();
}
/** {@inheritDoc} */
@@ -127,17 +138,17 @@ public class JdbcDatabaseMetadata implements DatabaseMetaData {
/** {@inheritDoc} */
@Override public String getDriverVersion() {
- return "1.0";
+ return IgniteVersionUtils.VER.toString();
}
/** {@inheritDoc} */
@Override public int getDriverMajorVersion() {
- return 1;
+ return IgniteVersionUtils.VER.major();
}
/** {@inheritDoc} */
@Override public int getDriverMinorVersion() {
- return 0;
+ return IgniteVersionUtils.VER.minor();
}
/** {@inheritDoc} */
@@ -1174,23 +1185,13 @@ public class JdbcDatabaseMetadata implements DatabaseMetaData {
}
/** {@inheritDoc} */
- @Override public int getDatabaseMajorVersion() {
- return 1;
- }
-
- /** {@inheritDoc} */
- @Override public int getDatabaseMinorVersion() {
- return 0;
- }
-
- /** {@inheritDoc} */
@Override public int getJDBCMajorVersion() {
- return 1;
+ return 4;
}
/** {@inheritDoc} */
@Override public int getJDBCMinorVersion() {
- return 0;
+ return 1;
}
/** {@inheritDoc} */
[14/23] ignite git commit: IGNITE-3987: ODBC: Improved error output
when query parsing failed.
Posted by pt...@apache.org.
IGNITE-3987: ODBC: Improved error output when query parsing failed.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/29ce1fa8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/29ce1fa8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/29ce1fa8
Branch: refs/heads/ignite-5896
Commit: 29ce1fa8190c806c0d041be6ead8c76f785fcf08
Parents: dc6b73b
Author: Igor Sapego <is...@gridgain.com>
Authored: Mon Sep 4 16:20:20 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Mon Sep 4 16:20:20 2017 +0300
----------------------------------------------------------------------
.../odbc/odbc/OdbcRequestHandler.java | 17 ++++++--------
.../processors/odbc/odbc/OdbcUtils.java | 22 ++++++++++++++++++
modules/platforms/cpp/odbc-test/Makefile.am | 3 ++-
.../cpp/odbc-test/project/vs/odbc-test.vcxproj | 8 +++----
.../cpp/odbc-test/src/queries_test.cpp | 24 ++++++++++++++++++--
5 files changed, 57 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/29ce1fa8/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
index 692043c..679a2e6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
@@ -57,9 +57,6 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
/** Query ID sequence. */
private static final AtomicLong QRY_ID_GEN = new AtomicLong();
- /** Batch query ID sequence. */
- private static final AtomicLong BATCH_QRY_ID_GEN = new AtomicLong();
-
/** Kernel context. */
private final GridKernalContext ctx;
@@ -210,7 +207,7 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
U.error(log, "Failed to execute SQL query [reqId=" + req.requestId() + ", req=" + req + ']', e);
- return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, OdbcUtils.retrieveH2ErrorMessage(e));
}
}
@@ -265,7 +262,7 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
U.error(log, "Failed to execute SQL query [reqId=" + req.requestId() + ", req=" + req + ']', e);
OdbcQueryExecuteBatchResult res = new OdbcQueryExecuteBatchResult(rowsAffected, currentSet,
- e.getMessage());
+ OdbcUtils.retrieveH2ErrorMessage(e));
return new OdbcResponse(res);
}
@@ -334,7 +331,7 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
U.error(log, "Failed to close SQL query [reqId=" + req.requestId() + ", req=" + queryId + ']', e);
- return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, OdbcUtils.retrieveH2ErrorMessage(e));
}
}
@@ -383,7 +380,7 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
catch (Exception e) {
U.error(log, "Failed to fetch SQL query result [reqId=" + req.requestId() + ", req=" + req + ']', e);
- return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, OdbcUtils.retrieveH2ErrorMessage(e));
}
}
@@ -448,7 +445,7 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
catch (Exception e) {
U.error(log, "Failed to get columns metadata [reqId=" + req.requestId() + ", req=" + req + ']', e);
- return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, OdbcUtils.retrieveH2ErrorMessage(e));
}
}
@@ -496,7 +493,7 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
catch (Exception e) {
U.error(log, "Failed to get tables metadata [reqId=" + req.requestId() + ", req=" + req + ']', e);
- return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, OdbcUtils.retrieveH2ErrorMessage(e));
}
}
@@ -527,7 +524,7 @@ public class OdbcRequestHandler implements SqlListenerRequestHandler {
catch (Exception e) {
U.error(log, "Failed to get params metadata [reqId=" + req.requestId() + ", req=" + req + ']', e);
- return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, e.toString());
+ return new OdbcResponse(SqlListenerResponse.STATUS_FAILED, OdbcUtils.retrieveH2ErrorMessage(e));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/29ce1fa8/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcUtils.java
index 9bdd0c7..3578145 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcUtils.java
@@ -139,4 +139,26 @@ public class OdbcUtils {
throw new IgniteException("Invalid ODBC data type '" + odbcDataType + "'");
}
}
+
+ /**
+ * Retrieves error message from exception.
+ * @param err Exception.
+ * @return Error message.
+ */
+ public static String retrieveH2ErrorMessage(Throwable err) {
+ String msg = err.getMessage();
+
+ Throwable e = err.getCause();
+ while (e != null) {
+ if (e.getClass().getCanonicalName().equals("org.h2.jdbc.JdbcSQLException")) {
+ msg = e.getMessage();
+
+ break;
+ }
+
+ e = e.getCause();
+ }
+
+ return msg;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/29ce1fa8/modules/platforms/cpp/odbc-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/Makefile.am b/modules/platforms/cpp/odbc-test/Makefile.am
index 1d65468..7756181 100644
--- a/modules/platforms/cpp/odbc-test/Makefile.am
+++ b/modules/platforms/cpp/odbc-test/Makefile.am
@@ -46,7 +46,8 @@ ignite_odbc_tests_LDADD = \
@top_srcdir@/core/libignite.la \
-ldl \
-lodbc \
- -lpthread
+ -lpthread \
+ -lboost_regex
ignite_odbc_tests_LDFLAGS = \
-static-libtool-libs
http://git-wip-us.apache.org/repos/asf/ignite/blob/29ce1fa8/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
index ceecb3d..d06064b 100644
--- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
+++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj
@@ -97,7 +97,7 @@
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;$(BOOST_HOME)\lib32-msvc-10.0\libboost_unit_test_framework-vc100-mt-gd-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;$(BOOST_HOME)\lib32-msvc-10.0\libboost_unit_test_framework-vc100-mt-gd-1_58.lib;$(BOOST_HOME)\lib32-msvc-10.0\libboost_regex-vc100-mt-gd-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -111,7 +111,7 @@
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-gd-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-gd-1_58.lib;$(BOOST_HOME)\lib64-msvc-10.0\libboost_regex-vc100-mt-gd-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
@@ -130,7 +130,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;$(BOOST_HOME)\lib32-msvc-10.0\libboost_unit_test_framework-vc100-mt-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;$(BOOST_HOME)\lib32-msvc-10.0\libboost_unit_test_framework-vc100-mt-1_58.lib;$(BOOST_HOME)\lib32-msvc-10.0\libboost_regex-vc100-mt-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -148,7 +148,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-1_58.lib;$(BOOST_HOME)\lib64-msvc-10.0\libboost_regex-vc100-mt-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
http://git-wip-us.apache.org/repos/asf/ignite/blob/29ce1fa8/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index c7892ac..3dc538b 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -30,6 +30,7 @@
# define BOOST_TEST_DYN_LINK
#endif
+#include <boost/regex.hpp>
#include <boost/test/unit_test.hpp>
#include "ignite/ignite.h"
@@ -1650,7 +1651,7 @@ BOOST_AUTO_TEST_CASE(TestInsertBatchSelect1000)
BOOST_AUTO_TEST_CASE(TestInsertBatchSelect1023)
{
- InsertBatchSelect(1024);
+ InsertBatchSelect(1023);
}
BOOST_AUTO_TEST_CASE(TestInsertBatchSelect1024)
@@ -1670,7 +1671,7 @@ BOOST_AUTO_TEST_CASE(TestInsertBatchSelect2000)
BOOST_AUTO_TEST_CASE(TestInsertBatchSelect2047)
{
- InsertBatchSelect(2048);
+ InsertBatchSelect(2047);
}
BOOST_AUTO_TEST_CASE(TestInsertBatchSelect2048)
@@ -2098,4 +2099,23 @@ BOOST_AUTO_TEST_CASE(TestBindNullParameter)
BOOST_CHECK_EQUAL(strFieldLen, SQL_NULL_DATA);
}
+BOOST_AUTO_TEST_CASE(TestErrorMessage)
+{
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;SCHEMA=cache");
+
+ // Just selecting everything to make sure everything is OK
+ SQLCHAR selectReq[] = "SELECT a FROM B";
+
+ SQLRETURN ret = SQLExecDirect(stmt, selectReq, sizeof(selectReq));
+
+ BOOST_REQUIRE_EQUAL(ret, SQL_ERROR);
+
+ std::string error = GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt);
+ std::string pattern = "HY000: Table \"B\" not found; SQL statement:\\vSELECT a FROM B.*";
+
+ boost::cmatch what;
+ if (!boost::regex_match(error.c_str(), what, boost::regex(pattern)))
+ BOOST_FAIL("'" + error + "' does not match '" + pattern + "'");
+}
+
BOOST_AUTO_TEST_SUITE_END()
[13/23] ignite git commit: IGNITE-6188: ODBC: Fix for
SQLFreeStmt(SQL_CLOSE).
Posted by pt...@apache.org.
IGNITE-6188: ODBC: Fix for SQLFreeStmt(SQL_CLOSE).
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dc6b73b9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dc6b73b9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dc6b73b9
Branch: refs/heads/ignite-5896
Commit: dc6b73b94c091875d02965afd3bc4668a890fa52
Parents: 9d35ea0
Author: Igor Sapego <is...@gridgain.com>
Authored: Mon Sep 4 15:34:59 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Mon Sep 4 15:34:59 2017 +0300
----------------------------------------------------------------------
.../cpp/odbc-test/src/queries_test.cpp | 51 ++++++++++++++++++++
.../cpp/odbc/include/ignite/odbc/cursor.h | 7 +++
modules/platforms/cpp/odbc/src/cursor.cpp | 5 ++
.../platforms/cpp/odbc/src/query/data_query.cpp | 2 +-
4 files changed, 64 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc6b73b9/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index 5d10a66..c7892ac 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -1996,6 +1996,57 @@ BOOST_AUTO_TEST_CASE(TestExecuteAfterCursorClose)
BOOST_CHECK_EQUAL(ret, SQL_NO_DATA);
}
+BOOST_AUTO_TEST_CASE(TestCloseNonFullFetch)
+{
+ TestType in1;
+ TestType in2;
+
+ in1.strField = "str1";
+ in2.strField = "str2";
+
+ cache1.Put(1, in1);
+ cache1.Put(2, in2);
+
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;SCHEMA=cache");
+
+ int64_t key = 0;
+ char strField[1024] = { 0 };
+ SQLLEN strFieldLen = 0;
+
+ // Binding columns.
+ SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &key, 0, 0);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Binding columns.
+ ret = SQLBindCol(stmt, 2, SQL_C_CHAR, &strField, sizeof(strField), &strFieldLen);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Just selecting everything to make sure everything is OK
+ SQLCHAR selectReq[] = "SELECT _key, strField FROM TestType ORDER BY _key";
+
+ ret = SQLExecDirect(stmt, selectReq, sizeof(selectReq));
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLFetch(stmt);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ BOOST_CHECK_EQUAL(key, 1);
+ BOOST_CHECK_EQUAL(std::string(strField, strFieldLen), "str1");
+
+ ret = SQLFreeStmt(stmt, SQL_CLOSE);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+}
+
BOOST_AUTO_TEST_CASE(TestBindNullParameter)
{
Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;SCHEMA=cache");
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc6b73b9/modules/platforms/cpp/odbc/include/ignite/odbc/cursor.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/cursor.h b/modules/platforms/cpp/odbc/include/ignite/odbc/cursor.h
index fa6de30..c387f92 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/cursor.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/cursor.h
@@ -70,6 +70,13 @@ namespace ignite
bool HasData() const;
/**
+ * Check whether cursor closed remotely.
+ *
+ * @return true, if the cursor closed remotely.
+ */
+ bool IsClosedRemotely() const;
+
+ /**
* Get query ID.
*
* @return Query ID.
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc6b73b9/modules/platforms/cpp/odbc/src/cursor.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/cursor.cpp b/modules/platforms/cpp/odbc/src/cursor.cpp
index 2648278..b41f5b1 100644
--- a/modules/platforms/cpp/odbc/src/cursor.cpp
+++ b/modules/platforms/cpp/odbc/src/cursor.cpp
@@ -64,6 +64,11 @@ namespace ignite
currentPagePos < currentPage->GetSize();
}
+ bool Cursor::IsClosedRemotely() const
+ {
+ return currentPage.get() && currentPage->IsLast();
+ }
+
void Cursor::UpdateData(std::auto_ptr<ResultPage>& newPage)
{
currentPage = newPage;
http://git-wip-us.apache.org/repos/asf/ignite/blob/dc6b73b9/modules/platforms/cpp/odbc/src/query/data_query.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/query/data_query.cpp b/modules/platforms/cpp/odbc/src/query/data_query.cpp
index f14d004..b9d551b 100644
--- a/modules/platforms/cpp/odbc/src/query/data_query.cpp
+++ b/modules/platforms/cpp/odbc/src/query/data_query.cpp
@@ -156,7 +156,7 @@ namespace ignite
SqlResult::Type result = SqlResult::AI_SUCCESS;
- if (cursor->HasData())
+ if (!cursor->IsClosedRemotely())
result = MakeRequestClose();
if (result == SqlResult::AI_SUCCESS)
[08/23] ignite git commit: .NET: Fix TeamCity build status icon in
Readme.md
Posted by pt...@apache.org.
.NET: Fix TeamCity build status icon in Readme.md
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/86bd544a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/86bd544a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/86bd544a
Branch: refs/heads/ignite-5896
Commit: 86bd544a557663bce497134f7826be6b24d53330
Parents: 726481c
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 4 09:18:29 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 4 09:18:29 2017 +0300
----------------------------------------------------------------------
modules/platforms/dotnet/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/86bd544a/modules/platforms/dotnet/README.md
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/README.md b/modules/platforms/dotnet/README.md
index cbdc7c9..1549f05 100644
--- a/modules/platforms/dotnet/README.md
+++ b/modules/platforms/dotnet/README.md
@@ -8,7 +8,7 @@
<a href="https://www.myget.org/gallery/apache-ignite-net-nightly"><img src="https://img.shields.io/myget/apache-ignite-net-nightly/vpre/Apache.Ignite.svg" /></a>
-<a href="http://ci.ignite.apache.org/viewType.html?buildTypeId=IgniteTests_IgnitePlatformNet&branch_IgniteTests=%3Cdefault%3E"><img src="http://ci.ignite.apache.org/app/rest/builds/buildType:(id:IgniteTests_IgnitePlatformNet)/statusIcon" /></a>
+<a href="http://ci.ignite.apache.org/viewType.html?buildTypeId=Ignite20Tests_IgnitePlatformNet&branch_IgniteTests=%3Cdefault%3E"><img src="http://ci.ignite.apache.org/app/rest/builds/buildType:(id:Ignite20Tests_IgnitePlatformNet)/statusIcon" /></a>
Apache Ignite In-Memory Data Fabric is designed to deliver uncompromised performance for a wide set of in-memory computing use cases from
[high performance computing](https://ignite.apache.org/features.html), to the industry most advanced [data grid](https://ignite.apache.org/features.html),
[15/23] ignite git commit: ignite-5966 IgniteCache#get() fails with
"Requesting mapping from grid failed" when deserialising binary object loaded
from CacheJdbcPojoStoreFactory
Posted by pt...@apache.org.
ignite-5966 IgniteCache#get() fails with "Requesting mapping from grid failed" when deserialising binary object loaded from CacheJdbcPojoStoreFactory
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/075f48dc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/075f48dc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/075f48dc
Branch: refs/heads/ignite-5896
Commit: 075f48dc6cbc8213e92de388251e99b98ce44f2c
Parents: 29ce1fa
Author: Alexey Kukushkin <Al...@yahoo.com>
Authored: Thu Aug 31 17:44:11 2017 +0300
Committer: Andrey Gura <ag...@apache.org>
Committed: Mon Sep 4 16:21:22 2017 +0300
----------------------------------------------------------------------
.../internal/DuplicateTypeIdException.java | 74 ++++++++++++++++++++
.../ignite/internal/MarshallerContextImpl.java | 24 +------
.../ignite/internal/binary/BinaryContext.java | 52 ++++++++++----
.../binary/builder/BinaryObjectBuilderImpl.java | 2 +
.../BinaryObjectBuilderAdditionalSelfTest.java | 22 ++++++
5 files changed, 139 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/075f48dc/modules/core/src/main/java/org/apache/ignite/internal/DuplicateTypeIdException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/DuplicateTypeIdException.java b/modules/core/src/main/java/org/apache/ignite/internal/DuplicateTypeIdException.java
new file mode 100644
index 0000000..9ca66ab
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/DuplicateTypeIdException.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import org.apache.ignite.IgniteCheckedException;
+
+/**
+ * The exception indicates a duplicate type ID was encountered.
+ */
+public class DuplicateTypeIdException extends IgniteCheckedException {
+ /** Serialization version. */
+ private static final long serialVersionUID = 0L;
+
+ /** Platform ID. */
+ private final byte platformId;
+
+ /** Type ID. */
+ private final int typeId;
+
+ /** Name of already registered class. */
+ private final String oldClsName;
+
+ /** Name of new class being registered. */
+ private final String newClsName;
+
+ /**
+ * Initializes new instance of {@link DuplicateTypeIdException} class.
+ *
+ * @param platformId Platform ID.
+ * @param typeId Type ID.
+ * @param oldClsName Name of already registered class.
+ * @param newClsName Name of new class being registered.
+ */
+ DuplicateTypeIdException(byte platformId, int typeId, String oldClsName, String newClsName) {
+ this.platformId = platformId;
+ this.typeId = typeId;
+ this.oldClsName = oldClsName;
+ this.newClsName = newClsName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getMessage() {
+ return "Duplicate ID [platformId="
+ + platformId
+ + ", typeId="
+ + typeId
+ + ", oldCls="
+ + oldClsName
+ + ", newCls="
+ + newClsName + ']';
+ }
+
+ /**
+ * @return Name of already registered class.
+ */
+ public String getRegisteredClassName() {
+ return oldClsName;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/075f48dc/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
index d133676..0b3f220 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
@@ -238,7 +238,7 @@ public class MarshallerContextImpl implements MarshallerContext {
if (mappedName != null) {
if (!mappedName.className().equals(clsName))
- throw duplicateIdException(platformId, typeId, mappedName.className(), clsName);
+ throw new DuplicateTypeIdException(platformId, typeId, mappedName.className(), clsName);
else {
if (mappedName.accepted())
return true;
@@ -289,28 +289,6 @@ public class MarshallerContextImpl implements MarshallerContext {
}
/**
- * @param platformId Platform id.
- * @param typeId Type id.
- * @param conflictingClsName Conflicting class name.
- * @param clsName Class name.
- */
- private IgniteCheckedException duplicateIdException(
- byte platformId,
- int typeId,
- String conflictingClsName,
- String clsName
- ) {
- return new IgniteCheckedException("Duplicate ID [platformId="
- + platformId
- + ", typeId="
- + typeId
- + ", oldCls="
- + conflictingClsName
- + ", newCls="
- + clsName + "]");
- }
-
- /**
*
* @param item type mapping to propose
* @return null if cache doesn't contain any mappings for given (platformId, typeId) pair,
http://git-wip-us.apache.org/repos/asf/ignite/blob/075f48dc/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 eaac7b8..afa40e6 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
@@ -64,6 +64,7 @@ import org.apache.ignite.cache.affinity.AffinityKeyMapped;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.internal.DuplicateTypeIdException;
import org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller;
import org.apache.ignite.internal.processors.cache.binary.BinaryMetadataKey;
import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
@@ -770,12 +771,7 @@ public class BinaryContext {
final int typeId = mapper.typeId(clsName);
- try {
- registered = marshCtx.registerClassName(JAVA_ID, typeId, cls.getName());
- }
- catch (IgniteCheckedException e) {
- throw new BinaryObjectException("Failed to register class.", e);
- }
+ registered = registerUserClassName(typeId, cls.getName());
BinarySerializer serializer = serializerForClass(cls);
@@ -813,12 +809,7 @@ public class BinaryContext {
private BinaryClassDescriptor registerUserClassDescriptor(BinaryClassDescriptor desc) {
boolean registered;
- try {
- registered = marshCtx.registerClassName(JAVA_ID, desc.typeId(), desc.describedClass().getName());
- }
- catch (IgniteCheckedException e) {
- throw new BinaryObjectException("Failed to register class.", e);
- }
+ registered = registerUserClassName(desc.typeId(), desc.describedClass().getName());
if (registered) {
BinarySerializer serializer = desc.initialSerializer();
@@ -1173,6 +1164,43 @@ public class BinaryContext {
}
/**
+ * Register "type ID to class name" mapping on all nodes to allow for mapping requests resolution form client.
+ * Other {@link BinaryContext}'s "register" methods and method
+ * {@link BinaryContext#descriptorForClass(Class, boolean)} already call this functionality so use this method
+ * only when registering class names whose {@link Class} is unknown.
+ *
+ * @param typeId Type ID.
+ * @param clsName Class Name.
+ * @return {@code True} if the mapping was registered successfully.
+ */
+ public boolean registerUserClassName(int typeId, String clsName) {
+ IgniteCheckedException e = null;
+
+ boolean res = false;
+
+ try {
+ res = marshCtx.registerClassName(JAVA_ID, typeId, clsName);
+ }
+ catch (DuplicateTypeIdException dupEx) {
+ // Ignore if trying to register mapped type name of the already registered class name and vise versa
+ BinaryInternalMapper mapper = userTypeMapper(typeId);
+
+ String oldName = dupEx.getRegisteredClassName();
+
+ if (!(mapper.typeName(oldName).equals(clsName) || mapper.typeName(clsName).equals(oldName)))
+ e = dupEx;
+ }
+ catch (IgniteCheckedException igniteEx) {
+ e = igniteEx;
+ }
+
+ if (e != null)
+ throw new BinaryObjectException("Failed to register class.", e);
+
+ return res;
+ }
+
+ /**
* Throw exception on class duplication.
*
* @param clsName Class name.
http://git-wip-us.apache.org/repos/asf/ignite/blob/075f48dc/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
index fa9f1c3..9108f89 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
@@ -357,6 +357,8 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
if (affFieldName0 == null)
affFieldName0 = ctx.affinityKeyFieldName(typeId);
+ ctx.registerUserClassName(typeId, typeName);
+
ctx.updateMetadata(typeId, new BinaryMetadata(typeId, typeName, fieldsMeta, affFieldName0,
Collections.singleton(curSchema), false, null));
http://git-wip-us.apache.org/repos/asf/ignite/blob/075f48dc/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
index 82ff383..4ac2758 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
@@ -56,6 +56,8 @@ import org.apache.ignite.binary.BinaryType;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.MarshallerPlatformIds;
import org.apache.ignite.internal.binary.builder.BinaryBuilderEnum;
import org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl;
import org.apache.ignite.internal.binary.mutabletest.GridBinaryMarshalerAwareTestClass;
@@ -64,6 +66,7 @@ import org.apache.ignite.internal.binary.test.GridBinaryTestClass2;
import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl;
import org.apache.ignite.internal.processors.cache.binary.IgniteBinaryImpl;
import org.apache.ignite.internal.util.lang.GridMapEntry;
+import org.apache.ignite.marshaller.MarshallerContext;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Assert;
@@ -1580,6 +1583,25 @@ public class BinaryObjectBuilderAdditionalSelfTest extends GridCommonAbstractTes
}
/**
+ * Test {@link BinaryObjectBuilder#build()} adds type mapping to the binary marshaller's cache.
+ */
+ public void testMarshallerMappings() throws IgniteCheckedException, ClassNotFoundException {
+ String typeName = "TestType";
+
+ int typeId = BinaryContext.defaultIdMapper().typeId(typeName);
+
+ BinaryObjectBuilder builder = newWrapper(typeName);
+
+ builder.build();
+
+ MarshallerContext marshCtx = grid(0).context().marshallerContext();
+
+ String actualTypeName = marshCtx.getClassName(MarshallerPlatformIds.JAVA_ID, typeId);
+
+ assertEquals(typeName, actualTypeName);
+ }
+
+ /**
* @param obj BinaryObject array.
* @return Deserialized enums.
*/
[07/23] ignite git commit: IGNITE-5750 Change HMSM format to
hh:mm:ss.mmm
Posted by pt...@apache.org.
IGNITE-5750 Change HMSM format to hh:mm:ss.mmm
Closes #2298
Signed-off-by: Konstantin Boudnik <ko...@epam.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/726481c6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/726481c6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/726481c6
Branch: refs/heads/ignite-5896
Commit: 726481c637b06e7801bfec05535adcef8d3f614b
Parents: db5880a
Author: Evgeniy Ignatiev <ev...@epam.com>
Authored: Thu Aug 24 10:25:08 2017 +0400
Committer: Konstantin Boudnik <ko...@epam.com>
Committed: Fri Sep 1 10:38:06 2017 -0700
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/internal/util/typedef/X.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/726481c6/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/X.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/X.java b/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/X.java
index 174ab86..395de23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/X.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/typedef/X.java
@@ -197,7 +197,7 @@ public final class X {
}
/**
- * Creates string presentation of given time {@code span} in hh:mm:ss:msec {@code HMSM} format.
+ * Creates string presentation of given time {@code span} in hh:mm:ss.msec {@code HMSM} format.
*
* @param span Time span.
* @return String presentation.
@@ -212,7 +212,7 @@ public final class X {
return (t[3] < 10 ? "0" + t[3] : Long.toString(t[3])) + ':' +
(t[2] < 10 ? "0" + t[2] : Long.toString(t[2])) + ':' +
- (t[1] < 10 ? "0" + t[1] : Long.toString(t[1])) + ':' +
+ (t[1] < 10 ? "0" + t[1] : Long.toString(t[1])) + '.' +
(t[0] < 10 ? "00" + t[0] : ( t[0] < 100 ? "0" + t[0] : Long.toString(t[0])));
}
[09/23] ignite git commit: IGNITE-6197: SQL: QueryIndex.setInlineSize
now returns this instead of void. This closes #2567.
Posted by pt...@apache.org.
IGNITE-6197: SQL: QueryIndex.setInlineSize now returns this instead of void. This closes #2567.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fe656eb8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fe656eb8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fe656eb8
Branch: refs/heads/ignite-5896
Commit: fe656eb80cf9c4a121fca75a4dfe4a8fd891a54c
Parents: 86bd544
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Mon Sep 4 13:19:50 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Sep 4 13:19:50 2017 +0300
----------------------------------------------------------------------
.../core/src/main/java/org/apache/ignite/cache/QueryIndex.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fe656eb8/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java
index ac7dd8e..f83f85c 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/QueryIndex.java
@@ -264,9 +264,12 @@ public class QueryIndex implements Serializable {
* Sets inline size.
*
* @param inlineSize Inline size.
+ * @return {@code this} for chaining.
*/
- public void setInlineSize(int inlineSize) {
+ public QueryIndex setInlineSize(int inlineSize) {
this.inlineSize = inlineSize;
+
+ return this;
}
/** {@inheritDoc} */
[23/23] ignite git commit: Merge branch 'master' into ignite-5896
Posted by pt...@apache.org.
Merge branch 'master' into ignite-5896
# Conflicts:
# modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4f8f0852
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4f8f0852
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4f8f0852
Branch: refs/heads/ignite-5896
Commit: 4f8f08522af1595582552da8348a1f31cf5b5192
Parents: 50f6bdc e791254
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Sep 5 11:52:31 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Sep 5 11:52:31 2017 +0300
----------------------------------------------------------------------
.../internal/jdbc2/JdbcMetadataSelfTest.java | 19 ++
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 2 +
.../JdbcThinMissingLongArrayResultsTest.java | 341 +++++++++++++++++++
.../org/apache/ignite/cache/QueryIndex.java | 5 +-
.../configuration/MemoryConfiguration.java | 4 +-
.../internal/DuplicateTypeIdException.java | 74 ++++
.../apache/ignite/internal/IgniteKernal.java | 22 +-
.../ignite/internal/IgniteNodeAttributes.java | 3 +
.../ignite/internal/MarshallerContextImpl.java | 24 +-
.../ignite/internal/binary/BinaryContext.java | 52 ++-
.../binary/builder/BinaryObjectBuilderImpl.java | 2 +
.../internal/jdbc/JdbcDatabaseMetadata.java | 2 +-
.../jdbc/thin/JdbcThinDatabaseMetadata.java | 2 +-
.../internal/jdbc2/JdbcDatabaseMetadata.java | 35 +-
.../discovery/GridDiscoveryManager.java | 49 ++-
.../cache/binary/BinaryMetadataTransport.java | 14 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 1 -
.../dht/preloader/GridDhtPartitionMap.java | 24 +-
.../distributed/near/GridNearGetFuture.java | 2 +-
.../local/atomic/GridLocalAtomicCache.java | 8 +-
.../GridCacheDatabaseSharedManager.java | 39 ++-
.../processors/odbc/SqlListenerUtils.java | 6 +
.../odbc/odbc/OdbcRequestHandler.java | 17 +-
.../processors/odbc/odbc/OdbcUtils.java | 22 ++
.../apache/ignite/internal/util/typedef/X.java | 4 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 16 +-
.../BinaryObjectBuilderAdditionalSelfTest.java | 22 ++
.../binary/BinaryMetadataUpdatesFlowTest.java | 48 +++
...pClientDiscoveryMarshallerCheckSelfTest.java | 84 ++++-
modules/platforms/cpp/odbc-test/Makefile.am | 3 +-
.../cpp/odbc-test/project/vs/odbc-test.vcxproj | 8 +-
.../cpp/odbc-test/src/queries_test.cpp | 126 ++++++-
.../cpp/odbc/include/ignite/odbc/cursor.h | 7 +
modules/platforms/cpp/odbc/src/cursor.cpp | 5 +
.../platforms/cpp/odbc/src/query/data_query.cpp | 2 +-
modules/platforms/cpp/odbc/src/statement.cpp | 32 +-
.../Compute/ComputeApiTest.cs | 6 +
.../Apache.Ignite.Core.csproj | 1 +
.../Configuration/MemoryPolicyConfiguration.cs | 4 +-
.../Impl/Binary/BinaryObjectBuilder.cs | 132 +++----
.../Impl/Binary/BinaryObjectSchemaSerializer.cs | 2 +-
.../Impl/Binary/BinaryProcessor.cs | 2 +-
.../Impl/Binary/BinaryReader.cs | 110 +++---
.../Impl/Binary/BinarySystemHandlers.cs | 157 +++------
.../Impl/Binary/BinaryTypeId.cs | 228 +++++++++++++
.../Impl/Binary/BinaryUtils.cs | 155 +--------
.../Impl/Binary/BinaryWriter.cs | 152 ++++-----
.../Impl/Binary/Marshaller.cs | 28 +-
.../Impl/Binary/Metadata/BinaryType.cs | 62 ++--
modules/platforms/dotnet/README.md | 2 +-
.../cache/jdbc/JdbcAbstractBenchmark.java | 4 +-
.../yardstick/cache/jdbc/RdbmsBenchmark.java | 6 +-
52 files changed, 1537 insertions(+), 640 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4f8f0852/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 760ea38,241e1c6..2ac2cea
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@@ -97,17 -97,10 +97,18 @@@
<Compile Include="Cache\Configuration\MemoryPolicyConfiguration.cs" />
<Compile Include="Cache\Configuration\PartitionLossPolicy.cs" />
<Compile Include="Cache\IMemoryMetrics.cs" />
+ <Compile Include="Client\IgniteClientConfiguration.cs" />
<Compile Include="Common\ExceptionFactory.cs" />
<Compile Include="Configuration\Package-Info.cs" />
+ <Compile Include="Impl\Binary\BinaryTypeId.cs" />
+ <Compile Include="Impl\Binary\BinaryProcessorClient.cs" />
+ <Compile Include="Impl\Binary\IBinaryProcessor.cs" />
<Compile Include="Impl\IIgniteInternal.cs" />
+ <Compile Include="Impl\Cache\CacheClient.cs" />
+ <Compile Include="Impl\Client\ClientOp.cs" />
+ <Compile Include="Impl\Client\ClientProtocolVersion.cs" />
+ <Compile Include="Impl\Client\ClientSocket.cs" />
+ <Compile Include="Impl\Client\IgniteClient.cs" />
<Compile Include="Impl\IPlatformTargetInternal.cs" />
<Compile Include="Impl\PersistentStore\PersistentStoreMetrics.cs" />
<Compile Include="Impl\PlatformDisposableTargetAdapter.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/4f8f0852/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4f8f0852/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4f8f0852/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
[19/23] ignite git commit: ignite-6214 resolve problem with
concurrent metadata updates
Posted by pt...@apache.org.
ignite-6214 resolve problem with concurrent metadata updates
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/740a9b5b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/740a9b5b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/740a9b5b
Branch: refs/heads/ignite-5896
Commit: 740a9b5bd7344ae099e6359f175759bb1a75835a
Parents: a2a9026
Author: Denis Mekhanikov <dm...@gmail.com>
Authored: Thu Aug 31 10:32:25 2017 +0300
Committer: Andrey Gura <ag...@apache.org>
Committed: Mon Sep 4 19:08:41 2017 +0300
----------------------------------------------------------------------
.../cache/binary/BinaryMetadataTransport.java | 14 +++++-
.../binary/BinaryMetadataUpdatesFlowTest.java | 48 ++++++++++++++++++++
2 files changed, 60 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/740a9b5b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataTransport.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataTransport.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataTransport.java
index 77190a4..010ab0f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataTransport.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataTransport.java
@@ -30,6 +30,7 @@ import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.GridTopic;
+import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryMetadata;
import org.apache.ignite.internal.binary.BinaryUtils;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
@@ -41,6 +42,7 @@ import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteInClosure;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
@@ -392,7 +394,7 @@ final class BinaryMetadataTransport {
* @param pendingVer Pending version.
* @param fut Future.
*/
- private void initSyncFor(int typeId, int pendingVer, MetadataUpdateResultFuture fut) {
+ private void initSyncFor(int typeId, int pendingVer, final MetadataUpdateResultFuture fut) {
if (stopping) {
fut.onDone(MetadataUpdateResult.createUpdateDisabledResult());
@@ -401,7 +403,15 @@ final class BinaryMetadataTransport {
SyncKey key = new SyncKey(typeId, pendingVer);
- syncMap.put(key, fut);
+ MetadataUpdateResultFuture oldFut = syncMap.putIfAbsent(key, fut);
+
+ if (oldFut != null) {
+ oldFut.listen(new IgniteInClosure<IgniteInternalFuture<MetadataUpdateResult>>() {
+ @Override public void apply(IgniteInternalFuture<MetadataUpdateResult> doneFut) {
+ fut.onDone(doneFut.result(), doneFut.error());
+ }
+ });
+ }
fut.key(key);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/740a9b5b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
index 9ec48cf..3ee51c8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.ignite.internal.processors.cache.binary;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.BlockingDeque;
@@ -25,6 +27,7 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.cache.event.CacheEntryListenerException;
import javax.cache.event.CacheEntryUpdatedListener;
+import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.binary.BinaryObjectBuilder;
@@ -36,6 +39,7 @@ import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.binary.BinaryObjectImpl;
import org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage;
@@ -52,6 +56,8 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.eclipse.jetty.util.ConcurrentHashSet;
import org.jetbrains.annotations.Nullable;
+import static org.apache.ignite.testframework.GridTestUtils.runAsync;
+
/**
*
*/
@@ -343,6 +349,48 @@ public class BinaryMetadataUpdatesFlowTest extends GridCommonAbstractTest {
}
/**
+ * @throws Exception If failed.
+ */
+ public void testConcurrentMetadataUpdates() throws Exception {
+ startGrid(0);
+
+ final Ignite client = startGrid(getConfiguration("client").setClientMode(true));
+
+ final IgniteCache<Integer, Object> cache = client.cache(DEFAULT_CACHE_NAME).withKeepBinary();
+
+ int threadsNum = 10;
+ final int updatesNum = 2000;
+
+ List<IgniteInternalFuture> futs = new ArrayList<>();
+
+ for (int i = 0; i < threadsNum; i++) {
+ final int threadId = i;
+
+ IgniteInternalFuture fut = runAsync(new Runnable() {
+ @Override public void run() {
+ try {
+ for (int j = 0; j < updatesNum; j++) {
+ BinaryObjectBuilder bob = client.binary().builder(BINARY_TYPE_NAME);
+
+ bob.setField("field" + j, threadId);
+
+ cache.put(threadId, bob.build());
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }, "updater-" + i);
+
+ futs.add(fut);
+ }
+
+ for (IgniteInternalFuture fut : futs)
+ fut.get();
+ }
+
+ /**
* Runnable responsible for stopping (gracefully) server nodes during metadata updates process.
*/
private final class ServerNodeKiller implements Runnable {
[20/23] ignite git commit: IGNITE-6255 .NET: Fix TestAffinityCall to
take late affinity assignment into account
Posted by pt...@apache.org.
IGNITE-6255 .NET: Fix TestAffinityCall to take late affinity assignment into account
This closes #2589
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ce2a98cd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ce2a98cd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ce2a98cd
Branch: refs/heads/ignite-5896
Commit: ce2a98cdb553e9b4d052d2ab891e4ba7c0fab289
Parents: 740a9b5
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Sep 5 10:39:32 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Sep 5 10:39:32 2017 +0300
----------------------------------------------------------------------
.../dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ce2a98cd/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index 5427d3d..80d8716 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -29,6 +29,7 @@ namespace Apache.Ignite.Core.Tests.Compute
using Apache.Ignite.Core.Cluster;
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Compute;
+ using Apache.Ignite.Core.Events;
using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Resource;
@@ -151,6 +152,11 @@ namespace Apache.Ignite.Core.Tests.Compute
_grid1 = Ignition.Start(Configuration(configs.Item1));
_grid2 = Ignition.Start(Configuration(configs.Item2));
_grid3 = Ignition.Start(Configuration(configs.Item3));
+
+ // Wait for rebalance.
+ var events = _grid1.GetEvents();
+ events.EnableLocal(EventType.CacheRebalanceStopped);
+ events.WaitForLocal(EventType.CacheRebalanceStopped);
}
/// <summary>
[04/23] ignite git commit: IGNITE-6211: ODBC: SQLBindParameter now
does not unbind parameter if the ParameterValuePtr is NULL
Posted by pt...@apache.org.
IGNITE-6211: ODBC: SQLBindParameter now does not unbind parameter if the
ParameterValuePtr is NULL
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/72608a50
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/72608a50
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/72608a50
Branch: refs/heads/ignite-5896
Commit: 72608a50856cda9fcc8e44e2a9e5349eb6a9616e
Parents: bd7bd22
Author: Igor Sapego <is...@gridgain.com>
Authored: Fri Sep 1 16:24:04 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Fri Sep 1 16:24:04 2017 +0300
----------------------------------------------------------------------
.../cpp/odbc-test/src/queries_test.cpp | 51 ++++++++++++++++++++
modules/platforms/cpp/odbc/src/statement.cpp | 32 +++++++-----
2 files changed, 70 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/72608a50/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index 263993c..5d10a66 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -1996,4 +1996,55 @@ BOOST_AUTO_TEST_CASE(TestExecuteAfterCursorClose)
BOOST_CHECK_EQUAL(ret, SQL_NO_DATA);
}
+BOOST_AUTO_TEST_CASE(TestBindNullParameter)
+{
+ Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;SCHEMA=cache");
+
+ SQLLEN paramInd = SQL_NULL_DATA;
+
+ // Binding NULL parameter.
+ SQLRETURN ret = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 100, 100, 0, 0, ¶mInd);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Just selecting everything to make sure everything is OK
+ SQLCHAR insertReq[] = "INSERT INTO TestType(_key, strField) VALUES(1, ?)";
+
+ ret = SQLExecDirect(stmt, insertReq, SQL_NTS);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Unbindning parameter.
+ ret = SQLFreeStmt(stmt, SQL_RESET_PARAMS);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ // Selecting inserted column to make sure that everything is OK
+ SQLCHAR selectReq[] = "SELECT strField FROM TestType";
+
+ char strField[1024] = { 0 };
+ SQLLEN strFieldLen = 0;
+
+ // Binding column.
+ ret = SQLBindCol(stmt, 1, SQL_C_CHAR, &strField, sizeof(strField), &strFieldLen);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLExecDirect(stmt, selectReq, sizeof(selectReq));
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ ret = SQLFetch(stmt);
+
+ if (!SQL_SUCCEEDED(ret))
+ BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+ BOOST_CHECK_EQUAL(strFieldLen, SQL_NULL_DATA);
+}
+
BOOST_AUTO_TEST_SUITE_END()
http://git-wip-us.apache.org/repos/asf/ignite/blob/72608a50/modules/platforms/cpp/odbc/src/statement.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/statement.cpp b/modules/platforms/cpp/odbc/src/statement.cpp
index 38a1e2e..a74a413 100644
--- a/modules/platforms/cpp/odbc/src/statement.cpp
+++ b/modules/platforms/cpp/odbc/src/statement.cpp
@@ -139,13 +139,14 @@ namespace ignite
}
void Statement::BindParameter(uint16_t paramIdx, int16_t ioType, int16_t bufferType, int16_t paramSqlType,
- SqlUlen columnSize, int16_t decDigits, void* buffer, SqlLen bufferLen, SqlLen* resLen)
+ SqlUlen columnSize, int16_t decDigits, void* buffer, SqlLen bufferLen, SqlLen* resLen)
{
- IGNITE_ODBC_API_CALL(InternalBindParameter(paramIdx, ioType, bufferType, paramSqlType, columnSize, decDigits, buffer, bufferLen, resLen));
+ IGNITE_ODBC_API_CALL(InternalBindParameter(paramIdx, ioType, bufferType, paramSqlType, columnSize,
+ decDigits, buffer, bufferLen, resLen));
}
- SqlResult::Type Statement::InternalBindParameter(uint16_t paramIdx, int16_t ioType, int16_t bufferType, int16_t paramSqlType,
- SqlUlen columnSize, int16_t decDigits, void* buffer, SqlLen bufferLen, SqlLen* resLen)
+ SqlResult::Type Statement::InternalBindParameter(uint16_t paramIdx, int16_t ioType, int16_t bufferType,
+ int16_t paramSqlType, SqlUlen columnSize, int16_t decDigits, void* buffer, SqlLen bufferLen, SqlLen* resLen)
{
using namespace type_traits;
using app::ApplicationDataBuffer;
@@ -154,7 +155,8 @@ namespace ignite
if (paramIdx == 0)
{
std::stringstream builder;
- builder << "The value specified for the argument ParameterNumber was less than 1. [ParameterNumber=" << paramIdx << ']';
+ builder << "The value specified for the argument ParameterNumber was less than 1. [ParameterNumber="
+ << paramIdx << ']';
AddStatusRecord(SqlState::S24000_INVALID_CURSOR_STATE, builder.str());
@@ -164,7 +166,8 @@ namespace ignite
if (ioType != SQL_PARAM_INPUT)
{
std::stringstream builder;
- builder << "The value specified for the argument InputOutputType was not SQL_PARAM_INPUT. [ioType=" << ioType << ']';
+ builder << "The value specified for the argument InputOutputType was not SQL_PARAM_INPUT. [ioType="
+ << ioType << ']';
AddStatusRecord(SqlState::SHY105_INVALID_PARAMETER_TYPE, builder.str());
@@ -193,16 +196,19 @@ namespace ignite
return SqlResult::AI_ERROR;
}
- if (buffer)
+ if (!buffer && !resLen)
{
- ApplicationDataBuffer dataBuffer(driverType, buffer, bufferLen, resLen);
-
- Parameter param(dataBuffer, paramSqlType, columnSize, decDigits);
+ AddStatusRecord(SqlState::SHY009_INVALID_USE_OF_NULL_POINTER,
+ "ParameterValuePtr and StrLen_or_IndPtr are both null pointers.");
- parameters.BindParameter(paramIdx, param);
+ return SqlResult::AI_ERROR;
}
- else
- parameters.UnbindParameter(paramIdx);
+
+ ApplicationDataBuffer dataBuffer(driverType, buffer, bufferLen, resLen);
+
+ Parameter param(dataBuffer, paramSqlType, columnSize, decDigits);
+
+ parameters.BindParameter(paramIdx, param);
return SqlResult::AI_SUCCESS;
}
[11/23] ignite git commit: IGNITE-6220: JDBC thin driver: fixed
long[] data type propagation. This closes #2563.
Posted by pt...@apache.org.
IGNITE-6220: JDBC thin driver: fixed long[] data type propagation. This closes #2563.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4b655a00
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4b655a00
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4b655a00
Branch: refs/heads/ignite-5896
Commit: 4b655a00ccdfa665a44859ab3504b3a93215d1fd
Parents: 1d0d6f8
Author: tledkov-gridgain <tl...@gridgain.com>
Authored: Mon Sep 4 13:47:17 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Sep 4 13:47:17 2017 +0300
----------------------------------------------------------------------
.../jdbc/suite/IgniteJdbcDriverTestSuite.java | 2 +
.../JdbcThinMissingLongArrayResultsTest.java | 341 +++++++++++++++++++
.../processors/odbc/SqlListenerUtils.java | 6 +
3 files changed, 349 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4b655a00/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
index d08528d..40bfbe3 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/suite/IgniteJdbcDriverTestSuite.java
@@ -48,6 +48,7 @@ import org.apache.ignite.jdbc.thin.JdbcThinEmptyCacheSelfTest;
import org.apache.ignite.jdbc.thin.JdbcThinInsertStatementSelfTest;
import org.apache.ignite.jdbc.thin.JdbcThinMergeStatementSelfTest;
import org.apache.ignite.jdbc.thin.JdbcThinMetadataSelfTest;
+import org.apache.ignite.jdbc.thin.JdbcThinMissingLongArrayResultsTest;
import org.apache.ignite.jdbc.thin.JdbcThinNoDefaultSchemaTest;
import org.apache.ignite.jdbc.thin.JdbcThinPreparedStatementSelfTest;
import org.apache.ignite.jdbc.thin.JdbcThinResultSetSelfTest;
@@ -129,6 +130,7 @@ public class IgniteJdbcDriverTestSuite extends TestSuite {
suite.addTest(new TestSuite(JdbcThinDeleteStatementSelfTest.class));
suite.addTest(new TestSuite(JdbcThinAutoCloseServerCursorTest.class));
suite.addTest(new TestSuite(JdbcThinBatchSelfTest.class));
+ suite.addTest(new TestSuite(JdbcThinMissingLongArrayResultsTest.class));
// New thin JDBC driver, DDL tests
suite.addTest(new TestSuite(JdbcThinDynamicIndexAtomicPartitionedNearSelfTest.class));
http://git-wip-us.apache.org/repos/asf/ignite/blob/4b655a00/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMissingLongArrayResultsTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMissingLongArrayResultsTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMissingLongArrayResultsTest.java
new file mode 100644
index 0000000..1a53ab7
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinMissingLongArrayResultsTest.java
@@ -0,0 +1,341 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.jdbc.thin;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Random;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+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.jetbrains.annotations.NotNull;
+
+/**
+ *
+ */
+public class JdbcThinMissingLongArrayResultsTest extends JdbcThinAbstractSelfTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** First cache name. */
+ private static final String CACHE_NAME = "test";
+
+ /** URL. */
+ private static final String URL = "jdbc:ignite:thin://127.0.0.1";
+
+ /** Grid count. */
+ private static final int GRID_CNT = 2;
+
+ /** Rand. */
+ private static final Random RAND = new Random(123);
+
+ /** Sample size. */
+ private static final int SAMPLE_SIZE = 1_000_000;
+
+ /** Block size. */
+ private static final int BLOCK_SIZE = 5_000;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ cfg.setCacheConfiguration(cacheConfiguration(CACHE_NAME));
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(disco);
+
+ return cfg;
+ }
+
+ /**
+ * @param name Cache name.
+ * @return Cache configuration.
+ * @throws Exception In case of error.
+ */
+ @SuppressWarnings("unchecked")
+ private CacheConfiguration cacheConfiguration(@NotNull String name) throws Exception {
+ CacheConfiguration cfg = defaultCacheConfiguration();
+
+ cfg.setIndexedTypes(Key.class, Value.class);
+
+ cfg.setName(name);
+
+// cfg.setSqlSchema(name);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ super.beforeTestsStarted();
+
+ startGridsMultiThreaded(GRID_CNT);
+
+ Ignite ignite = ignite(0);
+
+ try (IgniteDataStreamer<Key, Value> streamer = ignite.dataStreamer(CACHE_NAME)) {
+ streamer.allowOverwrite(true);
+ streamer.perNodeBufferSize(50);
+ streamer.autoFlushFrequency(TimeUnit.SECONDS.toMillis(45));
+ streamer.skipStore(false);
+ streamer.keepBinary(true);
+
+ int secId = 0;
+
+ final int maxBlocks = SAMPLE_SIZE / BLOCK_SIZE;
+
+ Key key = new Key();
+ Value value = new Value();
+ long date = System.nanoTime();
+
+ for (int blockId = 0; blockId < maxBlocks; blockId++) {
+
+ final long[] time = new long[BLOCK_SIZE];
+ final double[] open = new double[BLOCK_SIZE];
+ final double[] close = new double[BLOCK_SIZE];
+ final double[] high = new double[BLOCK_SIZE];
+ final double[] low = new double[BLOCK_SIZE];
+ final double[] marketVWAP = new double[BLOCK_SIZE];
+
+ for (int i = 0; i < BLOCK_SIZE; i++) {
+ // Fake data
+ time[i] = System.nanoTime();
+ open[i] = Math.abs(RAND.nextGaussian());
+ close[i] = Math.abs(RAND.nextGaussian());
+ high[i] = Math.max(open[i], Math.abs(RAND.nextGaussian()));
+ low[i] = Math.min(open[i], Math.abs(RAND.nextGaussian()));
+ marketVWAP[i] = Math.abs(RAND.nextGaussian());
+ }
+
+ // Add to the cache
+ key.setDate(date);
+ key.setSecurityId(secId);
+
+ value.setTime(time); // BUG in providing it via JDBC
+
+ value.setOpen(open);
+ value.setHigh(high);
+ value.setLow(low);
+ value.setClose(close);
+ value.setMarketVWAP(marketVWAP);
+
+ streamer.addData(key, value);
+
+ secId++; // for unique values
+ //secId = RAND.nextInt(1000);
+
+ if (blockId % 100 == 0)
+ System.out.println("+++ Processed " + (blockId * BLOCK_SIZE) + " events so far " + new Date());
+ }
+ streamer.flush();
+ }
+ ignite.active(true); }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ @SuppressWarnings({"EmptyTryBlock", "unused"})
+ public void testDefaults() throws Exception {
+ try (Connection conn = DriverManager.getConnection(URL)) {
+ conn.setSchema(CACHE_NAME);
+
+ try (PreparedStatement st = conn.prepareStatement("SELECT * FROM VALUE")) {
+ ResultSet rs = st.executeQuery();
+
+ int cols = rs.getMetaData().getColumnCount();
+
+ while(rs.next()) {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append(rs.getObject(1).toString());
+
+ for (int i = 1; i < cols; ++i)
+ sb.append(", ").append(rs.getObject(i + 1).toString());
+
+ System.out.println(sb.toString());
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ @SuppressWarnings("unused")
+ public static class Key implements Serializable {
+ @QuerySqlField(orderedGroups = {@QuerySqlField.Group(
+ name = "date_sec_idx", order = 0, descending = true)})
+ private long date;
+
+ @QuerySqlField(index = true, orderedGroups = {@QuerySqlField.Group(
+ name = "date_sec_idx", order = 3)})
+ private int securityId;
+
+ /**
+ *
+ */
+ public Key() {
+ // Required for default binary serialization
+ }
+
+ /**
+ * @return Date.
+ */
+ public long getDate() {
+ return date;
+ }
+
+ /**
+ * @param securityId Security ID.
+ */
+ public void setSecurityId(int securityId) {
+ this.securityId = securityId;
+ }
+
+ /**
+ * @param date Date.
+ */
+ public void setDate(long date) {
+ this.date = date;
+ }
+ }
+
+ /**
+ *
+ */
+ public static class Value implements Serializable {
+
+ /** Time. */
+ @QuerySqlField()
+ private long[] time;
+
+ /** Open. */
+ @QuerySqlField()
+ private double[] open;
+
+ /** High. */
+ @QuerySqlField()
+ private double[] high;
+
+ /** Low. */
+ @QuerySqlField()
+ private double[] low;
+
+ /** Close. */
+ @QuerySqlField()
+ private double[] close;
+
+ /** Market vwap. */
+ @QuerySqlField()
+ private double[] marketVWAP;
+
+ /**
+ *
+ */
+ public Value() {
+ // Required for default binary serialization
+ }
+
+ /**
+ * @return close.
+ */
+ public double[] getClose() {
+ return close;
+ }
+
+ /**
+ * @return time.
+ */
+ public long[] getTime() {
+ return time;
+ }
+
+ /**
+ * @param time time.
+ */
+ public void setTime(long[] time) {
+ this.time = time;
+ }
+
+ /**
+ * @param open open.
+ */
+ public void setOpen(double[] open) {
+ this.open = open;
+ }
+
+ /**
+ * @param high high.
+ */
+ public void setHigh(double[] high) {
+ this.high = high;
+ }
+
+ /**
+ * @param low low.
+ */
+ public void setLow(double[] low) {
+ this.low = low;
+ }
+
+ /**
+ * @param close close.
+ */
+ public void setClose(double[] close) {
+ this.close = close;
+ }
+
+ /**
+ * @param marketVWAP marketVWAP.
+ */
+ public void setMarketVWAP(double[] marketVWAP) {
+ this.marketVWAP = marketVWAP;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return "OHLC{" +
+ ", time=" + Arrays.toString(time) +
+ ", open=" + Arrays.toString(open) +
+ ", high=" + Arrays.toString(high) +
+ ", low=" + Arrays.toString(low) +
+ ", close=" + Arrays.toString(close) +
+ ", marketVWAP=" + Arrays.toString(marketVWAP) +
+ '}';
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4b655a00/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerUtils.java
index 196eafa..1c6cdbf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/SqlListenerUtils.java
@@ -104,6 +104,9 @@ public abstract class SqlListenerUtils {
case GridBinaryMarshaller.INT_ARR:
return BinaryUtils.doReadIntArray(reader.in());
+ case GridBinaryMarshaller.LONG_ARR:
+ return BinaryUtils.doReadLongArray(reader.in());
+
case GridBinaryMarshaller.FLOAT_ARR:
return BinaryUtils.doReadFloatArray(reader.in());
@@ -192,6 +195,8 @@ public abstract class SqlListenerUtils {
writer.writeShortArray((short[])obj);
else if (cls == int[].class)
writer.writeIntArray((int[])obj);
+ else if (cls == long[].class)
+ writer.writeLongArray((long[])obj);
else if (cls == float[].class)
writer.writeFloatArray((float[])obj);
else if (cls == double[].class)
@@ -238,6 +243,7 @@ public abstract class SqlListenerUtils {
|| cls == char[].class
|| cls == short[].class
|| cls == int[].class
+ || cls == long[].class
|| cls == float[].class
|| cls == double[].class
|| cls == String[].class
[21/23] ignite git commit: Minor.
Posted by pt...@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/35d3d614
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/35d3d614
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/35d3d614
Branch: refs/heads/ignite-5896
Commit: 35d3d614779fb6c790c8ca87e612d6b4676ced35
Parents: bc8e645
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 5 10:54:06 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 5 10:54:06 2017 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/GridDhtTxPrepareFuture.java | 1 -
.../processors/cache/distributed/near/GridNearGetFuture.java | 2 +-
.../processors/cache/local/atomic/GridLocalAtomicCache.java | 8 ++++----
3 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/35d3d614/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 03d99fc..ce3c290 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -1225,7 +1225,6 @@ public final class GridDhtTxPrepareFuture extends GridCacheCompoundFuture<Ignite
}
}
- // We are holding transaction-level locks for entries here, so we can get next write version.
onEntriesLocked();
// We are holding transaction-level locks for entries here, so we can get next write version.
http://git-wip-us.apache.org/repos/asf/ignite/blob/35d3d614/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index 9d9c682..1ab56a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -584,7 +584,7 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
EntryGetResult res = dhtEntry.innerGetVersioned(
null,
null,
- /**update-metrics*/false,
+ /*update-metrics*/false,
/*event*/!nearRead && !skipVals,
subjId,
null,
http://git-wip-us.apache.org/repos/asf/ignite/blob/35d3d614/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index 4eacfb8..e99c9e8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -1158,8 +1158,8 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
null,
null,
/*read-through*/ctx.loadPreviousValue(),
- /**update-metrics*/true,
- /**event*/true,
+ /*update-metrics*/true,
+ /*event*/true,
subjId,
null,
taskName,
@@ -1191,8 +1191,8 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
null,
null,
/*read-through*/ctx.loadPreviousValue(),
- /**update-metrics*/true,
- /**event*/true,
+ /*update-metrics*/true,
+ /*event*/true,
subjId,
null,
taskName,
[05/23] ignite git commit: IGNITE-5869 Code review
Posted by pt...@apache.org.
IGNITE-5869 Code review
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/db5880ab
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/db5880ab
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/db5880ab
Branch: refs/heads/ignite-5896
Commit: db5880ab88fd513ddad7599b78b27bde37e733c5
Parents: ccc334d
Author: Andrey Gura <ag...@apache.org>
Authored: Fri Sep 1 17:25:26 2017 +0300
Committer: Andrey Gura <ag...@apache.org>
Committed: Fri Sep 1 17:25:53 2017 +0300
----------------------------------------------------------------------
.../ignite/spi/discovery/tcp/ServerImpl.java | 8 ++-
...pClientDiscoveryMarshallerCheckSelfTest.java | 67 ++++++++++----------
2 files changed, 39 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/db5880ab/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 7dc94d3..c227bf7 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -6077,11 +6077,15 @@ class ServerImpl extends TcpDiscoveryImpl {
if (worker != null) {
msg.verify(getLocalNodeId());
+
worker.addMessage(msg);
}
- else if (log.isDebugEnabled())
- log.debug("Failed to find client message worker " +
+ else {
+ if (log.isDebugEnabled()) {
+ log.debug("Failed to find client message worker " +
"[clientNode=" + msg.creatorNodeId() + ']');
+ }
+ }
state = spiState;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/db5880ab/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
index f88a9ea..f14e0b1 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoveryMarshallerCheckSelfTest.java
@@ -17,11 +17,9 @@
package org.apache.ignite.spi.discovery.tcp;
-import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.BinaryConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.marshaller.jdk.JdkMarshaller;
import org.apache.ignite.spi.IgniteSpiException;
@@ -53,10 +51,11 @@ public class TcpClientDiscoveryMarshallerCheckSelfTest extends GridCommonAbstrac
cfg.setDiscoverySpi(spi);
if (igniteInstanceName.endsWith("0")) {
- cfg.setClientMode(true);
BinaryConfiguration bc = new BinaryConfiguration();
bc.setCompactFooter(false);
+
cfg.setBinaryConfiguration(bc);
+ cfg.setClientMode(true);
}
}
else {
@@ -100,48 +99,48 @@ public class TcpClientDiscoveryMarshallerCheckSelfTest extends GridCommonAbstrac
}
/**
- * Starts client-server grid with different binary configurations.
- *
* @throws Exception If failed.
*/
- private void clientServerInconsistentConfigFail(boolean multiNodes) throws Exception {
- testFooter = true;
-
- IgniteEx ig0 = startGrid(1);
- IgniteCache ic = ig0.getOrCreateCache("cahe_name");
- if (multiNodes)
- startGrid(2);
-
- try {
- IgniteEx ig = startGrid(0);
-
- for (String c : ig.cacheNames())
- System.out.println(c);
-
- fail("Expected SPI exception was not thrown, multiNodes=" + multiNodes);
- } catch (IgniteCheckedException expect) {
- Throwable ex = expect.getCause().getCause();
-
- assertTrue(ex instanceof IgniteSpiException);
- assertTrue("Catched exception: " + ex.getMessage(), ex.getMessage().contains("Local node's binary " +
- "configuration is not equal to remote node's binary configuration"));
- } finally {
- stopAllGrids();
- }
+ public void testInconsistentCompactFooterSingle() throws Exception {
+ clientServerInconsistentConfigFail(false, 1, 1);
}
/**
* @throws Exception If failed.
*/
- public void testInconsistentFooterConfigSingle() throws Exception {
- clientServerInconsistentConfigFail(false);
+ public void testInconsistentCompactFooterMulti() throws Exception {
+ clientServerInconsistentConfigFail(true, 2, 10);
}
/**
+ * Starts client-server grid with different binary configurations.
+ *
* @throws Exception If failed.
*/
- public void testInconsistentFooterConfigMulti() throws Exception {
- for (int i = 0; i < 10; ++i)
- clientServerInconsistentConfigFail(true);
+ private void clientServerInconsistentConfigFail(boolean multiNodes, int cnt, int iters) throws Exception {
+ testFooter = true;
+
+ for (int i = 1; i <= cnt; i++)
+ startGrid(i);
+
+ for (int i = 0; i < iters; i++) {
+ try {
+ startGrid(0);
+
+ fail("Expected SPI exception was not thrown, multiNodes=" + multiNodes);
+ }
+ catch (IgniteCheckedException expect) {
+ Throwable ex = expect.getCause().getCause();
+
+ String msg = ex.getMessage();
+
+ assertTrue(ex instanceof IgniteSpiException);
+ assertTrue("Caught exception: " + msg, msg.contains("Local node's binary " +
+ "configuration is not equal to remote node's binary configuration"));
+ }
+ finally {
+ stopGrid(0);
+ }
+ }
}
}