Search in sources :

Example 6 with IterationInterruptedException

use of org.apache.accumulo.core.iteratorsImpl.system.IterationInterruptedException in project accumulo by apache.

the class NextBatchTask method run.

@Override
public void run() {
    final SingleScanSession scanSession = (SingleScanSession) server.getSession(scanID);
    String oldThreadName = Thread.currentThread().getName();
    try {
        if (isCancelled() || scanSession == null)
            return;
        runState.set(ScanRunState.RUNNING);
        Thread.currentThread().setName("User: " + scanSession.getUser() + " Start: " + scanSession.startTime + " Client: " + scanSession.client + " Tablet: " + scanSession.extent);
        Tablet tablet = server.getOnlineTablet(scanSession.extent);
        if (tablet == null) {
            addResult(new org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException(scanSession.extent.toThrift()));
            return;
        }
        ScanBatch batch = scanSession.scanner.read();
        // there should only be one thing on the queue at a time, so
        // it should be ok to call add()
        // instead of put()... if add() fails because queue is at
        // capacity it means there is code
        // problem somewhere
        addResult(batch);
    } catch (TabletClosedException e) {
        addResult(new org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException(scanSession.extent.toThrift()));
    } catch (IterationInterruptedException iie) {
        if (!isCancelled()) {
            log.warn("Iteration interrupted, when scan not cancelled", iie);
            addResult(iie);
        }
    } catch (TooManyFilesException | SampleNotPresentException e) {
        addResult(e);
    } catch (IOException | RuntimeException e) {
        log.warn("exception while scanning tablet {} for {}", scanSession.extent, scanSession.client, e);
        addResult(e);
    } finally {
        runState.set(ScanRunState.FINISHED);
        Thread.currentThread().setName(oldThreadName);
    }
}
Also used : TooManyFilesException(org.apache.accumulo.server.fs.TooManyFilesException) IOException(java.io.IOException) TabletClosedException(org.apache.accumulo.tserver.tablet.TabletClosedException) SampleNotPresentException(org.apache.accumulo.core.client.SampleNotPresentException) ScanBatch(org.apache.accumulo.tserver.tablet.ScanBatch) IterationInterruptedException(org.apache.accumulo.core.iteratorsImpl.system.IterationInterruptedException) Tablet(org.apache.accumulo.tserver.tablet.Tablet) SingleScanSession(org.apache.accumulo.tserver.session.SingleScanSession)

Aggregations

IterationInterruptedException (org.apache.accumulo.core.iteratorsImpl.system.IterationInterruptedException)6 IOException (java.io.IOException)4 Key (org.apache.accumulo.core.data.Key)4 ArrayList (java.util.ArrayList)3 Range (org.apache.accumulo.core.data.Range)3 TooManyFilesException (org.apache.accumulo.server.fs.TooManyFilesException)3 Tablet (org.apache.accumulo.tserver.tablet.Tablet)3 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Entry (java.util.Map.Entry)2 SampleNotPresentException (org.apache.accumulo.core.client.SampleNotPresentException)2 Value (org.apache.accumulo.core.data.Value)2 KeyExtent (org.apache.accumulo.core.dataImpl.KeyExtent)2 TKeyExtent (org.apache.accumulo.core.dataImpl.thrift.TKeyExtent)2 KVEntry (org.apache.accumulo.tserver.tablet.KVEntry)2 TabletClosedException (org.apache.accumulo.tserver.tablet.TabletClosedException)2 ByteBuffer (java.nio.ByteBuffer)1 Iterator (java.util.Iterator)1 Collectors (java.util.stream.Collectors)1