You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by 不再散步 <60...@qq.com> on 2015/02/28 03:59:24 UTC

回复: use thrift2 to access hbase 0.96.10, if I try increment, anddisable the table, the code can not throw useful Exception

sorry, my hbase is 0.96.1.1
hbase(main):017:0> version
0.96.1.1-hadoop2, rUnknown, Tue Dec 17 12:22:12 PST 2013‍

thrift version is 0.9.0


And, I set timeout 5s on TSocket:
 32     try{
 33         boost::shared_ptr<TSocket> socket(new TSocket(_thrift_ip, _thrift_port));
 34         boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
 35         boost::shared_ptr<TProtocol> protocol(newTBinaryProtocol(transport));
 36 
 37         _socket = socket;
 38         _socket->setRecvTimeout(5000);
 39         _socket->setSendTimeout(5000);
 40         _transport = transport;
 41         _protocol = protocol;
 42     } catch (std::exception &e) {
 43         g_logger.error("%s", e.what());
 44         oom_error();
 45     }
 46 
 47     try{
 48         _transport->open();
 49     } catch (TException &e) {
 50         g_logger.warn("can not connect to thriftserver [%s:%d], %s",
 51                 _thrift_ip, _thrift_port, e.what());
 52         return -1;
 53     }
 54 
 55     _client = new (std::nothrow)AHHT::THBaseServiceClient(_protocol);
 56     if (_client == NULL) oom_error();‍





------------------ 原始邮件 ------------------
发件人: "Ted Yu";<yu...@gmail.com>;
发送时间: 2015年2月28日(星期六) 上午10:48
收件人: "user@hbase.apache.org"<us...@hbase.apache.org>; 

主题: Re: use thrift2 to access hbase 0.96.10, if I try increment, anddisable the table, the code can not throw useful Exception



bq. to access hbase 0.96.10

To my knowledge, there wasn't 0.96.10 release. Can you clarify the release
you're using ?

Looking at
./hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftHBaseServiceHandler.java
(in 0.98 branch):

 public TResult increment(ByteBuffer table, TIncrement increment) throws
TIOError, TException {
 public void putMultiple(ByteBuffer table, List<TPut> puts) throws
TIOError, TException {

They throw same types of exceptions.

Cheers

On Fri, Feb 27, 2015 at 6:27 PM, 不再散步 <60...@qq.com> wrote:

> for example:
>      1. I use thrift2 put to access table,
>      try{
>           _client->putMultiple(table, tput_vec); //table is 'member'
>      } catch (TTransportException &e) {
>          ret = e.getType(); //2 or 3
>          g_logger.warn("[%s:%d] [%s] [PUT] TTransportException fail:
> %s:%d",
>                  _thrift_ip, _thrift_port, table.c_str(), e.what(), ret);
>      } catch (TException &e) {
>          g_logger.error("[%s:%d] [%s] [PUT] fatal error: %s, stop",
>                  _thrift_ip, _thrift_port, table.c_str(), e.what());
>          ret = -1;
>      }‍
>
>      if I disable the table 'member', the code can catch
> TTransportException:
> [27560] 28 Feb 10:25:22 [WARN]   [1130428752]
> [bus_hbase_util.cc:_put_multiple] [95] [10.13.2.194:9091] [member] [PUT]
> TTransportException fail: EAGAIN (timed out):2‍‍
>
>
>     2. I use thrfit2 increment to access table,
>     try{
>                     //increment没有批量的接口
>                     _client->increment(tresult, table, tincrement);
>                  } catch (ATP::TProtocolException &e) {
>                      ret = e.getType();
>                      g_logger.warn("[%s:%d] [%s] [INCREMENT]
> TTransportException: %s:%d",
>                              _thrift_ip, _thrift_port, table.c_str(),
> e.what(), ret);
>                      goto error_out;
>                  } catch (AT::TApplicationException &e) {
>                      ret = e.getType();
>                      g_logger.warn("[%s:%d] [%s] [INCREMENT]
> TTransportException: %s:%d",
>                             _thrift_ip, _thrift_port, table.c_str(),
> e.what(), ret);
>                      goto error_out;
>                  } catch (ATT::TTransportException &e) {
>                      ret = e.getType();
>                     g_logger.warn("[%s:%d] [%s] [INCREMENT]
> TTransportException: %s:%d",
>                              _thrift_ip, _thrift_port, table.c_str(),
> e.what(), ret);
>                      goto error_out;
>                  } catch (AT::TException &e) {
>                      g_logger.error("[%s:%d] [%s] [INCREMENT] %s %s:%s %d
> fatal error: %s, stop",
>                              _thrift_ip, _thrift_port,
>                             table.c_str(),
>                              hrow->get_hbase_row(),
>                              hrow->get_hbase_cf(),
>                              hrow->get_hbase_qu(),
>                              hrow->get_hbase_increment(),
>                              e.what());
>                      ret = -1; goto error_out;
>                  }‍
>
>          if I disable the table 'member', the code can only catch
> TException:‍
> [27560] 28 Feb 10:00:35 [ERROR]  [1105250640]
> [bus_hbase_util.cc:send_to_hbase] [233] [10.13.2.194:9091] [member]
> [INCREMENT] counter cf:count 1 fatal error: Default TException., stop‍
>
>
>        WHY I can not catch TTransportException in condition 2, and I can
> catch TTransportException in condition 1? Or something wrong with
> THBaseServiceClient::increment() throw exception ?