Search in sources :

Example 91 with TableNotFoundException

use of org.apache.accumulo.core.client.TableNotFoundException in project incubator-rya by apache.

the class EntityLocalityGroupSetter method setLocalityGroups.

public void setLocalityGroups() {
    HashMap<String, Set<Text>> localityGroups = new HashMap<String, Set<Text>>();
    Iterator<String> groups = getPredicates();
    int i = 1;
    while (groups.hasNext()) {
        HashSet<Text> tempColumn = new HashSet<Text>();
        String temp = groups.next();
        tempColumn.add(new Text(temp));
        String groupName = "predicate" + i;
        localityGroups.put(groupName, tempColumn);
        i++;
    }
    try {
        conn.tableOperations().setLocalityGroups(tablePrefix + "doc_partitioned_index", localityGroups);
    // conn.tableOperations().compact(tablePrefix + "doc_partitioned_index", null, null, true, true);
    } catch (AccumuloException e) {
        e.printStackTrace();
    } catch (AccumuloSecurityException e) {
        e.printStackTrace();
    } catch (TableNotFoundException e) {
        e.printStackTrace();
    }
}
Also used : AccumuloException(org.apache.accumulo.core.client.AccumuloException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) Text(org.apache.hadoop.io.Text) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) HashSet(java.util.HashSet)

Example 92 with TableNotFoundException

use of org.apache.accumulo.core.client.TableNotFoundException in project incubator-rya by apache.

the class EntityOptimizerTest method init.

@Before
public void init() throws RepositoryException, TupleQueryResultHandlerException, QueryEvaluationException, MalformedQueryException, AccumuloException, AccumuloSecurityException, TableExistsException {
    accCon = new MockInstance("instance").getConnector("root", "".getBytes());
    config = new BatchWriterConfig();
    config.setMaxMemory(1000);
    config.setMaxLatency(1000, TimeUnit.SECONDS);
    config.setMaxWriteThreads(10);
    if (accCon.tableOperations().exists("rya_prospects")) {
        try {
            accCon.tableOperations().delete("rya_prospects");
        } catch (TableNotFoundException e) {
            e.printStackTrace();
        }
    }
    if (accCon.tableOperations().exists("rya_selectivity")) {
        try {
            accCon.tableOperations().delete("rya_selectivity");
        } catch (TableNotFoundException e) {
            e.printStackTrace();
        }
    }
    accCon.tableOperations().create("rya_prospects");
    accCon.tableOperations().create("rya_selectivity");
    Configuration con = new Configuration();
    con.set(ConfigUtils.CLOUDBASE_AUTHS, "U");
    con.set(ConfigUtils.CLOUDBASE_INSTANCE, "instance");
    con.set(ConfigUtils.CLOUDBASE_USER, "root");
    con.set(ConfigUtils.CLOUDBASE_PASSWORD, "");
    conf = new AccumuloRdfConfiguration(con);
    TablePrefixLayoutStrategy tps = new TablePrefixLayoutStrategy("rya_");
    conf.setTableLayoutStrategy(tps);
    conf.set(ConfigUtils.USE_MOCK_INSTANCE, "true");
    res = new ProspectorServiceEvalStatsDAO(accCon, conf);
}
Also used : TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) Configuration(org.apache.hadoop.conf.Configuration) RdfCloudTripleStoreConfiguration(org.apache.rya.api.RdfCloudTripleStoreConfiguration) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) MockInstance(org.apache.accumulo.core.client.mock.MockInstance) TablePrefixLayoutStrategy(org.apache.rya.api.layout.TablePrefixLayoutStrategy) ProspectorServiceEvalStatsDAO(org.apache.rya.prospector.service.ProspectorServiceEvalStatsDAO) BatchWriterConfig(org.apache.accumulo.core.client.BatchWriterConfig) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) Before(org.junit.Before)

Example 93 with TableNotFoundException

use of org.apache.accumulo.core.client.TableNotFoundException in project incubator-rya by apache.

the class AccumuloUninstall method uninstall.

