You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "Williams, Michael" <mi...@transamerica.com> on 2018/02/15 16:16:19 UTC
Affinity Key Annotation
Assume I have 4 integers tagged with @AffinityKeyMapped in different data structures. How does Ignite determine which correspond to affinity pairs? EG, if I wanted two pairs that have a mutual affinity, how would ignite know which to pair, or would all be paired together?
Thanks,
Mike
RE: Affinity Key Annotation
Posted by "Williams, Michael" <mi...@transamerica.com>.
Ah, thanks!
From: Alexey Kukushkin [mailto:kukushkinalexey@gmail.com]
Sent: Friday, February 16, 2018 5:40 AM
To: user@ignite.apache.org
Subject: Re: Affinity Key Annotation
Michael, data colocation work like this:
* Ignite caches have partitions assignments so that primary partitions with same ID are assigned to the same physical location (node).
* When you put/get data to a cache, Ignite maps value of a field annotated with @AffinityKeyMapped to a partition.
* Thus, entries having same value of the @AffinityKeyMapped field go to the same location.
In your example if recordNo and policyNo are equal then the entries will go to the same location.
Re: Affinity Key Annotation
Posted by Alexey Kukushkin <ku...@gmail.com>.
Michael, data colocation work like this:
- Ignite caches have partitions assignments so that primary partitions
with same ID are assigned to the same physical location (node).
- When you put/get data to a cache, Ignite maps value of a field
annotated with @AffinityKeyMapped to a partition.
- Thus, entries having same value of the @AffinityKeyMapped field go to
the same location.
In your example if recordNo and policyNo are equal then the entries will go
to the same location.
RE: Affinity Key Annotation
Posted by "Williams, Michael" <mi...@transamerica.com>.
Imagine, for example, I have four keys:
Public class ThingOneKey
{
@QuerySqlField
@AffinityKeyMapped
int recordNo;
...
}
Public class ThingTwoKey
{
@QuerySqlField
@AffinityKeyMapped
int recordNo;
@QuerySqlField
Date birthday;
...
}
Public class ThingThreeKey
{
@QuerySqlField
@AffinityKeyMapped
int policyNo;
...
}
Public class ThingFourKey
{
@QuerySqlField
@AffinityKeyMapped
int policyNo;
@QuerySqlField
int age;
...
}
I then proceed to create four caches, populated by <ThingOneKey,ThingOne> <ThingTwoKey,ThingTwo> <ThingThreeKey,ThingThree> and <ThingFourKey,ThingFour>.
I want ThingOne and ThingTwo, where recordNos are equal to be collocated.
I also want ThingThree and ThingFour, where policyNos are equal, to be collocated.
If ThingOne has a recordNo that equals a policyNo in ThingThree, will they be collocated based on the above? Is there a way to specify I care about the match of Things One and Two, but not eg Things Three and Two?
Thanks,
Mike
-----Original Message-----
From: vkulichenko [mailto:valentin.kulichenko@gmail.com]
Sent: Thursday, February 15, 2018 4:36 PM
To: user@ignite.apache.org
Subject: Re: Affinity Key Annotation
Mike,
Not sure I understand a question.. Can you show an example of your data model and clarify what kind of collocation strategy you want to achieve?
-Val
--
Sent from: https://urldefense.proofpoint.com/v2/url?u=http-3A__apache-2Dignite-2Dusers.70518.x6.nabble.com_&d=DwICAg&c=9g4MJkl2VjLjS6R4ei18BA&r=ipRRuqPnuP3BWnXGSOR_sLoARpltax56uFYU6n57c3GFvMdyEV-dz2ez2lZZpYl0&m=TzuqN8Q89omqLUglrnJEMreTKXCzR3CG2oveHM9lE5s&s=4TLYKrt3QoPoGXMw3A0x9UDhtyb6mcM6fhUWTya1hAU&e=
Re: Affinity Key Annotation
Posted by vkulichenko <va...@gmail.com>.
Mike,
Not sure I understand a question.. Can you show an example of your data
model and clarify what kind of collocation strategy you want to achieve?
-Val
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/