Search in sources :

Example 1 with IndexCreationException

use of org.apache.atlas.repository.IndexCreationException in project incubator-atlas by apache.

the class GraphBackedSearchIndexer method onAdd.

/**
 * This is upon adding a new type to Store.
 *
 * @param dataTypes data type
 * @throws AtlasException
 */
@Override
public void onAdd(Collection<? extends IDataType> dataTypes) throws AtlasException {
    AtlasGraphManagement management = provider.get().getManagementSystem();
    for (IDataType dataType : dataTypes) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Creating indexes for type name={}, definition={}", dataType.getName(), dataType.getClass());
        }
        try {
            addIndexForType(management, dataType);
            LOG.info("Index creation for type {} complete", dataType.getName());
        } catch (Throwable throwable) {
            LOG.error("Error creating index for type {}", dataType, throwable);
            // Rollback indexes if any failure
            rollback(management);
            throw new IndexCreationException("Error while creating index for type " + dataType, throwable);
        }
    }
    // Commit indexes
    commit(management);
}
Also used : AtlasGraphManagement(org.apache.atlas.repository.graphdb.AtlasGraphManagement) IndexCreationException(org.apache.atlas.repository.IndexCreationException) IDataType(org.apache.atlas.typesystem.types.IDataType)

Aggregations

IndexCreationException (org.apache.atlas.repository.IndexCreationException)1 AtlasGraphManagement (org.apache.atlas.repository.graphdb.AtlasGraphManagement)1 IDataType (org.apache.atlas.typesystem.types.IDataType)1