-
Type:
Bug
-
Status: Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.1.0
-
Fix Version/s: None
-
Component/s: atlas-core, atlas-intg
-
Labels:None
-
Environment:centos
hi, guys
At these days, When i want to improve the efficiency of atlas create new entity by use the function "createOrUpdate" of AtlasEntityStoreV2, so i find the way to use the index.
1.add the config "atlas.use.index.query.to.find.entity.by.unique.attributes=true" to my atlas-application.properties,
2.add the config "<isIndexable>true</isIndexable>" to the attribute of my ClassType define xml, like this :
//代码占位符 <ClassType> <name>HDFSDir</name> <desc>HDFS directory</desc> <attrs> <attr> <name>contextPath</name> <desc>HDFS directory contextPath</desc> <isOptional>false</isOptional> <isIndexable>true</isIndexable> <typeName>string</typeName> <isUnique>true</isUnique> <cardinality>single</cardinality> <extInfo> <item key="canconfig" value="false"/> </extInfo> </attr> ...
The question is that i find the "canUseIndexQuery" function code of AtlasGraphUtilsV2.java always return false
//代码占位符 private static boolean canUseIndexQuery(AtlasEntityType entityType, String attributeName) { boolean ret = false; if (USE_INDEX_QUERY_TO_FIND_ENTITY_BY_UNIQUE_ATTRIBUTES) { final String typeAndSubTypesQryStr = entityType.getTypeAndAllSubTypesQryStr(); ret = typeAndSubTypesQryStr.length() <= SearchProcessor.MAX_QUERY_STR_LENGTH_TYPES; if (ret) { Set<String> indexSet = AtlasGraphProvider.getGraphInstance().getVertexIndexKeys(); try { ret = indexSet.contains(entityType.getQualifiedAttributeName(attributeName)); } catch (AtlasBaseException ex) { ret = false; } } } return ret; }
The indexSet contains the "HDFSDir.contextPath_superTypeNames" and "HDFSDir.contextPath_typeName"(this is the index Generate by atlas due to the isIndexable config),but the code "entityType.getQualifiedAttributeName(attributeName)" return is "HDFSDir.contextPath", so it's obvious that indexSet is not contains the "HDFSDir.contextPath".
And I also find that the function "createIndexForAttribute" of GraphBackedSearchIndexer.java, the config "isIndexable=true" is to create the CompositeIndexWithTypeAndSuperTypes, and it will not create the CompositeIndex because the parameter createCompositeIndex is false, hard-coded.
So how to really use the index when create entity or I used it in a wrong way?