Search in sources :

Example 1 with IndexException

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);
    }
}
Also used : AtlasGraphManagement(org.apache.atlas.repository.graphdb.AtlasGraphManagement) IndexException(org.apache.atlas.repository.IndexException) AtlasBaseTypeDef(org.apache.atlas.model.typedef.AtlasBaseTypeDef) RepositoryException(org.apache.atlas.repository.RepositoryException)

Example 2 with IndexException

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);
    }
}
Also used : AtlasGraphManagement(org.apache.atlas.repository.graphdb.AtlasGraphManagement) IndexException(org.apache.atlas.repository.IndexException) AtlasBaseTypeDef(org.apache.atlas.model.typedef.AtlasBaseTypeDef) RepositoryException(org.apache.atlas.repository.RepositoryException)

Example 3 with IndexException

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);
    }
}
Also used : IndexException(org.apache.atlas.repository.IndexException) RepositoryException(org.apache.atlas.repository.RepositoryException) AtlasBaseException(org.apache.atlas.exception.AtlasBaseException) IndexException(org.apache.atlas.repository.IndexException) IndexCreationException(org.apache.atlas.repository.IndexCreationException) AtlasException(org.apache.atlas.AtlasException)

Example 4 with IndexException

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);
    }
}
Also used : IndexException(org.apache.atlas.repository.IndexException) RepositoryException(org.apache.atlas.repository.RepositoryException) AtlasBaseException(org.apache.atlas.exception.AtlasBaseException) IndexException(org.apache.atlas.repository.IndexException) AtlasException(org.apache.atlas.AtlasException)

Example 5 with IndexException

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);
    }
}
Also used : IndexException(org.apache.atlas.repository.IndexException) RepositoryException(org.apache.atlas.repository.RepositoryException) AtlasBaseException(org.apache.atlas.exception.AtlasBaseException) IndexException(org.apache.atlas.repository.IndexException) AtlasException(org.apache.atlas.AtlasException)

Aggregations

IndexException (org.apache.atlas.repository.IndexException)6 RepositoryException (org.apache.atlas.repository.RepositoryException)6 AtlasException (org.apache.atlas.AtlasException)4 AtlasBaseException (org.apache.atlas.exception.AtlasBaseException)4 AtlasBaseTypeDef (org.apache.atlas.model.typedef.AtlasBaseTypeDef)2 IndexCreationException (org.apache.atlas.repository.IndexCreationException)2 AtlasGraphManagement (org.apache.atlas.repository.graphdb.AtlasGraphManagement)2