Search in sources :

Example 1 with ThriftTableOperationException

use of org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException in project accumulo by apache.

the class TableOperationsImpl method doFateOperation.

String doFateOperation(FateOperation op, List<ByteBuffer> args, Map<String, String> opts, String tableOrNamespaceName, boolean wait) throws AccumuloSecurityException, TableExistsException, TableNotFoundException, AccumuloException, NamespaceExistsException, NamespaceNotFoundException {
    Long opid = null;
    try {
        opid = beginFateOperation();
        executeFateOperation(opid, op, args, opts, !wait);
        if (!wait) {
            opid = null;
            return null;
        }
        return waitForFateOperation(opid);
    } catch (ThriftSecurityException e) {
        switch(e.getCode()) {
            case TABLE_DOESNT_EXIST:
                throw new TableNotFoundException(null, tableOrNamespaceName, "Target table does not exist");
            case NAMESPACE_DOESNT_EXIST:
                throw new NamespaceNotFoundException(null, tableOrNamespaceName, "Target namespace does not exist");
            default:
                String tableInfo = context.getPrintableTableInfoFromName(tableOrNamespaceName);
                throw new AccumuloSecurityException(e.user, e.code, tableInfo, e);
        }
    } catch (ThriftTableOperationException e) {
        switch(e.getType()) {
            case EXISTS:
                throw new TableExistsException(e);
            case NOTFOUND:
                throw new TableNotFoundException(e);
            case NAMESPACE_EXISTS:
                throw new NamespaceExistsException(e);
            case NAMESPACE_NOTFOUND:
                throw new NamespaceNotFoundException(e);
            case OFFLINE:
                throw new TableOfflineException(e.getTableId() == null ? null : TableId.of(e.getTableId()), tableOrNamespaceName);
            case BULK_CONCURRENT_MERGE:
                throw new AccumuloBulkMergeException(e);
            default:
                throw new AccumuloException(e.description, e);
        }
    } catch (Exception e) {
        throw new AccumuloException(e.getMessage(), e);
    } finally {
        context.clearTableListCache();
        // always finish table op, even when exception
        if (opid != null)
            try {
                finishFateOperation(opid);
            } catch (Exception e) {
                log.warn("Exception thrown while finishing fate table operation", e);
            }
    }
}
Also used : AccumuloException(org.apache.accumulo.core.client.AccumuloException) TableOfflineException(org.apache.accumulo.core.client.TableOfflineException) ThriftSecurityException(org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException) NamespaceExistsException(org.apache.accumulo.core.client.NamespaceExistsException) NamespaceNotFoundException(org.apache.accumulo.core.client.NamespaceNotFoundException) TableOfflineException(org.apache.accumulo.core.client.TableOfflineException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) NamespaceNotFoundException(org.apache.accumulo.core.client.NamespaceNotFoundException) ThriftSecurityException(org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException) TableExistsException(org.apache.accumulo.core.client.TableExistsException) TException(org.apache.thrift.TException) IOException(java.io.IOException) TTransportException(org.apache.thrift.transport.TTransportException) NamespaceExistsException(org.apache.accumulo.core.client.NamespaceExistsException) FileNotFoundException(java.io.FileNotFoundException) ThriftNotActiveServiceException(org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException) NotServingTabletException(org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) TApplicationException(org.apache.thrift.TApplicationException) AccumuloException(org.apache.accumulo.core.client.AccumuloException) ThriftTableOperationException(org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) TableExistsException(org.apache.accumulo.core.client.TableExistsException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) ThriftTableOperationException(org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException)

Example 2 with ThriftTableOperationException

use of org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException in project accumulo by apache.

the class ManagerClient method executeGeneric.

public static void executeGeneric(ClientContext context, ClientExec<ManagerClientService.Client> exec) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
    ManagerClientService.Client client = null;
    while (true) {
        try {
            client = getConnectionWithRetry(context);
            exec.execute(client);
            break;
        } catch (TTransportException tte) {
            log.debug("ManagerClient request failed, retrying ... ", tte);
            sleepUninterruptibly(100, MILLISECONDS);
        } catch (ThriftSecurityException e) {
            throw new AccumuloSecurityException(e.user, e.code, e);
        } catch (AccumuloException e) {
            throw e;
        } catch (ThriftTableOperationException e) {
            switch(e.getType()) {
                case NAMESPACE_NOTFOUND:
                    throw new TableNotFoundException(e.getTableName(), new NamespaceNotFoundException(e));
                case NOTFOUND:
                    throw new TableNotFoundException(e);
                default:
                    throw new AccumuloException(e);
            }
        } catch (ThriftNotActiveServiceException e) {
            // Let it loop, fetching a new location
            log.debug("Contacted a Manager which is no longer active, re-creating" + " the connection to the active Manager");
        } catch (Exception e) {
            throw new AccumuloException(e);
        } finally {
            if (client != null)
                close(client, context);
        }
    }
}
Also used : ManagerClientService(org.apache.accumulo.core.manager.thrift.ManagerClientService) AccumuloException(org.apache.accumulo.core.client.AccumuloException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) ThriftNotActiveServiceException(org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException) TTransportException(org.apache.thrift.transport.TTransportException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) ThriftTableOperationException(org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException) ThriftSecurityException(org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException) NamespaceNotFoundException(org.apache.accumulo.core.client.NamespaceNotFoundException) TTransportException(org.apache.thrift.transport.TTransportException) ThriftSecurityException(org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException) UnknownHostException(java.net.UnknownHostException) AccumuloException(org.apache.accumulo.core.client.AccumuloException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) ThriftTableOperationException(org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException) NamespaceNotFoundException(org.apache.accumulo.core.client.NamespaceNotFoundException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) ThriftNotActiveServiceException(org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException)

