Hi,

You should always use withKeepBinary if you plan to work with a cache
containing BInaryObject key or value (including queries). The flag is used
internally to prevent deserialization from binary representation to actual
class instance.

So the answers are:

1. yes if you want to load binary objects into a cache.
2. Ignite will try to deserialize.
3. because Ignite has to deserialize key/value on each iteration without
specifying withKeepBinary.
4. internally Ignite stores all data as binary objects and only does
deserialization on demand, like get operation.
5. no, storeKeepBinary property is only related to CacheStore
implementation.

I recommend you to read [1] to learn more about BinaryObjects

[1] https://apacheignite.readme.io/docs/binary-marshaller



2016-07-03 15:17 GMT+03:00 pragmaticbigdata <[email protected]>:

> Ok. The test case worked after I specified "withKeepBinary()" when fetching
> the cache instance before iterating through it.
>
> I have following questions in order to understand to make sure I understand
> the internals of how it works.
>
> 1. Should I specify withKeepBinary() when creating the cache instance for
> loading it?
> 2. I didn't follow the reason why I should specify withKeepBinary() when
> fetching the cache for querying since the original cache instance itself is
> of the type IgniteCache<String, BinaryObject>. Does ignite try to
> deserialize it when I don't specify withKeepBinary()? If so, do you mean
> the
> deserialization of the field & type names (since they are converted to hash
> values) and the values?
> 3. Why does iterating through the cache fail when I don't specify
> withKeepBinary()? Shouldn't iterating through the cache succeed
> irrespective
> of whether the cache is serialized or deserialized? I am specifically
> talking about the case when the cache is of type BinaryObject.
> 4. Does ignite maintain two copies of the cache internally - one serialized
> and another deserialized and return the appropriate one based on the
> withKeepBinary flag?
> 5. If I specify config.setStoreKeepBinary(true); at the time of cache
> creation I would not have to specify withKeepBinary() every time I retrieve
> the cache instance. Is my understanding right?
>
>
> Thanks!
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Iterating-through-a-BinaryObject-cache-fails-tp6038p6061.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 

Best regards,
Alexei Scherbakov

Reply via email to