You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2019/11/27 11:47:28 UTC

[GitHub] [incubator-iotdb] samperson1997 opened a new pull request #591: [IOTDB-317] Fix "flush + wrong aggregation" causes failed query in v0.8.x

samperson1997 opened a new pull request #591: [IOTDB-317] Fix "flush + wrong aggregation" causes failed query in v0.8.x
URL: https://github.com/apache/incubator-iotdb/pull/591
 
 
   This PR fixes the bug of **flush + wrong aggregation** causes failed query in v0.8.x as is described in [issue IOTDB-317](https://issues.apache.org/jira/browse/IOTDB-317).
   
   **【The main cause of this bug】**
   When a wrong aggregation sql is executed, in `IoTDBStatement.java`, **getColumnsType** function is called when creating a new `IoTDBQueryResultSet`:
   ```
   IoTDBQueryResultSet resSet = new IoTDBQueryResultSet(this,
               execResp.getColumns(), client,
               operationHandle, sql, execResp.getOperationType(),
               getColumnsType(execResp.getColumns()), queryId.getAndIncrement());
   ``` 
   **getColumnsType** function calls **fetchMetadata** function in `TSServiceImpl.java`, which catches an exception (**QueryProcessException** in 0.9.x, and **PathErrorException** in 0.8.x), and uses `Thread.currentThread().interrupt()` to interrupt current thread. (The similar interrupt is also happened when executing `flush`)
   
   However, when executing a new query, a new **TSFileSequenceReader** is created, so a new **DefaultTsFileInput** is opened:
   ```
   public DefaultTsFileInput(Path file) throws IOException {
       channel = FileChannel.open(file, StandardOpenOption.READ);
     }
   ```
   This causes **ClosedByInterruptException**:
   ```
   Checked exception received by a thread when another thread interrupts it
   while it is blocked in an I/O operation upon a channel.
   Before this exception is thrown the channel will have been closed and the interrupt
   status of the previously-blocked thread will have been set.
   ```
   which finally causes the issue.
   
   **【Why this bug is solved in 0.9.x】**
   In PR #294 , the return data type in **TSExecuteStatementResp** is changed and fetch metadata requests are avoided, so the exception will not be thrown and the thread will not be interrupted.
   Since interrupting current thread is useless and not necessary,  it should be deleted not only in 0.8.x (which fixes the bug) but also in 0.9.x.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services