This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push:
new 36459c7 ATLAS-3338: avoid repeated calls to get index-field name
during startup
36459c7 is described below
commit 36459c7829c02d92a2af76bc1ea7de31e34bbd67
Author: Madhan Neethiraj <[email protected]>
AuthorDate: Tue Jul 16 23:43:50 2019 -0700
ATLAS-3338: avoid repeated calls to get index-field name during startup
---
.../repository/graph/GraphBackedSearchIndexer.java | 31 +++++++++++++---------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git
a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
index 95ae504..c37b381 100755
---
a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
+++
b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
@@ -379,25 +379,30 @@ public class GraphBackedSearchIndexer implements
SearchIndexer, ActiveStateChang
private void resolveIndexFieldNames(AtlasGraphManagement managementSystem,
AtlasEntityType entityType) {
for(AtlasAttribute attribute: entityType.getAllAttributes().values()) {
- if(needsIndexFieldNameResolution(attribute)) {
- resolveIndexFieldName(managementSystem, attribute);
- }
+ resolveIndexFieldName(managementSystem, attribute);
}
}
- private void resolveIndexFieldName(AtlasGraphManagement managementSystem,
- AtlasAttribute attribute) {
- AtlasPropertyKey propertyKey =
managementSystem.getPropertyKey(attribute.getQualifiedName());
- String indexFieldName =
managementSystem.getIndexFieldName(Constants.VERTEX_INDEX, propertyKey);
+ private void resolveIndexFieldName(AtlasGraphManagement managementSystem,
AtlasAttribute attribute) {
+ if (attribute.getIndexFieldName() == null &&
TypeCategory.PRIMITIVE.equals(attribute.getAttributeType().getTypeCategory())) {
+ AtlasStructType definedInType = attribute.getDefinedInType();
+ AtlasAttribute baseInstance = definedInType != null ?
definedInType.getAttribute(attribute.getName()) : null;
- attribute.setIndexFieldName(indexFieldName);
+ if (baseInstance != null && baseInstance.getIndexFieldName() !=
null) {
+ attribute.setIndexFieldName(baseInstance.getIndexFieldName());
+ } else {
+ AtlasPropertyKey propertyKey =
managementSystem.getPropertyKey(attribute.getVertexPropertyName());
+ String indexFieldName =
managementSystem.getIndexFieldName(Constants.VERTEX_INDEX, propertyKey);
- LOG.info("Property {} is mapped to index field name {}",
attribute.getQualifiedName(), attribute.getIndexFieldName());
- }
+ attribute.setIndexFieldName(indexFieldName);
- private boolean needsIndexFieldNameResolution(AtlasAttribute attribute) {
- return attribute.getIndexFieldName() == null &&
-
TypeCategory.PRIMITIVE.equals(attribute.getAttributeType().getTypeCategory());
+ if (baseInstance != null) {
+ baseInstance.setIndexFieldName(indexFieldName);
+ }
+
+ LOG.info("Property {} is mapped to index field name {}",
attribute.getQualifiedName(), attribute.getIndexFieldName());
+ }
+ }
}
private void createCommonVertexIndex(AtlasGraphManagement management,