*Hi,
I have a setup with 20 ignite cache servers (v2.1). I create my cache using
a client, steps are as follows -
1. Client connects to the ignite cluster during startup.
2. During startup, client checks if my cache is already created (cache name
- "Person")
3. If cache is already created, client does nothing. If cache is not already
created, the client creates the cache.*
*My Cache value object looks like this -*
public class Person implements Serializable {
@QuerySqlField(index = true, orderedGroups = {
@QuerySqlField.Group(name = "personGroup", order = 3,
descending = true)
})
@QueryTextField
private String name;
@QuerySqlField(index = true, orderedGroups = {
@QuerySqlField.Group(name = "personGroup", order = 4,
descending = true)
})
private String id;
@QuerySqlField(index = true, orderedGroups = {
@QuerySqlField.Group(name = "personGroup", order = 0,
descending = false)
})
private String country;
@QuerySqlField(index = true, orderedGroups = {
@QuerySqlField.Group(name = "personGroup", order = 2,
descending = false)
})
private String department;
@QuerySqlField(index = true, orderedGroups = {
@QuerySqlField.Group(name = "personGroup", order = 1,
descending = false)
})
private Integer stateCode;
@QuerySqlField
private Integer activityStatus;
}
*As can be seen, I have created a group index - personGroup.
The cache creation code in the client looks as follows -*
if (cacheManager.getCache("PersonCache") == null) {
CacheConfiguration<person_key, Person> cacheConfig = new
CacheConfiguration<>();
cacheConfig.setAtomicityMode(TRANSACTIONAL);
cacheConfig.setCacheMode(PARTITIONED);
cacheConfig.setBackups(1);
cacheConfig.setCopyOnRead(TRUE);
cacheConfig.setPartitionLossPolicy(IGNITE);
cacheConfig.setQueryParallelism(2);
cacheConfig.setReadFromBackup(TRUE);
cacheConfig.setRebalanceBatchSize(524288);
cacheConfig.setRebalanceThrottle(100);
cacheConfig.setIndexedTypes(person_key.class, Person.class);
cacheConfig.setOnheapCacheEnabled(FALSE);
cacheConfig.setStatisticsEnabled(TRUE);
cacheManager.createCache("PersonCache", cacheConfig);
*Now, after creating the cache and adding data to it, I was able to see
cache size and I am able to retrieve data from my cache using the key.
However, my SQL query is not returning any data. Upon checking the cache
metadata, I found that indexes (both individual and group) were not created
correctly. The metadata looks as follows -*
{
"cacheName": "PersonCache",
"types": [
"Person"
],
"keyClasses": {
"person_key": "java.lang.Object"
},
"valClasses": {
"Person": "java.lang.Object"
},
"fields": {
"Person": {
"name": "java.lang.String",
"id": "java.lang.String",
"country": "java.lang.String",
"department": "java.lang.String",
"stateCode": "java.lang.Integer",
"activityStatus": "java.lang.Integer",
}
},
"indexes": {
"Person": [
{
"name": "PERSON_NAME_IDX",
"fields": [
"NAME"
],
"descendings": [],
"unique": false
}
]
}
}
Can someone help me understand why I am not able to retrieve data using SQL
query and why indexes have not been created appropriately?
Thanks!
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/