[ https://issues.apache.org/jira/browse/IGNITE-7674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Kosarev updated IGNITE-7674: ----------------------------------- Description: Usuaully if we have any data in a cache, if we try to create BynaryObject with the same field name and another type we BinaryObjectException is thrown Wrong value has been set [typeName=org.apache.ignite.internal.binary.Foo, fieldName=intField, fieldType=int, assignedValueType=String] , but there are cases we can create an inconsistent BinaryObject suppose we have {code:java} class Foo { private String strField; private int intField; public Foo(String strField, int intField) { this.intField = intField; this.strField = strField; } }{code} case 1 {code:java} binary.builder(Foo.class.getName()) .removeField("intField") .build() .toBuilder() .setField("intField", "String") .build();{code} case 2 (if we remove all fields schema flag is cleared ) {code:java} fooCache.<Integer, BinaryObject>withKeepBinary().get(1) .toBuilder() .removeField("intField") .removeField("strField") .build() .toBuilder() .setField("intField", "String") .build(){code} It is especially bad when we have an index on this field and cache is transactional. if we put wrong BinaryObject into the cache, we got TransactionHeuristicException on commit and broken transaction (data can be comitted or not in some cases) [^BinaryObjectChangeFieldTypeTest.java] reproduce the problems. was: Usuaully if we have any data in a cache, if we try to create BynaryObject with the same field name and another type we BinaryObjectException is thrown Wrong value has been set [typeName=org.apache.ignite.internal.binary.Foo, fieldName=intField, fieldType=int, assignedValueType=String] , but there are cases we can create an inconsistent BinaryObject suppose we have {code:java} class Foo { private String strField; private int intField; public Foo(String strField, int intField) { this.intField = intField; this.strField = strField; } }{code} case 1 {code:java} binary.builder(Foo.class.getName()) .removeField("intField") .build() .toBuilder() .setField("intField", "String") .build();{code} case 2 (if we remove all fields schema flag is cleared ) {code:java} fooCache.<Integer, BinaryObject>withKeepBinary().get(1) .toBuilder() .removeField("intField") .removeField("strField") .build() .toBuilder() .setField("intField", "String") .build(){code} It is especially bad when we have an index on this field and cache is transactional. if we put wrong BinaryObject into the cache, we got TransactionHeuristicException on commit and broken transaction (data can be comitted or not in some cases) > It is possible to create BinaryObject with wrong field type and that can lead > to broken Transaction (TransactionHeuristicException) > ----------------------------------------------------------------------------------------------------------------------------------- > > Key: IGNITE-7674 > URL: https://issues.apache.org/jira/browse/IGNITE-7674 > Project: Ignite > Issue Type: Bug > Components: binary, sql > Affects Versions: 2.3 > Reporter: Sergey Kosarev > Priority: Major > Attachments: BinaryObjectChangeFieldTypeTest.java > > > Usuaully if we have any data in a cache, if we try to create BynaryObject > with the same field name and another type we BinaryObjectException is thrown > Wrong value has been set [typeName=org.apache.ignite.internal.binary.Foo, > fieldName=intField, fieldType=int, assignedValueType=String] > , but there are cases we can create an inconsistent BinaryObject > suppose we have > {code:java} > class Foo { > private String strField; > private int intField; > public Foo(String strField, int intField) { > this.intField = intField; > this.strField = strField; > } > }{code} > case 1 > {code:java} > binary.builder(Foo.class.getName()) > .removeField("intField") > .build() > .toBuilder() > .setField("intField", "String") > .build();{code} > case 2 (if we remove all fields schema flag is cleared ) > {code:java} > fooCache.<Integer, BinaryObject>withKeepBinary().get(1) > .toBuilder() > .removeField("intField") > .removeField("strField") > .build() > .toBuilder() > .setField("intField", "String") > .build(){code} > > It is especially bad when we have an index on this field and cache is > transactional. > if we put wrong BinaryObject into the cache, we got > TransactionHeuristicException on commit and broken transaction (data can be > comitted or not in some cases) > [^BinaryObjectChangeFieldTypeTest.java] reproduce the problems. -- This message was sent by Atlassian JIRA (v7.6.3#76005)