Search in sources :

Example 6 with MultiScanResult

use of org.apache.accumulo.core.dataImpl.thrift.MultiScanResult 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

ArrayList (java.util.ArrayList)6 List (java.util.List)6 Map (java.util.Map)6 MultiScanResult (org.apache.accumulo.core.dataImpl.thrift.MultiScanResult)6 TRange (org.apache.accumulo.core.dataImpl.thrift.TRange)6 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 SampleNotPresentException (org.apache.accumulo.core.client.SampleNotPresentException)5 Range (org.apache.accumulo.core.data.Range)5 KeyExtent (org.apache.accumulo.core.dataImpl.KeyExtent)5 TKeyExtent (org.apache.accumulo.core.dataImpl.thrift.TKeyExtent)5 Iterator (java.util.Iterator)4 Entry (java.util.Map.Entry)4 Collectors (java.util.stream.Collectors)4 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)4 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)4 ThriftSecurityException (org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException)4 Key (org.apache.accumulo.core.data.Key)4 InitialMultiScan (org.apache.accumulo.core.dataImpl.thrift.InitialMultiScan)4 TKeyValue (org.apache.accumulo.core.dataImpl.thrift.TKeyValue)4