ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Goncharuk (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IGNITE-3633) Throw an exception when binary object without explicitly set hash code is used as a key
Date Tue, 09 Aug 2016 08:33:20 GMT

    [ https://issues.apache.org/jira/browse/IGNITE-3633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15413197#comment-15413197

Alexey Goncharuk commented on IGNITE-3633:

 * In postWrite, we should determine the flag value based on existing flag value, if possible:
writer.postWrite(userType, registered, obj instanceof CacheObjectImpl ? 0 : obj.hashCode(),

    obj instanceof BinaryObjectEx ? ((BinaryObjectEx)obj).isFlagSet(...) : true);

 * I think FLAG_EMPTY_HASH_CODE should be 0x0040, because 0x0032 = FLAG_COMPACT_FOOTER | FLAG_OFFSET_TWO_BYTES
 * After a second thought, I think we should get rid of object integer in BinaryObjectBuilder,
and use a flag indicating that hashCode was set. HashCode is supposed to be distributed across
the whole Integer range, so boxing this integer will generate unnecessary litter when user
generates keys for cache.
 * Modify the exception message to indicate that binary object was created with BinaryBuilder
and state that user should use BinaryBuilder.hashCode(int) method to set hashCode.

> Throw an exception when binary object without explicitly set hash code is used as a key
> ---------------------------------------------------------------------------------------
>                 Key: IGNITE-3633
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3633
>             Project: Ignite
>          Issue Type: Task
>          Components: binary, cache, SQL
>            Reporter: Alexander Paschenko
>            Assignee: Alexander Paschenko
>             Fix For: 1.8
> New binary built keys erroneously get put to cache as having cache code of 0. We want
to force user to set hash code explicitly by throwing an exception when they do not do so.
> Proposed solution by Denis Magda:
> http://apache-ignite-developers.2346864.n4.nabble.com/All-BinaryObjects-created-by-BinaryObjectBuilder-stored-at-the-same-partition-by-default-td8042i20.html

This message was sent by Atlassian JIRA

View raw message