ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Kukushkin (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (IGNITE-5795) @AffinityKeyMapped ignored if QueryEntity used
Date Fri, 04 Aug 2017 15:04:00 GMT

     [ https://issues.apache.org/jira/browse/IGNITE-5795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Alexey Kukushkin resolved IGNITE-5795.
    Resolution: Workaround

I discussed this with [~vozerov] and confirmed we do not want to fix this since any fix would
violate Ignite design ideology. 
To work around the problem in addition to specifying affinity key field using @AffinityKeyMapped
annotation also specify it in the cache key configuration like this:
<property name="cacheConfiguration">
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="keyConfiguration">
<bean class="org.apache.ignite.cache.CacheKeyConfiguration">
<property name="typeName" value="TYPE_NAME"/>
<property name="affinityKeyFieldName" value="AFFINITY_KEY_FIELD_NAME"/>
Resolving this issue with a fix.

> @AffinityKeyMapped ignored if QueryEntity used
> ----------------------------------------------
>                 Key: IGNITE-5795
>                 URL: https://issues.apache.org/jira/browse/IGNITE-5795
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Dmitry Karachentsev
>            Assignee: Alexey Kukushkin
>             Fix For: 2.2
> When cache configured with QueryEntity and used key type with @AffinityKeyMapped field,
it will be ignored and wrong partition calculated. This happens because QueryEntity processing
precedes key type registering in binary meta cache. On that step CacheObjectBinaryProcessorImpl#affinityKeyField
called and unable to resolve type, so null returned and null putted in affKeyFields.
> On next put/get operation CacheObjectBinaryProcessorImpl#affinityKeyField will return
null from affKeyFields, but should be affinity key field.
> Test that reproduces problem in [PR 2330|https://github.com/apache/ignite/pull/2330]
> To wrorkaround the issue, set IgniteConfiguration#setKeyConfiguration(), it will force
registering key.

This message was sent by Atlassian JIRA

View raw message