Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/62#discussion_r48773083
  
    --- Diff: 
server/tserver/src/main/java/org/apache/accumulo/tserver/Tablet.java ---
    @@ -1761,33 +1763,41 @@ Scanner createScanner(Range range, int num, 
Set<Column> columns, Authorizations
         private ScanDataSource isolatedDataSource;
         private boolean sawException = false;
         private boolean scanClosed = false;
    +    private Semaphore scannerSemaphore;
     
         Scanner(Range range, ScanOptions options) {
           this.range = range;
           this.options = options;
    +      scannerSemaphore = new Semaphore(1, true);
         }
     
    -    synchronized ScanBatch read() throws IOException, 
TabletClosedException {
    +    ScanBatch read() throws IOException, TabletClosedException {
     
    -      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.");
    +      ScanDataSource dataSource = null;
     
           Batch results = null;
     
    -      ScanDataSource dataSource;
    +      try {
     
    -      if (options.isolated) {
    -        if (isolatedDataSource == null)
    -          isolatedDataSource = new ScanDataSource(options);
    -        dataSource = isolatedDataSource;
    -      } else {
    -        dataSource = new ScanDataSource(options);
    -      }
    +        try {
    +          scannerSemaphore.acquire();
    +        } catch (InterruptedException e) {
    +          sawException = true;
    +        }
     
    -      try {
    +        if (sawException)
    +          throw new IllegalStateException("Tried to use scanner after 
exception occurred.");
    --- End diff --
    
    Isn't this exception message a little misleading now if we catch the 
InterruptedException above? Would it be better to throw an ISE from the catch 
block above with a better message? Or, do we not care what exception we saw?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to