Sergey Kosarev created IGNITE-7674:
--------------------------------------

             Summary: 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


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)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to