hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Liochon (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-10497) Add standard handling for swallowed InterruptedException thrown by Thread.sleep under HBase-Client/HBase-Server folders systematically
Date Wed, 12 Feb 2014 18:53:20 GMT

    [ https://issues.apache.org/jira/browse/HBASE-10497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13899422#comment-13899422
] 

Nicolas Liochon commented on HBASE-10497:
-----------------------------------------

I've submitted the patch, to see what hadoop-qa says.

The patch is big. It touches some scaring part. I would propose to split it:
 - some parts are in the mini cluster: even if we do something wrong here it's not a big deal
 - some parts seems good: RpcClient (I can +1 this) 
 - some parts are more complex: MemStoreFlusher: I'm not sure. It's a runnable, restoring
the status seems meaningless; SplitLogWorker seems wrong, it's a runnable ;Leases. I don't
know. Could be wrong again; HRegionServer
 - some parts, imho, should not be managed by restoring the status but by throwing an exception
or even explaining why we do nothing. That's the case here.

{code}
  public TableListModel getTableList() throws IOException {

    StringBuilder path = new StringBuilder();
    path.append('/');
    if (accessToken != null) {
      path.append(accessToken);
      path.append('/');
    }

    int code = 0;
    for (int i = 0; i < maxRetries; i++) {
      // Response response = client.get(path.toString(),
      // Constants.MIMETYPE_XML);
      Response response = client.get(path.toString(),
          Constants.MIMETYPE_PROTOBUF);
      code = response.getCode();
      switch (code) {
      case 200:
        TableListModel t = new TableListModel();
        return (TableListModel) t.getObjectFromMessage(response.getBody());
      case 404:
        throw new IOException("Table list not found");
      case 509:
        try {
          Thread.sleep(sleepTime);
        } catch (InterruptedException e) {
          thrown new InterruptedIOException();
        }
        break;
      default:
        throw new IOException("get request to " + path.toString()
            + " request returned " + code);
      }
    }
    throw new IOException("get request to " + path.toString()
        + " request timed out");
  }
{code}

So at the end, we could have a few sub jiras:
 - the ones with a high level of confidence
 - the less confident ones bug not very risky
 - the ones when we don't restore the status but we properly manage the exception
 - a set of small ones per area for the others. They will be easier to review.

> Add standard handling for swallowed InterruptedException thrown by Thread.sleep under
HBase-Client/HBase-Server folders systematically
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-10497
>                 URL: https://issues.apache.org/jira/browse/HBASE-10497
>             Project: HBase
>          Issue Type: Improvement
>          Components: Client, regionserver
>            Reporter: Feng Honghua
>            Assignee: Feng Honghua
>            Priority: Minor
>         Attachments: HBASE-10497-trunk_v1.patch, HBASE-10497-trunk_v2.patch
>
>
> There are many places where InterruptedException thrown by Thread.sleep are swallowed
silently (which are neither declared in the caller method's throws clause nor rethrown immediately)
under HBase-Client/HBase-Server folders.
> It'd be better to add standard 'log and call currentThread.interrupt' for such cases.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message