[
https://issues.apache.org/jira/browse/IGNITE-12625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aleksey Plekhanov updated IGNITE-12625:
---------------------------------------
Description:
For each thin client cache operation marshaling/unmarshaling of objects
performed twice. For example, cache "put" operation marshal object on the
client-side, then unmarshal object (with keep binaries) on the server-side and
marshal it again before putting it to the cache. It causes some undesirable
effects. For example, references to the same binary object in a collection (
{{new ArrayList(Arrays.asList(person, person))}} ) deserialized as different
objects.
Reproducer:
{code:java}
try (IgniteClient client = startClient()) {
ClientCache<Integer, Object[]> cache =
client.getOrCreateCache(DEFAULT_CACHE_NAME);
Person person = new Person(0, "name");
cache.put(0, new Object[] {person, person} );
Object[] res = cache.get(0);
assertTrue(res[0] == res[1]);
}{code}
To avoid double marshalling we could pass byte array from request content to
cache directly (for example using {{CacheObject}}), but we don't have object
size in thin client protocol, so in any case, we need to traverse the objects.
Also, we don't have the ability to get {{CacheObject}} from the cache now, so
such an approach will only work in one way, for "put" operations, but not for
"get" operations.
was:
For each thin client cache operation marshaling/unmarshaling of objects
performed twice. For example, cache "put" operation marshal object on the
client-side, then unmarshal object (with keep binaries) on the server-side and
marshal it again before putting it to the cache. It causes some undesirable
effects. For example, references to the same binary object in a collection (
{{new ArrayList(Arrays.asList(person, person))}} ) deserialized as different
objects. Also, with binary object full byte array of this object is marshaled,
but object takes only some part of this array, it causes size overhead for
storing these objects.
To avoid double marshalling we could pass byte array from request content to
cache directly (for example using {{CacheObject}}), but we don't have object
size in thin client protocol, so in any case, we need to traverse the objects.
Also, we don't have the ability to get {{CacheObject}} from the cache now, so
such an approach will only work in one way, for "put" operations, but not for
"get" operations.
> Thin client: Marshaling/unmarshaling of objects performed twice
> ---------------------------------------------------------------
>
> Key: IGNITE-12625
> URL: https://issues.apache.org/jira/browse/IGNITE-12625
> Project: Ignite
> Issue Type: Bug
> Components: binary, thin client
> Reporter: Aleksey Plekhanov
> Assignee: Aleksey Plekhanov
> Priority: Major
>
> For each thin client cache operation marshaling/unmarshaling of objects
> performed twice. For example, cache "put" operation marshal object on the
> client-side, then unmarshal object (with keep binaries) on the server-side
> and marshal it again before putting it to the cache. It causes some
> undesirable effects. For example, references to the same binary object in a
> collection ( {{new ArrayList(Arrays.asList(person, person))}} ) deserialized
> as different objects.
> Reproducer:
> {code:java}
> try (IgniteClient client = startClient()) {
> ClientCache<Integer, Object[]> cache =
> client.getOrCreateCache(DEFAULT_CACHE_NAME);
> Person person = new Person(0, "name");
> cache.put(0, new Object[] {person, person} );
> Object[] res = cache.get(0);
> assertTrue(res[0] == res[1]);
> }{code}
> To avoid double marshalling we could pass byte array from request content to
> cache directly (for example using {{CacheObject}}), but we don't have object
> size in thin client protocol, so in any case, we need to traverse the
> objects. Also, we don't have the ability to get {{CacheObject}} from the
> cache now, so such an approach will only work in one way, for "put"
> operations, but not for "get" operations.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)