You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2018/08/29 16:51:17 UTC
[37/50] [abbrv] ignite git commit: IGNITE-6055: SQL. Add string
length constraint - Fixes #3973.
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/cpp/odbc/include/ignite/odbc/meta/column_meta.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/meta/column_meta.h b/modules/platforms/cpp/odbc/include/ignite/odbc/meta/column_meta.h
index 6a94b04..d54fe3e 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/meta/column_meta.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/meta/column_meta.h
@@ -23,6 +23,7 @@
#include "ignite/impl/binary/binary_reader_impl.h"
+#include "ignite/odbc/protocol_version.h"
#include "ignite/odbc/common_types.h"
#include "ignite/odbc/utility.h"
@@ -32,6 +33,8 @@ namespace ignite
{
namespace meta
{
+ using namespace ignite::odbc;
+
/**
* Column metadata.
*/
@@ -65,7 +68,8 @@ namespace ignite
*/
ColumnMeta(const std::string& schemaName, const std::string& tableName,
const std::string& columnName, int8_t dataType) :
- schemaName(schemaName), tableName(tableName), columnName(columnName), dataType(dataType)
+ schemaName(schemaName), tableName(tableName), columnName(columnName), dataType(dataType),
+ precision(-1), scale(-1)
{
// No-op.
}
@@ -85,7 +89,9 @@ namespace ignite
schemaName(other.schemaName),
tableName(other.tableName),
columnName(other.columnName),
- dataType(other.dataType)
+ dataType(other.dataType),
+ precision(other.precision),
+ scale(other.scale)
{
// No-op.
}
@@ -99,6 +105,8 @@ namespace ignite
tableName = other.tableName;
columnName = other.columnName;
dataType = other.dataType;
+ precision = other.precision;
+ scale = other.scale;
return *this;
}
@@ -106,8 +114,9 @@ namespace ignite
/**
* Read using reader.
* @param reader Reader.
+ * @param ver Server version.
*/
- void Read(ignite::impl::binary::BinaryReaderImpl& reader);
+ void Read(ignite::impl::binary::BinaryReaderImpl& reader, const ProtocolVersion& ver);
/**
* Get schema name.
@@ -140,12 +149,30 @@ namespace ignite
* Get data type.
* @return Data type.
*/
- int8_t GetDataType() const
+ int8_t GetDataType() const
{
return dataType;
}
/**
+ * Get column precision.
+ * @return Column precision.
+ */
+ const int32_t GetPrecision() const
+ {
+ return precision;
+ }
+
+ /**
+ * Get column scale.
+ * @return Column scale.
+ */
+ const int32_t GetScale() const
+ {
+ return scale;
+ }
+
+ /**
* Try to get attribute of a string type.
*
* @param fieldId Field ID.
@@ -175,6 +202,12 @@ namespace ignite
/** Data type. */
int8_t dataType;
+
+ /** Column precision. */
+ int32_t precision;
+
+ /** Column scale. */
+ int32_t scale;
};
/** Column metadata vector alias. */
@@ -184,10 +217,12 @@ namespace ignite
* Read columns metadata collection.
* @param reader Reader.
* @param meta Collection.
+ * @param ver Server protocol version.
*/
- void ReadColumnMetaVector(ignite::impl::binary::BinaryReaderImpl& reader, ColumnMetaVector& meta);
+ void ReadColumnMetaVector(ignite::impl::binary::BinaryReaderImpl& reader, ColumnMetaVector& meta,
+ const ProtocolVersion& ver);
}
}
}
-#endif //_IGNITE_ODBC_META_COLUMN_META
\ No newline at end of file
+#endif //_IGNITE_ODBC_META_COLUMN_META
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h b/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
index 4833291..0b64536 100644
--- a/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
+++ b/modules/platforms/cpp/odbc/include/ignite/odbc/protocol_version.h
@@ -46,6 +46,9 @@ namespace ignite
/** Version 2.5.0: added multiple statements support. */
static const ProtocolVersion VERSION_2_5_0;
+ /** Version 2.7.0: added fields precision and scale. */
+ static const ProtocolVersion VERSION_2_7_0;
+
typedef std::set<ProtocolVersion> VersionSet;
/**
@@ -198,4 +201,4 @@ namespace ignite
}
}
-#endif //_IGNITE_ODBC_PROTOCOL_VERSION
\ No newline at end of file
+#endif //_IGNITE_ODBC_PROTOCOL_VERSION
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/cpp/odbc/src/message.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/message.cpp b/modules/platforms/cpp/odbc/src/message.cpp
index 53d429b..5b909b8 100644
--- a/modules/platforms/cpp/odbc/src/message.cpp
+++ b/modules/platforms/cpp/odbc/src/message.cpp
@@ -343,7 +343,7 @@ namespace ignite
{
queryId = reader.ReadInt64();
- meta::ReadColumnMetaVector(reader, meta);
+ meta::ReadColumnMetaVector(reader, meta, ver);
ReadAffectedRows(reader, ver, affectedRows);
}
@@ -390,7 +390,8 @@ namespace ignite
// No-op.
}
- void QueryFetchResponse::ReadOnSuccess(impl::binary::BinaryReaderImpl& reader, const ProtocolVersion&)
+ void QueryFetchResponse::ReadOnSuccess(impl::binary::BinaryReaderImpl& reader,
+ const ProtocolVersion& ver)
{
queryId = reader.ReadInt64();
@@ -407,9 +408,10 @@ namespace ignite
// No-op.
}
- void QueryGetColumnsMetaResponse::ReadOnSuccess(impl::binary::BinaryReaderImpl& reader, const ProtocolVersion&)
+ void QueryGetColumnsMetaResponse::ReadOnSuccess(impl::binary::BinaryReaderImpl& reader,
+ const ProtocolVersion& ver)
{
- meta::ReadColumnMetaVector(reader, meta);
+ meta::ReadColumnMetaVector(reader, meta, ver);
}
QueryGetTablesMetaResponse::QueryGetTablesMetaResponse()
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/meta/column_meta.cpp b/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
index b7f212a..476f6a6 100644
--- a/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
+++ b/modules/platforms/cpp/odbc/src/meta/column_meta.cpp
@@ -15,6 +15,8 @@
* limitations under the License.
*/
+#include "ignite/common/utils.h"
+
#include "ignite/odbc/system/odbc_constants.h"
#include "ignite/odbc/meta/column_meta.h"
#include "ignite/odbc/type_traits.h"
@@ -72,13 +74,19 @@ namespace ignite
#undef DBG_STR_CASE
- void ColumnMeta::Read(ignite::impl::binary::BinaryReaderImpl& reader)
+ void ColumnMeta::Read(ignite::impl::binary::BinaryReaderImpl& reader, const ProtocolVersion& ver)
{
utility::ReadString(reader, schemaName);
utility::ReadString(reader, tableName);
utility::ReadString(reader, columnName);
dataType = reader.ReadInt8();
+
+ if (ver >= ProtocolVersion::VERSION_2_7_0)
+ {
+ precision = reader.ReadInt32();
+ scale = reader.ReadInt32();
+ }
}
bool ColumnMeta::GetAttribute(uint16_t fieldId, std::string& value) const
@@ -137,6 +145,29 @@ namespace ignite
return true;
}
+ case SQL_DESC_PRECISION:
+ case SQL_COLUMN_LENGTH:
+ case SQL_COLUMN_PRECISION:
+ {
+ if (precision == -1)
+ return false;
+
+ value = common::LexicalCast<std::string>(precision);
+
+ return true;
+ }
+
+ case SQL_DESC_SCALE:
+ case SQL_COLUMN_SCALE:
+ {
+ if (scale == -1)
+ return false;
+
+ value = common::LexicalCast<std::string>(precision);
+
+ return true;
+ }
+
default:
return false;
}
@@ -149,6 +180,15 @@ namespace ignite
switch (fieldId)
{
case SQL_DESC_FIXED_PREC_SCALE:
+ {
+ if (scale == -1)
+ value = SQL_FALSE;
+ else
+ value = SQL_TRUE;
+
+ break;
+ }
+
case SQL_DESC_AUTO_UNIQUE_VALUE:
{
value = SQL_FALSE;
@@ -185,7 +225,10 @@ namespace ignite
case SQL_DESC_OCTET_LENGTH:
case SQL_COLUMN_LENGTH:
{
- value = type_traits::BinaryTypeTransferLength(dataType);
+ if (precision == -1)
+ value = type_traits::BinaryTypeTransferLength(dataType);
+ else
+ value = precision;
break;
}
@@ -207,7 +250,10 @@ namespace ignite
case SQL_DESC_PRECISION:
case SQL_COLUMN_PRECISION:
{
- value = type_traits::BinaryTypeColumnSize(dataType);
+ if (precision == -1)
+ value = type_traits::BinaryTypeColumnSize(dataType);
+ else
+ value = precision;
break;
}
@@ -215,10 +261,15 @@ namespace ignite
case SQL_DESC_SCALE:
case SQL_COLUMN_SCALE:
{
- value = type_traits::BinaryTypeDecimalDigits(dataType);
+ if (scale == -1)
+ {
+ value = type_traits::BinaryTypeDecimalDigits(dataType);
- if (value < 0)
- value = 0;
+ if (value < 0)
+ value = 0;
+ }
+ else
+ value = scale;
break;
}
@@ -260,7 +311,8 @@ namespace ignite
return true;
}
- void ReadColumnMetaVector(ignite::impl::binary::BinaryReaderImpl& reader, ColumnMetaVector& meta)
+ void ReadColumnMetaVector(ignite::impl::binary::BinaryReaderImpl& reader, ColumnMetaVector& meta,
+ const ProtocolVersion& ver)
{
int32_t metaNum = reader.ReadInt32();
@@ -271,7 +323,7 @@ namespace ignite
{
meta.push_back(ColumnMeta());
- meta.back().Read(reader);
+ meta.back().Read(reader, ver);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/cpp/odbc/src/protocol_version.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc/src/protocol_version.cpp b/modules/platforms/cpp/odbc/src/protocol_version.cpp
index c345dd4..01937e2 100644
--- a/modules/platforms/cpp/odbc/src/protocol_version.cpp
+++ b/modules/platforms/cpp/odbc/src/protocol_version.cpp
@@ -31,6 +31,7 @@ namespace ignite
const ProtocolVersion ProtocolVersion::VERSION_2_3_0(2, 3, 0);
const ProtocolVersion ProtocolVersion::VERSION_2_3_2(2, 3, 2);
const ProtocolVersion ProtocolVersion::VERSION_2_5_0(2, 5, 0);
+ const ProtocolVersion ProtocolVersion::VERSION_2_7_0(2, 7, 0);
ProtocolVersion::VersionSet::value_type supportedArray[] = {
ProtocolVersion::VERSION_2_1_0,
@@ -38,6 +39,7 @@ namespace ignite
ProtocolVersion::VERSION_2_3_0,
ProtocolVersion::VERSION_2_3_2,
ProtocolVersion::VERSION_2_5_0,
+ ProtocolVersion::VERSION_2_7_0
};
const ProtocolVersion::VersionSet ProtocolVersion::supported(supportedArray,
@@ -66,7 +68,7 @@ namespace ignite
const ProtocolVersion& ProtocolVersion::GetCurrent()
{
- return VERSION_2_5_0;
+ return VERSION_2_7_0;
}
void ThrowParseError()
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/QueryEntityConfigurationParityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/QueryEntityConfigurationParityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/QueryEntityConfigurationParityTest.cs
index ba10cda..1171e16 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/QueryEntityConfigurationParityTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ApiParity/QueryEntityConfigurationParityTest.cs
@@ -33,7 +33,8 @@ namespace Apache.Ignite.Core.Tests.ApiParity
"KeyFields",
"NotNullFields",
"DefaultFieldValues",
- "DecimalInfo"
+ "FieldsPrecision",
+ "FieldsScale"
};
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/ClientCacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/ClientCacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/ClientCacheConfigurationTest.cs
index 04ad7dc..1481f24 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/ClientCacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/ClientCacheConfigurationTest.cs
@@ -23,6 +23,7 @@ namespace Apache.Ignite.Core.Tests.Client.Cache
using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Client.Cache;
using Apache.Ignite.Core.Impl.Binary.IO;
+ using Apache.Ignite.Core.Impl.Client;
using Apache.Ignite.Core.Impl.Client.Cache;
using Apache.Ignite.Core.Tests.Cache;
using NUnit.Framework;
@@ -178,9 +179,9 @@ namespace Apache.Ignite.Core.Tests.Client.Cache
{
using (var stream = new BinaryHeapStream(128))
{
- ClientCacheConfigurationSerializer.Write(stream, cfg, true);
+ ClientCacheConfigurationSerializer.Write(stream, cfg, ClientSocket.CurrentProtocolVersion, true);
stream.Seek(0, SeekOrigin.Begin);
- return new CacheClientConfiguration(stream);
+ return new CacheClientConfiguration(stream, ClientSocket.CurrentProtocolVersion);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
index 06a7d72..a8925ad 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/CacheConfiguration.cs
@@ -40,6 +40,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Cache.Affinity;
using Apache.Ignite.Core.Impl.Cache.Expiry;
+ using Apache.Ignite.Core.Impl.Client;
using Apache.Ignite.Core.Log;
using Apache.Ignite.Core.Plugin.Cache;
using BinaryReader = Apache.Ignite.Core.Impl.Binary.BinaryReader;
@@ -48,7 +49,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// <summary>
/// Defines grid cache configuration.
/// </summary>
- public class CacheConfiguration : IBinaryRawWriteAware<BinaryWriter>
+ public class CacheConfiguration : IBinaryRawWriteAwareEx<BinaryWriter>
{
/// <summary> Default size of rebalance thread pool. </summary>
public const int DefaultRebalanceThreadPoolSize = 2;
@@ -252,12 +253,12 @@ namespace Apache.Ignite.Core.Cache.Configuration
{
using (var stream = IgniteManager.Memory.Allocate().GetStream())
{
- other.Write(BinaryUtils.Marshaller.StartMarshal(stream));
+ other.Write(BinaryUtils.Marshaller.StartMarshal(stream), ClientSocket.CurrentProtocolVersion);
stream.SynchronizeOutput();
stream.Seek(0, SeekOrigin.Begin);
- Read(BinaryUtils.Marshaller.StartUnmarshal(stream));
+ Read(BinaryUtils.Marshaller.StartUnmarshal(stream), ClientSocket.CurrentProtocolVersion);
}
CopyLocalProperties(other);
@@ -268,16 +269,18 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// Initializes a new instance of the <see cref="CacheConfiguration"/> class.
/// </summary>
/// <param name="reader">The reader.</param>
- internal CacheConfiguration(BinaryReader reader)
+ /// <param name="srvVer">Server version.</param>
+ internal CacheConfiguration(BinaryReader reader, ClientProtocolVersion srvVer)
{
- Read(reader);
+ Read(reader, srvVer);
}
/// <summary>
/// Reads data into this instance from the specified reader.
/// </summary>
/// <param name="reader">The reader.</param>
- private void Read(BinaryReader reader)
+ /// <param name="srvVer">Server version.</param>
+ private void Read(BinaryReader reader, ClientProtocolVersion srvVer)
{
// Make sure system marshaller is used.
Debug.Assert(reader.Marshaller == BinaryUtils.Marshaller);
@@ -327,7 +330,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
QueryParallelism = reader.ReadInt();
SqlSchema = reader.ReadString();
- QueryEntities = reader.ReadCollectionRaw(r => new QueryEntity(r));
+ QueryEntities = reader.ReadCollectionRaw(r => new QueryEntity(r, srvVer));
NearConfiguration = reader.ReadBoolean() ? new NearCacheConfiguration(reader) : null;
@@ -364,16 +367,18 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// Writes this instance to the specified writer.
/// </summary>
/// <param name="writer">The writer.</param>
- void IBinaryRawWriteAware<BinaryWriter>.Write(BinaryWriter writer)
+ /// <param name="srvVer">Server version.</param>
+ void IBinaryRawWriteAwareEx<BinaryWriter>.Write(BinaryWriter writer, ClientProtocolVersion srvVer)
{
- Write(writer);
+ Write(writer, srvVer);
}
/// <summary>
/// Writes this instance to the specified writer.
/// </summary>
/// <param name="writer">The writer.</param>
- internal void Write(BinaryWriter writer)
+ /// <param name="srvVer">Server version.</param>
+ internal void Write(BinaryWriter writer, ClientProtocolVersion srvVer)
{
// Make sure system marshaller is used.
Debug.Assert(writer.Marshaller == BinaryUtils.Marshaller);
@@ -423,7 +428,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
writer.WriteInt(QueryParallelism);
writer.WriteString(SqlSchema);
- writer.WriteCollectionRaw(QueryEntities);
+ writer.WriteCollectionRaw(QueryEntities, srvVer);
if (NearConfiguration != null)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
index 32173ba..dc8be7f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
@@ -27,13 +27,14 @@ namespace Apache.Ignite.Core.Cache.Configuration
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Cache;
+ using Apache.Ignite.Core.Impl.Client;
using Apache.Ignite.Core.Log;
/// <summary>
/// Query entity is a description of cache entry (composed of key and value)
/// in a way of how it must be indexed and can be queried.
/// </summary>
- public sealed class QueryEntity : IQueryEntityInternal, IBinaryRawWriteAware
+ public sealed class QueryEntity : IQueryEntityInternal, IBinaryRawWriteAwareEx
{
/** */
private Type _keyType;
@@ -232,7 +233,8 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// Initializes a new instance of the <see cref="QueryEntity"/> class.
/// </summary>
/// <param name="reader">The reader.</param>
- internal QueryEntity(IBinaryRawReader reader)
+ /// <param name="srvVer">Server version.</param>
+ internal QueryEntity(IBinaryRawReader reader, ClientProtocolVersion srvVer)
{
KeyTypeName = reader.ReadString();
ValueTypeName = reader.ReadString();
@@ -243,7 +245,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
var count = reader.ReadInt();
Fields = count == 0
? null
- : Enumerable.Range(0, count).Select(x => new QueryField(reader)).ToList();
+ : Enumerable.Range(0, count).Select(x => new QueryField(reader, srvVer)).ToList();
count = reader.ReadInt();
Aliases = count == 0 ? null : Enumerable.Range(0, count)
@@ -256,7 +258,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// <summary>
/// Writes this instance.
/// </summary>
- void IBinaryRawWriteAware<IBinaryRawWriter>.Write(IBinaryRawWriter writer)
+ void IBinaryRawWriteAwareEx<IBinaryRawWriter>.Write(IBinaryRawWriter writer, ClientProtocolVersion srvVer)
{
writer.WriteString(KeyTypeName);
writer.WriteString(ValueTypeName);
@@ -270,7 +272,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
foreach (var field in Fields)
{
- field.Write(writer);
+ field.Write(writer, srvVer);
}
}
else
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
index 869ce7d..4142986 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
@@ -23,6 +23,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
using System.Diagnostics;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Client;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Log;
@@ -42,7 +43,8 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// </summary>
public QueryField()
{
- // No-op.
+ Precision = -1;
+ Scale = -1;
}
/// <summary>
@@ -50,7 +52,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// </summary>
/// <param name="name">Name.</param>
/// <param name="javaFieldTypeName">Java type name.</param>
- public QueryField(string name, string javaFieldTypeName)
+ public QueryField(string name, string javaFieldTypeName): this()
{
IgniteArgumentCheck.NotNullOrEmpty(name, "name");
IgniteArgumentCheck.NotNullOrEmpty(javaFieldTypeName, "typeName");
@@ -64,7 +66,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// </summary>
/// <param name="name">Name.</param>
/// <param name="fieldType">Type.</param>
- public QueryField(string name, Type fieldType)
+ public QueryField(string name, Type fieldType): this()
{
IgniteArgumentCheck.NotNullOrEmpty(name, "name");
IgniteArgumentCheck.NotNull(fieldType, "type");
@@ -76,7 +78,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// <summary>
/// Initializes a new instance of the <see cref="QueryField"/> class.
/// </summary>
- internal QueryField(IBinaryRawReader reader)
+ internal QueryField(IBinaryRawReader reader, ClientProtocolVersion srvVer)
{
Debug.Assert(reader != null);
@@ -85,14 +87,18 @@ namespace Apache.Ignite.Core.Cache.Configuration
IsKeyField = reader.ReadBoolean();
NotNull = reader.ReadBoolean();
DefaultValue = reader.ReadObject<object>();
- Precision = reader.ReadInt();
- Scale = reader.ReadInt();
+
+ if (srvVer.CompareTo(ClientSocket.Ver120) >= 0)
+ {
+ Precision = reader.ReadInt();
+ Scale = reader.ReadInt();
+ }
}
/// <summary>
/// Writes this instance to the specified writer.
/// </summary>
- internal void Write(IBinaryRawWriter writer)
+ internal void Write(IBinaryRawWriter writer, ClientProtocolVersion srvVer)
{
Debug.Assert(writer != null);
@@ -101,8 +107,12 @@ namespace Apache.Ignite.Core.Cache.Configuration
writer.WriteBoolean(IsKeyField);
writer.WriteBoolean(NotNull);
writer.WriteObject(DefaultValue);
- writer.WriteInt(Precision);
- writer.WriteInt(Scale);
+
+ if (srvVer.CompareTo(ClientSocket.Ver120) >= 0)
+ {
+ writer.WriteInt(Precision);
+ writer.WriteInt(Scale);
+ }
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QuerySqlFieldAttribute.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QuerySqlFieldAttribute.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QuerySqlFieldAttribute.cs
index bfd3575..2c1d566 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QuerySqlFieldAttribute.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QuerySqlFieldAttribute.cs
@@ -35,6 +35,8 @@ namespace Apache.Ignite.Core.Cache.Configuration
public QuerySqlFieldAttribute()
{
IndexInlineSize = QueryIndex.DefaultInlineSize;
+ Precision = -1;
+ Scale = -1;
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Client/Cache/CacheClientConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Client/Cache/CacheClientConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Client/Cache/CacheClientConfiguration.cs
index fad6b58..c6cb112 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Client/Cache/CacheClientConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Client/Cache/CacheClientConfiguration.cs
@@ -29,6 +29,7 @@ namespace Apache.Ignite.Core.Client.Cache
using Apache.Ignite.Core.Configuration;
using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.Impl.Binary.IO;
+ using Apache.Ignite.Core.Impl.Client;
using Apache.Ignite.Core.Impl.Client.Cache;
using Apache.Ignite.Core.Impl.Common;
@@ -115,12 +116,12 @@ namespace Apache.Ignite.Core.Client.Cache
{
using (var stream = IgniteManager.Memory.Allocate().GetStream())
{
- ClientCacheConfigurationSerializer.Write(stream, other, true);
+ ClientCacheConfigurationSerializer.Write(stream, other, ClientSocket.CurrentProtocolVersion, true);
stream.SynchronizeOutput();
stream.Seek(0, SeekOrigin.Begin);
- ClientCacheConfigurationSerializer.Read(stream, this);
+ ClientCacheConfigurationSerializer.Read(stream, this, ClientSocket.CurrentProtocolVersion);
}
CopyLocalProperties(other);
@@ -156,11 +157,11 @@ namespace Apache.Ignite.Core.Client.Cache
/// <summary>
/// Initializes a new instance of the <see cref="CacheClientConfiguration"/> class.
/// </summary>
- internal CacheClientConfiguration(IBinaryStream stream)
+ internal CacheClientConfiguration(IBinaryStream stream, ClientProtocolVersion srvVer)
{
Debug.Assert(stream != null);
- ClientCacheConfigurationSerializer.Read(stream, this);
+ ClientCacheConfigurationSerializer.Read(stream, this, srvVer);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 9bcf763..0d66b9f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -43,6 +43,7 @@ namespace Apache.Ignite.Core
using Apache.Ignite.Core.Failure;
using Apache.Ignite.Core.Impl;
using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Client;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Impl.Ssl;
using Apache.Ignite.Core.Lifecycle;
@@ -252,13 +253,13 @@ namespace Apache.Ignite.Core
{
var marsh = BinaryUtils.Marshaller;
- configuration.Write(marsh.StartMarshal(stream));
+ configuration.Write(marsh.StartMarshal(stream), ClientSocket.CurrentProtocolVersion);
stream.SynchronizeOutput();
stream.Seek(0, SeekOrigin.Begin);
- ReadCore(marsh.StartUnmarshal(stream));
+ ReadCore(marsh.StartUnmarshal(stream), ClientSocket.CurrentProtocolVersion);
}
CopyLocalProperties(configuration);
@@ -269,12 +270,14 @@ namespace Apache.Ignite.Core
/// </summary>
/// <param name="binaryReader">The binary reader.</param>
/// <param name="baseConfig">The base configuration.</param>
- internal IgniteConfiguration(BinaryReader binaryReader, IgniteConfiguration baseConfig)
+ /// <param name="srvVer">Server version.</param>
+ internal IgniteConfiguration(BinaryReader binaryReader, IgniteConfiguration baseConfig,
+ ClientProtocolVersion srvVer)
{
Debug.Assert(binaryReader != null);
Debug.Assert(baseConfig != null);
- Read(binaryReader);
+ Read(binaryReader, srvVer);
CopyLocalProperties(baseConfig);
}
@@ -282,7 +285,8 @@ namespace Apache.Ignite.Core
/// Writes this instance to a writer.
/// </summary>
/// <param name="writer">The writer.</param>
- internal void Write(BinaryWriter writer)
+ /// <param name="srvVer">Server version.</param>
+ internal void Write(BinaryWriter writer, ClientProtocolVersion srvVer)
{
Debug.Assert(writer != null);
@@ -332,7 +336,7 @@ namespace Apache.Ignite.Core
writer.WriteIntNullable(_queryThreadPoolSize);
// Cache config
- writer.WriteCollectionRaw(CacheConfiguration);
+ writer.WriteCollectionRaw(CacheConfiguration, srvVer);
// Discovery config
var disco = DiscoverySpi;
@@ -650,7 +654,8 @@ namespace Apache.Ignite.Core
/// Reads data from specified reader into current instance.
/// </summary>
/// <param name="r">The binary reader.</param>
- private void ReadCore(BinaryReader r)
+ /// <param name="srvVer">Server version.</param>
+ private void ReadCore(BinaryReader r, ClientProtocolVersion srvVer)
{
// Simple properties
_clientMode = r.ReadBooleanNullable();
@@ -697,7 +702,7 @@ namespace Apache.Ignite.Core
_queryThreadPoolSize = r.ReadIntNullable();
// Cache config
- CacheConfiguration = r.ReadCollectionRaw(x => new CacheConfiguration(x));
+ CacheConfiguration = r.ReadCollectionRaw(x => new CacheConfiguration(x, srvVer));
// Discovery config
DiscoverySpi = r.ReadBoolean() ? new TcpDiscoverySpi(r) : null;
@@ -838,9 +843,10 @@ namespace Apache.Ignite.Core
/// Reads data from specified reader into current instance.
/// </summary>
/// <param name="binaryReader">The binary reader.</param>
- private void Read(BinaryReader binaryReader)
+ /// <param name="srvVer">Server version.</param>
+ private void Read(BinaryReader binaryReader, ClientProtocolVersion srvVer)
{
- ReadCore(binaryReader);
+ ReadCore(binaryReader, srvVer);
// Misc
IgniteHome = binaryReader.ReadString();
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
index 5b93609..fe80ba1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
@@ -407,7 +407,8 @@ namespace Apache.Ignite.Core
// 3. Send configuration details to Java
cfg.Validate(log);
- cfg.Write(BinaryUtils.Marshaller.StartMarshal(outStream)); // Use system marshaller.
+ // Use system marshaller.
+ cfg.Write(BinaryUtils.Marshaller.StartMarshal(outStream), ClientSocket.CurrentProtocolVersion);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriterExtensions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriterExtensions.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriterExtensions.cs
index d87d217..e504d75 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriterExtensions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriterExtensions.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Core.Impl.Binary
using System.Diagnostics;
using System.IO;
using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Client;
/// <summary>
/// Writer extensions.
@@ -211,5 +212,33 @@ namespace Apache.Ignite.Core.Impl.Binary
writer.WriteInt(0);
}
}
+
+ /// <summary>
+ /// Writes the collection of write-aware-ex items.
+ /// </summary>
+ public static void WriteCollectionRaw<T, TWriter>(this TWriter writer, ICollection<T> collection,
+ ClientProtocolVersion srvVer) where T : IBinaryRawWriteAwareEx<TWriter> where TWriter: IBinaryRawWriter
+ {
+ Debug.Assert(writer != null);
+
+ if (collection != null)
+ {
+ writer.WriteInt(collection.Count);
+
+ foreach (var x in collection)
+ {
+ if (x == null)
+ {
+ throw new ArgumentNullException(string.Format("{0} can not be null", typeof(T).Name));
+ }
+
+ x.Write(writer, srvVer);
+ }
+ }
+ else
+ {
+ writer.WriteInt(0);
+ }
+ }
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryRawWriteAware.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryRawWriteAware.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryRawWriteAware.cs
index 9b191e4..737d3c9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryRawWriteAware.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryRawWriteAware.cs
@@ -18,6 +18,29 @@
namespace Apache.Ignite.Core.Impl.Binary
{
using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Client;
+
+ /// <summary>
+ /// Represents an object that can write itself to a raw binary writer using specific server version.
+ /// </summary>
+ internal interface IBinaryRawWriteAwareEx<in T> where T : IBinaryRawWriter
+ {
+ /// <summary>
+ /// Writes this object to the given writer.
+ /// </summary>
+ /// <param name="writer">Writer.</param>
+ /// <param name="srvVer">Server version.</param>
+ /// <exception cref="System.IO.IOException">If write failed.</exception>
+ void Write(T writer, ClientProtocolVersion srvVer);
+ }
+
+ /// <summary>
+ /// Represents an object that can write itself to a raw binary writer.
+ /// </summary>
+ internal interface IBinaryRawWriteAwareEx : IBinaryRawWriteAwareEx<IBinaryRawWriter>
+ {
+ // No-op.
+ }
/// <summary>
/// Represents an object that can write itself to a raw binary writer.
@@ -39,4 +62,4 @@ namespace Apache.Ignite.Core.Impl.Binary
{
// No-op.
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index 71fbaee..9e99967 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -34,6 +34,7 @@ namespace Apache.Ignite.Core.Impl.Cache
using Apache.Ignite.Core.Impl.Cache.Expiry;
using Apache.Ignite.Core.Impl.Cache.Query;
using Apache.Ignite.Core.Impl.Cache.Query.Continuous;
+ using Apache.Ignite.Core.Impl.Client;
using Apache.Ignite.Core.Impl.Cluster;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Impl.Transactions;
@@ -161,7 +162,7 @@ namespace Apache.Ignite.Core.Impl.Cache
public CacheConfiguration GetConfiguration()
{
return DoInOp((int) CacheOp.GetConfig, stream => new CacheConfiguration(
- BinaryUtils.Marshaller.StartUnmarshal(stream)));
+ BinaryUtils.Marshaller.StartUnmarshal(stream), ClientSocket.CurrentProtocolVersion));
}
/** <inheritDoc /> */
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/CacheClient.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/CacheClient.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/CacheClient.cs
index 8138b77..a5a9246 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/CacheClient.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/CacheClient.cs
@@ -513,7 +513,8 @@ namespace Apache.Ignite.Core.Impl.Client.Cache
/** <inheritDoc /> */
public CacheClientConfiguration GetConfiguration()
{
- return DoOutInOp(ClientOp.CacheGetConfiguration, null, s => new CacheClientConfiguration(s));
+ return DoOutInOp(ClientOp.CacheGetConfiguration, null,
+ s => new CacheClientConfiguration(s, _ignite.ServerVersion()));
}
/** <inheritDoc /> */
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/ClientCacheConfigurationSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/ClientCacheConfigurationSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/ClientCacheConfigurationSerializer.cs
index 552c778..0cccdac 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/ClientCacheConfigurationSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/Cache/ClientCacheConfigurationSerializer.cs
@@ -195,7 +195,8 @@ namespace Apache.Ignite.Core.Impl.Client.Cache
/// <summary>
/// Writes the specified config.
/// </summary>
- public static void Write(IBinaryStream stream, CacheClientConfiguration cfg, bool skipCodes = false)
+ public static void Write(IBinaryStream stream, CacheClientConfiguration cfg, ClientProtocolVersion srvVer,
+ bool skipCodes = false)
{
Debug.Assert(stream != null);
Debug.Assert(cfg != null);
@@ -302,7 +303,7 @@ namespace Apache.Ignite.Core.Impl.Client.Cache
writer.WriteCollectionRaw(cfg.KeyConfiguration);
code(Op.QueryEntities);
- writer.WriteCollectionRaw(cfg.QueryEntities);
+ writer.WriteCollectionRaw(cfg.QueryEntities, srvVer);
// Write length (so that part of the config can be skipped).
var len = writer.Stream.Position - pos - 4;
@@ -312,7 +313,7 @@ namespace Apache.Ignite.Core.Impl.Client.Cache
/// <summary>
/// Reads the config.
/// </summary>
- public static void Read(IBinaryStream stream, CacheClientConfiguration cfg)
+ public static void Read(IBinaryStream stream, CacheClientConfiguration cfg, ClientProtocolVersion srvVer)
{
Debug.Assert(stream != null);
@@ -351,7 +352,7 @@ namespace Apache.Ignite.Core.Impl.Client.Cache
cfg.SqlSchema = reader.ReadString();
cfg.WriteSynchronizationMode = (CacheWriteSynchronizationMode)reader.ReadInt();
cfg.KeyConfiguration = reader.ReadCollectionRaw(r => new CacheKeyConfiguration(r));
- cfg.QueryEntities = reader.ReadCollectionRaw(r => new QueryEntity(r));
+ cfg.QueryEntities = reader.ReadCollectionRaw(r => new QueryEntity(r, srvVer));
Debug.Assert(len == reader.Stream.Position - pos);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
index 11d7942..8a8b53b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
@@ -45,8 +45,11 @@ namespace Apache.Ignite.Core.Impl.Client
/** Version 1.1.0. */
private static readonly ClientProtocolVersion Ver110 = new ClientProtocolVersion(1, 1, 0);
+ /** Version 1.2.0. */
+ public static readonly ClientProtocolVersion Ver120 = new ClientProtocolVersion(1, 2, 0);
+
/** Current version. */
- private static readonly ClientProtocolVersion CurrentProtocolVersion = Ver110;
+ public static readonly ClientProtocolVersion CurrentProtocolVersion = Ver120;
/** Handshake opcode. */
private const byte OpHandshake = 1;
@@ -69,6 +72,9 @@ namespace Apache.Ignite.Core.Impl.Client
/** Callback checker guard. */
private volatile bool _checkingTimeouts;
+ /** Server protocol version. */
+ public ClientProtocolVersion ServerVersion { get; private set; }
+
/** Current async operations, map from request id. */
private readonly ConcurrentDictionary<long, Request> _requests
= new ConcurrentDictionary<long, Request>();
@@ -105,9 +111,11 @@ namespace Apache.Ignite.Core.Impl.Client
_socket = Connect(clientConfiguration);
_stream = GetSocketStream(_socket, clientConfiguration);
+ ServerVersion = version ?? CurrentProtocolVersion;
+
Validate(clientConfiguration);
- Handshake(clientConfiguration, version ?? CurrentProtocolVersion);
+ Handshake(clientConfiguration, ServerVersion);
// Check periodically if any request has timed out.
if (_timeout > TimeSpan.Zero)
@@ -303,10 +311,12 @@ namespace Apache.Ignite.Core.Impl.Client
if (success)
{
+ ServerVersion = version;
+
return;
}
- var serverVersion =
+ ServerVersion =
new ClientProtocolVersion(stream.ReadShort(), stream.ReadShort(), stream.ReadShort());
var errMsg = BinaryUtils.Marshaller.Unmarshal<string>(stream);
@@ -325,17 +335,17 @@ namespace Apache.Ignite.Core.Impl.Client
}
// Re-try if possible.
- bool retry = serverVersion.CompareTo(version) < 0 && serverVersion.Equals(Ver100);
+ bool retry = ServerVersion.CompareTo(version) < 0 && ServerVersion.Equals(Ver100);
if (retry)
{
- Handshake(clientConfiguration, serverVersion);
+ Handshake(clientConfiguration, ServerVersion);
}
else
{
throw new IgniteClientException(string.Format(
"Client handshake failed: '{0}'. Client version: {1}. Server version: {2}",
- errMsg, version, serverVersion), null, errCode);
+ errMsg, version, ServerVersion), null, errCode);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/IgniteClient.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/IgniteClient.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/IgniteClient.cs
index 1b1aa6f..61d0220 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/IgniteClient.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/IgniteClient.cs
@@ -115,7 +115,7 @@ namespace Apache.Ignite.Core.Impl.Client
IgniteArgumentCheck.NotNull(configuration, "configuration");
DoOutOp(ClientOp.CacheGetOrCreateWithConfiguration,
- w => ClientCacheConfigurationSerializer.Write(w.Stream, configuration));
+ w => ClientCacheConfigurationSerializer.Write(w.Stream, configuration, ServerVersion()));
return GetCache<TK, TV>(configuration.Name);
}
@@ -136,7 +136,7 @@ namespace Apache.Ignite.Core.Impl.Client
IgniteArgumentCheck.NotNull(configuration, "configuration");
DoOutOp(ClientOp.CacheCreateWithConfiguration,
- w => ClientCacheConfigurationSerializer.Write(w.Stream, configuration));
+ w => ClientCacheConfigurationSerializer.Write(w.Stream, configuration, ServerVersion()));
return GetCache<TK, TV>(configuration.Name);
}
@@ -217,6 +217,13 @@ namespace Apache.Ignite.Core.Impl.Client
}
/// <summary>
+ /// Gets the protocol version supported by server.
+ /// </summary>
+ public ClientProtocolVersion ServerVersion() {
+ return _socket.ServerVersion;
+ }
+
+ /// <summary>
/// Gets the client not supported exception.
/// </summary>
public static NotSupportedException GetClientNotSupportedException(string info = null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index ad9a185..42d9ed6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -35,6 +35,7 @@ namespace Apache.Ignite.Core.Impl
using Apache.Ignite.Core.Events;
using Apache.Ignite.Core.Impl.Binary;
using Apache.Ignite.Core.Impl.Cache;
+ using Apache.Ignite.Core.Impl.Client;
using Apache.Ignite.Core.Impl.Cluster;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Impl.Datastream;
@@ -483,7 +484,7 @@ namespace Apache.Ignite.Core.Impl
{
var w = BinaryUtils.Marshaller.StartMarshal(s);
- configuration.Write(w);
+ configuration.Write(w, ClientSocket.CurrentProtocolVersion);
if (nearConfiguration != null)
{
@@ -683,7 +684,8 @@ namespace Apache.Ignite.Core.Impl
public IgniteConfiguration GetConfiguration()
{
return DoInOp((int) Op.GetIgniteConfiguration,
- s => new IgniteConfiguration(BinaryUtils.Marshaller.StartUnmarshal(s), _cfg));
+ s => new IgniteConfiguration(BinaryUtils.Marshaller.StartUnmarshal(s), _cfg,
+ ClientSocket.CurrentProtocolVersion));
}
/** <inheritdoc /> */
@@ -876,7 +878,7 @@ namespace Apache.Ignite.Core.Impl
IgniteArgumentCheck.NotNull(configuration, "configuration");
DoOutOp((int) Op.AddCacheConfiguration,
- s => configuration.Write(BinaryUtils.Marshaller.StartMarshal(s)));
+ s => configuration.Write(BinaryUtils.Marshaller.StartMarshal(s), ClientSocket.CurrentProtocolVersion));
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/baab0a6d/modules/platforms/nodejs/lib/internal/ClientSocket.js
----------------------------------------------------------------------
diff --git a/modules/platforms/nodejs/lib/internal/ClientSocket.js b/modules/platforms/nodejs/lib/internal/ClientSocket.js
index ac7ccec..1d1a4dd 100644
--- a/modules/platforms/nodejs/lib/internal/ClientSocket.js
+++ b/modules/platforms/nodejs/lib/internal/ClientSocket.js
@@ -77,12 +77,16 @@ class ProtocolVersion {
const PROTOCOL_VERSION_1_0_0 = new ProtocolVersion(1, 0, 0);
const PROTOCOL_VERSION_1_1_0 = new ProtocolVersion(1, 1, 0);
+const PROTOCOL_VERSION_1_2_0 = new ProtocolVersion(1, 2, 0);
const SUPPORTED_VERSIONS = [
// PROTOCOL_VERSION_1_0_0, // Support for QueryField precision/scale fields breaks 1.0.0 compatibility
- PROTOCOL_VERSION_1_1_0
+ PROTOCOL_VERSION_1_1_0,
+ PROTOCOL_VERSION_1_2_0
];
+const CURRENT_VERSION = PROTOCOL_VERSION_1_2_0;
+
const STATE = Object.freeze({
INITIAL : 0,
HANDSHAKE : 1,
@@ -111,7 +115,7 @@ class ClientSocket {
async connect() {
return new Promise((resolve, reject) => {
this._connectSocket(
- this._getHandshake(PROTOCOL_VERSION_1_1_0, resolve, reject));
+ this._getHandshake(CURRENT_VERSION, resolve, reject));
});
}
@@ -430,4 +434,4 @@ class Request {
}
}
-module.exports = ClientSocket;
\ No newline at end of file
+module.exports = ClientSocket;