accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From milleruntime <...@git.apache.org>
Subject [GitHub] accumulo pull request #159: ACCUMULO-1280: many changes for closing iterator...
Date Thu, 17 Nov 2016 18:16:49 GMT
Github user milleruntime commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/159#discussion_r88512703
  
    --- Diff: server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Scanner.java
---
    @@ -61,39 +61,27 @@ public ScanBatch read() throws IOException, TabletClosedException
{
         Batch results = null;
     
         try {
    +      scannerSemaphore.acquire();
    +    } catch (InterruptedException e) {
    +      sawException = true;
    +    }
     
    -      try {
    -        scannerSemaphore.acquire();
    -      } catch (InterruptedException e) {
    -        sawException = true;
    -      }
    -
    -      // sawException may have occurred within close, so we cannot assume that an interrupted
exception was its cause
    -      if (sawException)
    -        throw new IllegalStateException("Tried to use scanner after exception occurred.");
    +    // sawException may have occurred within close, so we cannot assume that an interrupted
exception was its cause
    +    if (sawException)
    +      throw new IllegalStateException("Tried to use scanner after exception occurred.");
     
    -      if (scanClosed)
    -        throw new IllegalStateException("Tried to use scanner after it was closed.");
    +    if (scanClosed)
    +      throw new IllegalStateException("Tried to use scanner after it was closed.");
     
    -      if (options.isIsolated()) {
    -        if (isolatedDataSource == null)
    -          isolatedDataSource = new ScanDataSource(tablet, options);
    -        dataSource = isolatedDataSource;
    -      } else {
    -        dataSource = new ScanDataSource(tablet, options);
    -      }
    +    if (options.isIsolated()) {
    +      if (isolatedDataSource == null)
    +        isolatedDataSource = new ScanDataSource(tablet, options);
    +      dataSource = isolatedDataSource;
    +    } else {
    +      dataSource = new ScanDataSource(tablet, options);
    +    }
     
    -      SortedKeyValueIterator<Key,Value> iter;
    -
    -      if (options.isIsolated()) {
    -        if (isolatedIter == null)
    -          isolatedIter = new SourceSwitchingIterator(dataSource, true);
    -        else
    -          isolatedDataSource.reattachFileManager();
    -        iter = isolatedIter;
    -      } else {
    -        iter = new SourceSwitchingIterator(dataSource, false);
    -      }
    +    try (SortedKeyValueIterator<Key,Value> iter = createIter(dataSource)) {
    --- End diff --
    
    I reverted changes to ScanDataSource.  Think these changes are OK now? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message