rishi007bansod
rishi007bansod

Reputation: 1469

Working of Affinity collocation in Apache Ignite

If I have following 3 tables(here numeric values are integer values) and in table_1_key I have affinity collocation on companyId. Then how will affinity collocation happen? will table 1 entries collocate with table 2 entries or table 3 entries(as both tables have columns with integer values ranging from 1 to 10)?

table_1_key --> {male_personId(1-10 numeric value), companyId(1-10 numeric value), age, address} has 100 entries    
table_2_key --> {female_personId(1-10 numeric value), surname, age, address} has 20 entries
table_3_key --> {company_name, companyId(1-10 numeric value)} has 10 entries

In other case if let us say female_personId range changes from 1-10 to 1-5 then how will affinity collocation happen?(in other words does Apache Ignite also considers key ranges while affinity collocation)?

Upvotes: 0

Views: 1215

Answers (1)

Valentin Kulichenko
Valentin Kulichenko

Reputation: 8390

Affinity collocation happens in the way you configure it and by default there is no collocation. Refer to this page for details: https://apacheignite.readme.io/docs/affinity-collocation#collocate-data-with-data

According to your schema, you will most likely collocate by companyId. This means that all persons that belong to a company, will be stored on the same node together with the company object itself.

Key ranges are not affecting affinity in any way. Key is mapped to a node based on the affinity key, regardless of whether it's actually in the cache or not.

Upvotes: 1

Related Questions