Commit 8663eb1d by Ashutosh Mestry Committed by Madhan Neethiraj

ATLAS-2195: fix to close trasaction left open while queries index keys (#2)

parent 59f83fc0
......@@ -261,23 +261,33 @@ public class GraphBackedSearchIndexer implements SearchIndexer, ActiveStateChang
try {
management = provider.get().getManagementSystem();
} catch (RepositoryException excp) {
LOG.error("failed to get indexedKeys from graph", excp);
}
if (management != null) {
AtlasGraphIndex vertexIndex = management.getGraphIndex(Constants.VERTEX_INDEX);
if (management != null) {
AtlasGraphIndex vertexIndex = management.getGraphIndex(Constants.VERTEX_INDEX);
if (vertexIndex != null) {
recomputeIndexedKeys = false;
if (vertexIndex != null) {
recomputeIndexedKeys = false;
Set<String> indexKeys = new HashSet<>();
Set<String> indexKeys = new HashSet<>();
for (AtlasPropertyKey fieldKey : vertexIndex.getFieldKeys()) {
indexKeys.add(fieldKey.getName());
}
for (AtlasPropertyKey fieldKey : vertexIndex.getFieldKeys()) {
indexKeys.add(fieldKey.getName());
vertexIndexKeys = indexKeys;
}
vertexIndexKeys = indexKeys;
management.commit();
}
} catch (Exception excp) {
LOG.error("getVertexIndexKeys(): failed to get indexedKeys from graph", excp);
if (management != null) {
try {
management.rollback();
} catch (Exception e) {
LOG.error("getVertexIndexKeys(): rollback failed", e);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment