Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EFC75200C24 for ; Wed, 8 Feb 2017 18:51:38 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id ED645160B5A; Wed, 8 Feb 2017 17:51:38 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 242D2160B49 for ; Wed, 8 Feb 2017 18:51:37 +0100 (CET) Received: (qmail 87828 invoked by uid 500); 8 Feb 2017 17:51:37 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 87815 invoked by uid 99); 8 Feb 2017 17:51:37 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2017 17:51:37 +0000 Received: from [192.168.75.113] (c-73-222-138-29.hsd1.ca.comcast.net [73.222.138.29]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id DB0A41A002B; Wed, 8 Feb 2017 17:51:36 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: IGNITE-3244 From: Denis Magda In-Reply-To: Date: Wed, 8 Feb 2017 09:51:35 -0800 Cc: Valentin Kulichenko , Vladimir Ozerov Content-Transfer-Encoding: quoted-printable Message-Id: <62C391EA-931B-412C-9845-49C20C0CE08C@apache.org> References: <67BB3D30-4B36-410F-BD02-3C0A261E98A3@apache.org> To: dev@ignite.apache.org X-Mailer: Apple Mail (2.3259) archived-at: Wed, 08 Feb 2017 17:51:39 -0000 Hi Aleksey, >> type IDs correctly attached to class descriptors. The issue comes = from >> BinaryUtils#doReadObjectArray() . Presently, unmarshalled array's = elements >> stored in Object[], one need to write the following : >> Object[] arr =3D (Object[])Array.newInstance(compType, len); >> instead of >> Object[] arr =3D deserialize ? (Object[])Array.newInstance(compType, = len) This is for occasions when an array needs to be returned in NON = deserialized form meaning that its elements still will be of binary = type. When =E2=80=9Cdeserialize=E2=80=9D flag is set to =E2=80=9Ctrue=E2=80= =9D the elements will be fully deserialized. I think that we should = properly set =E2=80=9Cdeserialize=E2=80=9D or =E2=80=9CkeepBinary=E2=80=9D= flag somewhere. Vovan, could join the conversation and share your thoughts? >> Moreover, in CacheObjectBinaryProcessorImpl#marshalToBinary() we >> explicitly marshal objects array into Object[] and then write it = further. I >> wonder why we dont just marshal -> unmarshal it ? This kind of legacy code that was there for a while. I can=E2=80=99t = recall the reason why we have it but I=E2=80=99m sure there is a sense = for that. Val, Vovan, do you remember? =E2=80=94 Denis > On Feb 7, 2017, at 5:05 AM, ALEKSEY KUZNETSOV = wrote: >=20 > I have a solution on this task, this is pull request into my forked > repository : https://github.com/voipp/ignite/pull/6 >=20 > =D0=BF=D0=BD, 6 =D1=84=D0=B5=D0=B2=D1=80. 2017 =D0=B3. =D0=B2 16:03, = ALEKSEY KUZNETSOV : >=20 >> Moreover, in CacheObjectBinaryProcessorImpl#marshalToBinary() we >> explicitly marshal objects array into Object[] and then write it = further. I >> wonder why we dont just marshal -> unmarshal it ? >>=20 >> =D0=BF=D0=BD, 6 =D1=84=D0=B5=D0=B2=D1=80. 2017 =D0=B3. =D0=B2 15:58, = ALEKSEY KUZNETSOV : >>=20 >> type IDs correctly attached to class descriptors. The issue comes = from >> BinaryUtils#doReadObjectArray() . Presently, unmarshalled array's = elements >> stored in Object[], one need to write the following : >> Object[] arr =3D (Object[])Array.newInstance(compType, len); >> instead of >> Object[] arr =3D deserialize ? (Object[])Array.newInstance(compType, = len) >>=20 >> =D0=BF=D0=BD, 6 =D1=84=D0=B5=D0=B2=D1=80. 2017 =D0=B3. =D0=B2 11:16, = Vladimir Ozerov : >>=20 >> Denis, >>=20 >> We need to ensure that type IDs are attached for both arrays and >> collections/maps. May be we have it for arrays already, but I doubt = it is >> so for generic containers. >>=20 >> On Fri, Feb 3, 2017 at 8:59 PM, Denis Magda = wrote: >>=20 >>> If a value can be serialized to BinaryObject then it will be = serialized. >>> This piece of the code works perfectly well as far as I understand. >>>=20 >>> I would agree with Vladimir that the binary protocol needs to be >> revisited >>> or the way we serialize/deserialize arrays. Presently, when an array = of >> any >>> type is serialized with BinaryWriterExImpl.doWriteObjectArray we = write >>> that this is the array >>>=20 >>> out.unsafeWriteByte(GridBinaryMarshaller.OBJ_ARR); >>> and right below we store the actual type >>>=20 >>> out.unsafeWriteInt(desc.typeId()) >>>=20 >>> In my understanding, in the layout of binary data we have all the = data >>> needed to deserialize an array back properly. >>>=20 >>> Vovan, is there anything we are missing? >>>=20 >>> =E2=80=94 >>> Denis >>>=20 >>>> On Feb 3, 2017, at 7:09 AM, ALEKSEY KUZNETSOV < >> alkuznetsov.sb@gmail.com> >>> wrote: >>>>=20 >>>> There is javax.cache.integration.CacheWriter#write() method which >> writes >>>> key and value, wrapped in CacheEntryImpl. >>>> In case of class arrays, values must be in form of BinaryObject or >>>> serialized class arrays ? >>>>=20 >>>> =D1=87=D1=82, 2 =D1=84=D0=B5=D0=B2=D1=80. 2017 =D0=B3. =D0=B2 = 19:57, Denis Magda : >>>>=20 >>>>> Yes, this is exactly the reason why this ticket is created. = Presently, >>>>> binary marshaller ignores custom type for arrays. We need to find = a >> way >>> how >>>>> to handle this. >>>>>=20 >>>>> =E2=80=94 >>>>> Denis >>>>>=20 >>>>>> On Feb 2, 2017, at 6:23 AM, ALEKSEY KUZNETSOV < >>> alkuznetsov.sb@gmail.com> >>>>> wrote: >>>>>>=20 >>>>>> I founded that cache.get(i) actually returns an array, containing >>>>>> TestObject. But somehow the type of returned value is Object[] = not >>>>>> TestObject[] >>>>>>=20 >>>>>> =D1=81=D1=80, 1 =D1=84=D0=B5=D0=B2=D1=80. 2017 =D0=B3. =D0=B2 = 22:26, Denis Magda : >>>>>>=20 >>>>>>> Excellent, please share the way you want to fix the issue with = the >>>>>>> community. You might get a valuable feedback before getting down = to >>>>> coding. >>>>>>>=20 >>>>>>> =E2=80=94 >>>>>>> Denis >>>>>>>=20 >>>>>>>> On Feb 1, 2017, at 1:18 AM, ALEKSEY KUZNETSOV < >>>>> alkuznetsov.sb@gmail.com> >>>>>>> wrote: >>>>>>>>=20 >>>>>>>> will take https://issues.apache.org/jira/browse/IGNITE-3244 >>>>>>>> -- >>>>>>>>=20 >>>>>>>> *Best Regards,* >>>>>>>>=20 >>>>>>>> *Kuznetsov Aleksey* >>>>>>>=20 >>>>>>> -- >>>>>>=20 >>>>>> *Best Regards,* >>>>>>=20 >>>>>> *Kuznetsov Aleksey* >>>>>=20 >>>>> -- >>>>=20 >>>> *Best Regards,* >>>>=20 >>>> *Kuznetsov Aleksey* >>>=20 >>>=20 >>=20 >> -- >>=20 >> *Best Regards,* >>=20 >> *Kuznetsov Aleksey* >>=20 >> -- >>=20 >> *Best Regards,* >>=20 >> *Kuznetsov Aleksey* >>=20 > --=20 >=20 > *Best Regards,* >=20 > *Kuznetsov Aleksey*