[
https://issues.apache.org/jira/browse/IGNITE-5188?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vladimir Ozerov updated IGNITE-5188:
------------------------------------
Description:
We need to be able to specify affinity key for cache created through {{CREATE
TABLE}} command to support data co-location properly. It seems that correct way
to support this is as follows:
1) We need to define special SQL affinity mapper which will accept type name
and field name.
2) Mapper logic: if type name matches, then get affinity field. Otherwise
return the whole object.
3) Performance consideration: we should avoid string comparisons. Instead, we
should resolve type name to type ID on first access, and then compare only IDs.
4) We should fix on how we obtain affinity key for type descriptor in
{{QueryUtils.typeForQueryEntity}} - we should try consulting to special SQL
mapper first, if it is defined.
5) Last (hopefully), we should make sure that affinity routing is not broken.
See {{GridH2Table.ctor}} - here we should rely on existing affinity column from
SQL mapper if one is defined.
> Support AFFINITY KEY keyword for CREATE TABLE command
> -----------------------------------------------------
>
> Key: IGNITE-5188
> URL: https://issues.apache.org/jira/browse/IGNITE-5188
> Project: Ignite
> Issue Type: Task
> Components: sql
> Reporter: Vladimir Ozerov
> Assignee: Alexander Paschenko
> Fix For: 2.1
>
>
> We need to be able to specify affinity key for cache created through {{CREATE
> TABLE}} command to support data co-location properly. It seems that correct
> way to support this is as follows:
> 1) We need to define special SQL affinity mapper which will accept type name
> and field name.
> 2) Mapper logic: if type name matches, then get affinity field. Otherwise
> return the whole object.
> 3) Performance consideration: we should avoid string comparisons. Instead, we
> should resolve type name to type ID on first access, and then compare only
> IDs.
> 4) We should fix on how we obtain affinity key for type descriptor in
> {{QueryUtils.typeForQueryEntity}} - we should try consulting to special SQL
> mapper first, if it is defined.
> 5) Last (hopefully), we should make sure that affinity routing is not broken.
> See {{GridH2Table.ctor}} - here we should rely on existing affinity column
> from SQL mapper if one is defined.
>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)