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

Ted Yu commented on HBASE-4087:
-------------------------------

In case of server outage/restart, declared exceptions wouldn't be thrown:
{code}
  public HBaseAdmin(Configuration c)
  throws MasterNotRunningException, ZooKeeperConnectionException {
{code}
I need to dig deeper into current failure in TestMasterFailover to answer the 
last question above.

I could use the following structure in place of current:
{code}
  Foo result = new RetryOnce<Foo>() {
    Foo doIt(HConnection connection) {
      return connection.foo();
    }
  }.run();

  abstract class RetryOnce<T> {
    T run() {
      try {
        return doIt(connection);
      }
      catch (UndeclaredThrowableException ute) {
        HConnectionManager.deleteStaleConnection(connection);
        connection = HConnectionManager.getConnection(conf);
        return doIt(connection);
      }
    }
    abstract T doIt(HConnection connection);
  }
{code}
I believe Karthick proposed similar construct when he was implementing 
HBASE-3777 but the response was lukewarm. Further only two lines were saved in 
the above construct.

The challenge here is that we should expect client to cache the connection 
handed out to them, making burying it under the API very hard to achieve.


> HConnectionManager should perform validation of connection it hands out
> -----------------------------------------------------------------------
>
>                 Key: HBASE-4087
>                 URL: https://issues.apache.org/jira/browse/HBASE-4087
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Priority: Critical
>             Fix For: 0.92.0
>
>         Attachments: 4087-v2.txt, 4087.txt
>
>
> Through HBASE-3777, HConnectionManager reuses the connection to HBase servers.
> One challenge, discovered in troubleshooting HBASE-4052, is how we invalidate 
> connection(s) to server which gets restarted.
> There're at least two ways.
> 1. HConnectionManager utilizes background thread(s) to periodically perform 
> validation of connections in HBASE_INSTANCES and remove stale connection(s).
> 2. Allow HBaseClient (including HBaseAdmin) to provide feedback to 
> HConnectionManager.
> The solution can be a combination of both of the above.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to