Search in sources :

Example 1 with LookupTask

use of org.apache.accumulo.tserver.scan.LookupTask in project accumulo by apache.

the class ThriftClientHandler method continueMultiScan.

private MultiScanResult continueMultiScan(long scanID, MultiScanSession session) throws TSampleNotPresentException {
    if (session.lookupTask == null) {
        session.lookupTask = new LookupTask(server, scanID);
        server.resourceManager.executeReadAhead(session.threadPoolExtent, getScanDispatcher(session.threadPoolExtent), session, session.lookupTask);
    }
    try {
        MultiScanResult scanResult = session.lookupTask.get(MAX_TIME_TO_WAIT_FOR_SCAN_RESULT_MILLIS, TimeUnit.MILLISECONDS);
        session.lookupTask = null;
        return scanResult;
    } catch (ExecutionException e) {
        server.sessionManager.removeSession(scanID);
        if (e.getCause() instanceof SampleNotPresentException) {
            throw new TSampleNotPresentException();
        } else {
            log.warn("Failed to get multiscan result", e);
            throw new RuntimeException(e);
        }
    } catch (TimeoutException e1) {
        long timeout = server.getConfiguration().getTimeInMillis(Property.TSERV_CLIENT_TIMEOUT);
        server.sessionManager.removeIfNotAccessed(scanID, timeout);
        List<TKeyValue> results = Collections.emptyList();
        Map<TKeyExtent, List<TRange>> failures = Collections.emptyMap();
        List<TKeyExtent> fullScans = Collections.emptyList();
        return new MultiScanResult(results, failures, fullScans, null, null, false, true);
    } catch (Exception t) {
        server.sessionManager.removeSession(scanID);
        log.warn("Failed to get multiscan result", t);
        throw new RuntimeException(t);
    }
}
Also used : LookupTask(org.apache.accumulo.tserver.scan.LookupTask) TRange(org.apache.accumulo.core.dataImpl.thrift.TRange) TSampleNotPresentException(org.apache.accumulo.core.tabletserver.thrift.TSampleNotPresentException) SampleNotPresentException(org.apache.accumulo.core.client.SampleNotPresentException) MultiScanResult(org.apache.accumulo.core.dataImpl.thrift.MultiScanResult) TSampleNotPresentException(org.apache.accumulo.core.tabletserver.thrift.TSampleNotPresentException) ArrayList(java.util.ArrayList) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) ExecutionException(java.util.concurrent.ExecutionException) Map(java.util.Map) HashMap(java.util.HashMap) TooManyFilesException(org.apache.accumulo.server.fs.TooManyFilesException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) NoSuchScanIDException(org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException) CancellationException(java.util.concurrent.CancellationException) ThriftSecurityException(org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException) TSampleNotPresentException(org.apache.accumulo.core.tabletserver.thrift.TSampleNotPresentException) ConstraintViolationException(org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException) TException(org.apache.thrift.TException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) NoNodeException(org.apache.zookeeper.KeeperException.NoNodeException) TimeoutException(java.util.concurrent.TimeoutException) TabletClosedException(org.apache.accumulo.tserver.tablet.TabletClosedException) IterationInterruptedException(org.apache.accumulo.core.iteratorsImpl.system.IterationInterruptedException) NotServingTabletException(org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) SampleNotPresentException(org.apache.accumulo.core.client.SampleNotPresentException) ThriftTableOperationException(org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException) TimeoutException(java.util.concurrent.TimeoutException)

Aggregations

IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 CancellationException (java.util.concurrent.CancellationException)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 Collectors.toList (java.util.stream.Collectors.toList)1 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)1 SampleNotPresentException (org.apache.accumulo.core.client.SampleNotPresentException)1 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)1 ThriftSecurityException (org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException)1 ThriftTableOperationException (org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException)1 MultiScanResult (org.apache.accumulo.core.dataImpl.thrift.MultiScanResult)1 TRange (org.apache.accumulo.core.dataImpl.thrift.TRange)1 IterationInterruptedException (org.apache.accumulo.core.iteratorsImpl.system.IterationInterruptedException)1 ConstraintViolationException (org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException)1 NoSuchScanIDException (org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException)1 NotServingTabletException (org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException)1