You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Tupitsyn (JIRA)" <ji...@apache.org> on 2016/07/20 10:06:20 UTC
[jira] [Updated] (IGNITE-3512) .NET: IBinaryObject.ToBuilder loses
type name
[ https://issues.apache.org/jira/browse/IGNITE-3512?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavel Tupitsyn updated IGNITE-3512:
-----------------------------------
Description:
Steps to reproduce:
* Create a builder for a string type name, set field, put to cache
* On another node, read this object, call ToBuilder, call Build
Type name is not propagated with metadata, which leads to assertion error (with -ea) or "Two binary types have duplicate type ID [typeId=949122880, typeName1=Security, typeName2=null]]" error.
Unit test:
{code}
[Test]
public void Test()
{
using (var grid1 = Ignition.Start(TestUtils.GetTestConfiguration()))
using (var grid2 = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration(false)) {GridName = "grid2"}))
{
var cache1 = grid1.CreateCache<int, int>("cache").WithKeepBinary<int, IBinaryObject>();
var obj1 = grid1.GetBinary().GetBuilder("myType").SetField("myField", "val").Build();
cache1[1] = obj1;
var cache2 = grid2.GetCache<int, int>("cache").WithKeepBinary<int, IBinaryObject>();
var obj2 = cache2[1];
var val = obj2.GetField<string>("myField");
var obj2Ex = grid2.GetBinary().GetBuilder(obj2).SetField("myField", val + "_modified").Build();
cache2[2] = obj2Ex;
}
}
{code}
Workaround is to register the type by name on start:
{code}
BinaryConfiguration = new BinaryConfiguration
{
Types = new[] {"myType"}
}
{code}
was:
Steps to reproduce:
* Create a builder for a string type name, set field, put to cache
* On another node, read this object, call ToBuilder, call Build
Type name is not propagated with metadata, which leads to assertion error (with -ea) or "Two binary types have duplicate type ID [typeId=949122880, typeName1=Security, typeName2=null]]" error.
Unit test:
{code}
[Test]
public void Test()
{
using (var grid1 = Ignition.Start(TestUtils.GetTestConfiguration()))
using (var grid2 = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration(false)) {GridName = "grid2"}))
{
var cache1 = grid1.CreateCache<int, int>("cache").WithKeepBinary<int, IBinaryObject>();
var obj1 = grid1.GetBinary().GetBuilder("myType").SetField("myField", "val").Build();
cache1[1] = obj1;
var cache2 = grid2.GetCache<int, int>("cache").WithKeepBinary<int, IBinaryObject>();
var obj2 = cache2[1];
var val = obj2.GetField<string>("myField");
var obj2Ex = grid2.GetBinary().GetBuilder(obj2).SetField("myField", val + "_modified").Build();
cache2[2] = obj2Ex;
}
}
{code}
Workaround is to register the type by name on start:
{code}
BinaryConfiguration = new BinaryConfiguration
{
Types = new[] {"myType"}
}
{code}
> .NET: IBinaryObject.ToBuilder loses type name
> ---------------------------------------------
>
> Key: IGNITE-3512
> URL: https://issues.apache.org/jira/browse/IGNITE-3512
> Project: Ignite
> Issue Type: Bug
> Components: platforms
> Affects Versions: 1.5.0.final
> Reporter: Pavel Tupitsyn
> Assignee: Pavel Tupitsyn
> Fix For: 1.7
>
>
> Steps to reproduce:
> * Create a builder for a string type name, set field, put to cache
> * On another node, read this object, call ToBuilder, call Build
> Type name is not propagated with metadata, which leads to assertion error (with -ea) or "Two binary types have duplicate type ID [typeId=949122880, typeName1=Security, typeName2=null]]" error.
> Unit test:
> {code}
> [Test]
> public void Test()
> {
> using (var grid1 = Ignition.Start(TestUtils.GetTestConfiguration()))
> using (var grid2 = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration(false)) {GridName = "grid2"}))
> {
> var cache1 = grid1.CreateCache<int, int>("cache").WithKeepBinary<int, IBinaryObject>();
> var obj1 = grid1.GetBinary().GetBuilder("myType").SetField("myField", "val").Build();
> cache1[1] = obj1;
> var cache2 = grid2.GetCache<int, int>("cache").WithKeepBinary<int, IBinaryObject>();
> var obj2 = cache2[1];
> var val = obj2.GetField<string>("myField");
> var obj2Ex = grid2.GetBinary().GetBuilder(obj2).SetField("myField", val + "_modified").Build();
> cache2[2] = obj2Ex;
> }
> }
> {code}
> Workaround is to register the type by name on start:
> {code}
> BinaryConfiguration = new BinaryConfiguration
> {
> Types = new[] {"myType"}
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)