Dmitriy, >> How about we check that dashcode is not 0 when storing portable keys in cache?
And print warning in log? Sounds good for me. ----- But I will try to describe once again my concern. I'm don't know anything about portables. So, I open javadoc and see some idiomatic code like this: builder = ... for ( fileds) { builder.setField(..) } portable = builder.build(); And I in my PojoStore I do as described. If there was a NOTE in javadoc about hashCode() it will save 4 hours of debug for me :) On Wed, Oct 28, 2015 at 11:32 AM, Dmitriy Setrakyan <dsetrak...@apache.org> wrote: > How about we check that dashcode is not 0 when storing portable keys in > cache? > > On Tue, Oct 27, 2015 at 8:42 PM, Alexey Kuznetsov <akuznet...@gridgain.com > > > wrote: > > > Andrey, thanks. > > > > Actually I use this not well documented method to solve my problem. > > > > And I'm proposed to at least add more info for PortableBuilder about this > > method. > > > > On Wed, Oct 28, 2015 at 10:19 AM, Andrey Kornev < > andrewkor...@hotmail.com> > > wrote: > > > > > Alexey, > > > > > > PortableBuilder has an (un-documented) method hashCode(int hashCode) > that > > > should be used to explicitly set the hashCode for the portable instance > > > being built. I'm not sure why this has been designed this way, but I'm > > > guessing that since the PortableBuilder is pretty dumb and it wouldn't > > know > > > which fields to use for hash code computation (in some cases you'd only > > > want to include specific portable fields rather than all fields). > > > > > > Regards > > > Andrey > > > > > > > Date: Wed, 28 Oct 2015 09:49:07 +0700 > > > > Subject: Portables hash code. > > > > From: akuznet...@gridgain.com > > > > To: dev@ignite.apache.org > > > > > > > > Igniters, > > > > > > > > I'm working on [1] "IGNITE-1753 Rework CacheJdbcPojoStore to new > API." > > > > > > > > And one of subtasks is to support portable objects with JDBC store. > > > > > > > > I implemented this and during tests found a huge performance drop > when > > I > > > > have PortableObject as key. > > > > > > > > After some debugging I found that all my portable objects have > hashCode > > > = 0. > > > > I'm using PortableBuilder to build my portable objects. > > > > > > > > And I expected that PortableBuilder will calculate proper hash code > for > > > me > > > > out of the box. > > > > > > > > I think we should at least describe in PortableBuilder javadocs that > by > > > > default PortableBuilder will return zero hashcode? > > > > > > > > Or we should calculate hashcode in PortableBuilder.build() method? > > > > > > > > Or may be we could add boolean argument PortableBuilder.build(boolean > > > > generateHashCode)? > > > > > > > > Thoughts? > > > > > > > > P.S. After I added manual hashcode calculation to my > CacheJdbcPojoStore > > > > performance drop is gone away. > > > > > > > > > > > > [1] https://issues.apache.org/jira/browse/IGNITE-1753 > > > > -- > > > > Alexey Kuznetsov > > > > GridGain Systems > > > > www.gridgain.com > > > > > > > > > > > > > > -- > > Alexey Kuznetsov > > GridGain Systems > > www.gridgain.com > > > -- Alexey Kuznetsov GridGain Systems www.gridgain.com