3
votes

I've createted the binary type with the name 'SomeType' and filds:

f1:string
f2:string

And cache based on this type (via CacheConfiguration.setQueryEntities).

Now I want to change f1 from string to int. But I don't want to change the name of the type.

So when I'm trying

ignite.destroyCache(cacheName)

And then I'm creating the new cache (with the same name and binary type), I've got an exception while cache populating:

org.apache.ignite.binary.BinaryObjectException: Wrong value has been set [typeName=SomeType, fieldName=f1, fieldType=String, assignedValueType=int]

As I understand from http://apache-ignite-users.70518.x6.nabble.com/Ignite-client-reads-old-metadata-even-after-cache-is-destroyed-and-recreated-td5800.html it's an expected behaviour.

But how can I refresh my binary type matadata whithout creating the new one?

1

1 Answers

3
votes

Yes, this is expected behavior. First of all, marshaller is global in Ignite, as well as the metadata, so destroying the cache does not affect this. Second of all, binary format allows to dynamically change the schema, but the changes have to be compatible. I.e., you can change and/or remove fields, but not change their types, because in this case a client that uses older schema will not be able to deserialize the object if it wants to.