@Override
public void uninstall(final String ryaInstanceName) throws InstanceDoesNotExistException, RyaClientException {
    requireNonNull(ryaInstanceName);
    // Ensure the Rya Instance exists.
    if (!instanceExists.exists(ryaInstanceName)) {
        throw new InstanceDoesNotExistException(String.format("There is no Rya instance named '%s'.", ryaInstanceName));
    }
    try {
        // Build the list of tables that are present within the Rya instance.
        final List<String> tables = new RyaTableNames().getTableNames(ryaInstanceName, getConnector());
        // Delete them.
        final TableOperations tableOps = getConnector().tableOperations();
        for (final String table : tables) {
            try {
                tableOps.delete(table);
            } catch (final TableNotFoundException e) {
                log.warn("Uninstall could not delete table named '" + LogUtils.clean(table) + "' because it does not exist. " + "Something else is also deleting tables.");
            }
        }
    } catch (PCJStorageException | RyaDetailsRepositoryException e) {
        throw new RyaClientException("Could not uninstall the Rya instance named '" + ryaInstanceName + "' because we could not determine which tables are associated with it.", e);
    } catch (AccumuloException | AccumuloSecurityException e) {
        throw new RyaClientException("Could not uninstall the Rya instance named '" + ryaInstanceName + "' because of a problem interacting with Accumulo..", e);
    }
}
Also used : AccumuloException(org.apache.accumulo.core.client.AccumuloException) RyaClientException(org.apache.rya.api.client.RyaClientException) InstanceDoesNotExistException(org.apache.rya.api.client.InstanceDoesNotExistException) RyaTableNames(org.apache.rya.accumulo.utils.RyaTableNames) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) TableOperations(org.apache.accumulo.core.client.admin.TableOperations) RyaDetailsRepositoryException(org.apache.rya.api.instance.RyaDetailsRepository.RyaDetailsRepositoryException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) PCJStorageException(org.apache.rya.indexing.pcj.storage.PrecomputedJoinStorage.PCJStorageException)

Example 94 with TableNotFoundException

use of org.apache.accumulo.core.client.TableNotFoundException in project incubator-rya by apache.

the class EntityCentricIndex method setConf.

// initialization occurs in setConf because index is created using reflection
@Override
public void setConf(final Configuration conf) {
    if (conf instanceof AccumuloRdfConfiguration) {
        this.conf = (AccumuloRdfConfiguration) conf;
    } else {
        this.conf = new AccumuloRdfConfiguration(conf);
    }
    if (!isInit) {
        try {
            initInternal();
            isInit = true;
        } catch (final AccumuloException e) {
            logger.warn("Unable to initialize index.  Throwing Runtime Exception. ", e);
            throw new RuntimeException(e);
        } catch (final AccumuloSecurityException e) {
            logger.warn("Unable to initialize index.  Throwing Runtime Exception. ", e);
            throw new RuntimeException(e);
        } catch (final TableNotFoundException e) {
            logger.warn("Unable to initialize index.  Throwing Runtime Exception. ", e);
            throw new RuntimeException(e);
        } catch (final TableExistsException e) {
            logger.warn("Unable to initialize index.  Throwing Runtime Exception. ", e);
            throw new RuntimeException(e);
        } catch (final IOException e) {
            logger.warn("Unable to initialize index.  Throwing Runtime Exception. ", e);
            throw new RuntimeException(e);
        }
    }
}
Also used : AccumuloException(org.apache.accumulo.core.client.AccumuloException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) TableExistsException(org.apache.accumulo.core.client.TableExistsException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) IOException(java.io.IOException) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration)

Example 95 with TableNotFoundException

use of org.apache.accumulo.core.client.TableNotFoundException in project incubator-rya by apache.

the class StarQuery method getMinCardSp.

public CardinalityStatementPattern getMinCardSp(final AccumuloSelectivityEvalDAO ase) {
    StatementPattern minSp = null;
    double cardinality = Double.MAX_VALUE;
    double tempCard = -1;
    for (final StatementPattern sp : nodes) {
        try {
            tempCard = ase.getCardinality(ase.getConf(), sp);
            if (tempCard < cardinality) {
                cardinality = tempCard;
                minSp = sp;
            }
        } catch (final TableNotFoundException e) {
            e.printStackTrace();
        }
    }
    return new CardinalityStatementPattern(minSp, cardinality);
}
Also used : StatementPattern(org.openrdf.query.algebra.StatementPattern) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException)

Aggregations

TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)160 AccumuloException (org.apache.accumulo.core.client.AccumuloException)100 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)89 Text (org.apache.hadoop.io.Text)51 Value (org.apache.accumulo.core.data.Value)46 Key (org.apache.accumulo.core.data.Key)42 Scanner (org.apache.accumulo.core.client.Scanner)36 IOException (java.io.IOException)34 BatchWriter (org.apache.accumulo.core.client.BatchWriter)31 BatchWriterConfig (org.apache.accumulo.core.client.BatchWriterConfig)31 Connector (org.apache.accumulo.core.client.Connector)30 Mutation (org.apache.accumulo.core.data.Mutation)29 Range (org.apache.accumulo.core.data.Range)28 Authorizations (org.apache.accumulo.core.security.Authorizations)26 ArrayList (java.util.ArrayList)25 Entry (java.util.Map.Entry)25 TableExistsException (org.apache.accumulo.core.client.TableExistsException)25 IteratorSetting (org.apache.accumulo.core.client.IteratorSetting)23 MutationsRejectedException (org.apache.accumulo.core.client.MutationsRejectedException)23 HashMap (java.util.HashMap)19