Example 3 with ThriftTableOperationException

use of org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException in project accumulo by apache.

the class NamespaceOperationsImpl method testClassLoad.

@Override
public boolean testClassLoad(final String namespace, final String className, final String asTypeName) throws NamespaceNotFoundException, AccumuloException, AccumuloSecurityException {
    EXISTING_NAMESPACE_NAME.validate(namespace);
    checkArgument(className != null, "className is null");
    checkArgument(asTypeName != null, "asTypeName is null");
    try {
        return ServerClient.executeRaw(context, client -> client.checkNamespaceClass(TraceUtil.traceInfo(), context.rpcCreds(), namespace, className, asTypeName));
    } catch (ThriftTableOperationException e) {
        switch(e.getType()) {
            case NAMESPACE_NOTFOUND:
                throw new NamespaceNotFoundException(e);
            default:
                throw new AccumuloException(e.description, e);
        }
    } catch (ThriftSecurityException e) {
        throw new AccumuloSecurityException(e.user, e.code, e);
    } catch (AccumuloException e) {
        throw e;
    } catch (Exception e) {
        throw new AccumuloException(e);
    }
}
Also used : AccumuloException(org.apache.accumulo.core.client.AccumuloException) ThriftTableOperationException(org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) ThriftSecurityException(org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException) NamespaceNotFoundException(org.apache.accumulo.core.client.NamespaceNotFoundException) TableExistsException(org.apache.accumulo.core.client.TableExistsException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) NamespaceExistsException(org.apache.accumulo.core.client.NamespaceExistsException) NamespaceNotFoundException(org.apache.accumulo.core.client.NamespaceNotFoundException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) ThriftSecurityException(org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException) NamespaceNotEmptyException(org.apache.accumulo.core.client.NamespaceNotEmptyException) AccumuloException(org.apache.accumulo.core.client.AccumuloException) ThriftTableOperationException(org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException)

Example 4 with ThriftTableOperationException

use of org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException in project accumulo by apache.

the class Manager method mustBeOnline.

public void mustBeOnline(final TableId tableId) throws ThriftTableOperationException {
    ServerContext context = getContext();
    context.clearTableListCache();
    if (context.getTableState(tableId) != TableState.ONLINE) {
        throw new ThriftTableOperationException(tableId.canonical(), null, TableOperation.MERGE, TableOperationExceptionType.OFFLINE, "table is not online");
    }
}
Also used : ServerContext(org.apache.accumulo.server.ServerContext) ThriftTableOperationException(org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException)

Example 5 with ThriftTableOperationException

use of org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException in project accumulo by apache.

the class ClientServiceHandler method getNamespaceConfiguration.

@Override
public Map<String, String> getNamespaceConfiguration(TInfo tinfo, TCredentials credentials, String ns) throws ThriftTableOperationException, TException {
    NamespaceId namespaceId;
    try {
        namespaceId = Namespaces.getNamespaceId(context, ns);
    } catch (NamespaceNotFoundException e) {
        String why = "Could not find namespace while getting configuration.";
        throw new ThriftTableOperationException(null, ns, null, TableOperationExceptionType.NAMESPACE_NOTFOUND, why);
    }
    AccumuloConfiguration config = context.getNamespaceConfiguration(namespaceId);
    return conf(credentials, config);
}
Also used : ThriftTableOperationException(org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException) NamespaceId(org.apache.accumulo.core.data.NamespaceId) NamespaceNotFoundException(org.apache.accumulo.core.client.NamespaceNotFoundException) AccumuloConfiguration(org.apache.accumulo.core.conf.AccumuloConfiguration)

Aggregations

ThriftTableOperationException (org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException)20 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)16 ThriftSecurityException (org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException)14 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)13 NamespaceNotFoundException (org.apache.accumulo.core.client.NamespaceNotFoundException)12 NamespaceId (org.apache.accumulo.core.data.NamespaceId)10 TException (org.apache.thrift.TException)10 IOException (java.io.IOException)8 TableId (org.apache.accumulo.core.data.TableId)7 AccumuloException (org.apache.accumulo.core.client.AccumuloException)6 TTransportException (org.apache.thrift.transport.TTransportException)5 NamespaceExistsException (org.apache.accumulo.core.client.NamespaceExistsException)4 TableExistsException (org.apache.accumulo.core.client.TableExistsException)4 ThriftNotActiveServiceException (org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException)4 ManagerClientService (org.apache.accumulo.core.manager.thrift.ManagerClientService)4 FileNotFoundException (java.io.FileNotFoundException)3 HashSet (java.util.HashSet)3 TableOfflineException (org.apache.accumulo.core.client.TableOfflineException)3 NotServingTabletException (org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException)3 Text (org.apache.hadoop.io.Text)3