use of org.apache.atlas.repository.IndexException in project atlas by apache.
the class GraphBackedSearchIndexer method onChange.
@Override
public void onChange(ChangedTypeDefs changedTypeDefs) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("Processing changed typedefs {}", changedTypeDefs);
}
AtlasGraphManagement management = null;
try {
management = provider.get().getManagementSystem();
// Update index for newly created types
if (CollectionUtils.isNotEmpty(changedTypeDefs.getCreateTypeDefs())) {
for (AtlasBaseTypeDef typeDef : changedTypeDefs.getCreateTypeDefs()) {
updateIndexForTypeDef(management, typeDef);
}
}
// Update index for updated types
if (CollectionUtils.isNotEmpty(changedTypeDefs.getUpdatedTypeDefs())) {
for (AtlasBaseTypeDef typeDef : changedTypeDefs.getUpdatedTypeDefs()) {
updateIndexForTypeDef(management, typeDef);
}
}
// Invalidate the property key for deleted types
if (CollectionUtils.isNotEmpty(changedTypeDefs.getDeletedTypeDefs())) {
for (AtlasBaseTypeDef typeDef : changedTypeDefs.getDeletedTypeDefs()) {
cleanupIndices(management, typeDef);
}
}
// Commit indexes
commit(management);
} catch (RepositoryException | IndexException e) {
LOG.error("Failed to update indexes for changed typedefs", e);
attemptRollback(changedTypeDefs, management);
}
}
use of org.apache.atlas.repository.IndexException in project incubator-atlas by apache.
the class GraphBackedSearchIndexer method onChange.
@Override
public void onChange(ChangedTypeDefs changedTypeDefs) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("Processing changed typedefs {}", changedTypeDefs);
}
AtlasGraphManagement management = null;
try {
management = provider.get().getManagementSystem();
// Update index for newly created types
if (CollectionUtils.isNotEmpty(changedTypeDefs.getCreateTypeDefs())) {
for (AtlasBaseTypeDef typeDef : changedTypeDefs.getCreateTypeDefs()) {
updateIndexForTypeDef(management, typeDef);
}
}
// Update index for updated types
if (CollectionUtils.isNotEmpty(changedTypeDefs.getUpdatedTypeDefs())) {
for (AtlasBaseTypeDef typeDef : changedTypeDefs.getUpdatedTypeDefs()) {
updateIndexForTypeDef(management, typeDef);
}
}
// Invalidate the property key for deleted types
if (CollectionUtils.isNotEmpty(changedTypeDefs.getDeletedTypeDefs())) {
for (AtlasBaseTypeDef typeDef : changedTypeDefs.getDeletedTypeDefs()) {
cleanupIndices(management, typeDef);
}
}
// Commit indexes
commit(management);
} catch (RepositoryException | IndexException e) {
LOG.error("Failed to update indexes for changed typedefs", e);
attemptRollback(changedTypeDefs, management);
}
}
use of org.apache.atlas.repository.IndexException in project incubator-atlas by apache.
the class GraphBackedSearchIndexer method commit.
private void commit(AtlasGraphManagement management) throws IndexException {
try {
management.commit();
recomputeIndexedKeys = true;
} catch (Exception e) {
LOG.error("Index commit failed", e);
throw new IndexException("Index commit failed ", e);
}
}
use of org.apache.atlas.repository.IndexException in project atlas by apache.
the class GraphBackedSearchIndexer method commit.
private void commit(AtlasGraphManagement management) throws IndexException {
try {
management.commit();
recomputeIndexedKeys = true;
} catch (Exception e) {
LOG.error("Index commit failed", e);
throw new IndexException("Index commit failed ", e);
}
}
use of org.apache.atlas.repository.IndexException in project atlas by apache.
the class GraphBackedSearchIndexer method rollback.
private void rollback(AtlasGraphManagement management) throws IndexException {
try {
management.rollback();
recomputeIndexedKeys = true;
} catch (Exception e) {
LOG.error("Index rollback failed ", e);
throw new IndexException("Index rollback failed ", e);
}
}
Aggregations