Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase, mail # user - class cast exception and setting operation timeout on a pooled HTable


+
Jim the Standing Bear 2013-04-10, 14:56
+
Ted Yu 2013-04-10, 15:02
+
Jim the Standing Bear 2013-04-10, 15:26
Copy link to this message
-
Re: class cast exception and setting operation timeout on a pooled HTable
Nicolas Liochon 2013-04-10, 16:09
But don't forget you don't have to use pooled tables anymore. You can
create the tables you need on the fly, see "9.3.1.1. Connection Pooling."
IIRC, it's available in the version you're using (but I haven't checked).

Cheers,

Nicolas
On Wed, Apr 10, 2013 at 5:26 PM, Jim the Standing Bear <
[EMAIL PROTECTED]> wrote:

> Thanks Ted.  It appears the implementation has changed from v0.92 to
> v0.94 (PooledHTable used to extend HTable in v0.92, but only
> implements HTableInterface in v0.94).  My fault for looking at the
> v0.92 sourcecode and assumed that it would be the same in v0.94.
> So in other words, there is no way to directly set the operation
> timeout on a pooled table, correct?  Thanks.
>
> -- Jim
>
> On Wed, Apr 10, 2013 at 11:02 AM, Ted Yu <[EMAIL PROTECTED]> wrote:
> > PooledHTable implements HTableInterface through delegate, table.
> > I see this method:
> >
> >      * Expose the wrapped HTable to tests in the same package
> >
> >      *
> >
> >      * @return wrapped htable
> >
> >      */
> >
> >     HTableInterface getWrappedTable() {
> >
> >       return table;
> >
> >     }
> > If you just want to verify timeout, you can use (I know this is not
> ideal):
> >
> >     public String toString() {
> >
> >       return "PooledHTable{" + ", table=" + table + '}';
> >
> >     }
> >
> > On Wed, Apr 10, 2013 at 7:56 AM, Jim the Standing Bear <
> > [EMAIL PROTECTED]> wrote:
> >
> >> Hi,
> >>
> >> When I use HTablePool to perform some HBase data loading operations, I
> >> encountered a problem where the Put operation seemed to hang forever.
> >> A little bit of digging shows that the default client operation
> >> timeout is something like 2 billion ms.
> >>
> >> HTable provides a getter and setter methods on operation time out, but
> >> that method is not exposed in HTableInterface.  In addition, the
> >> HTablePool.getTable actually returns a PooledHTable object although
> >> down-casted as HTableInterface, and PooledHTable extends HTable, so it
> >> seems every piece is there for me to check or to set the operation
> >> timeout, and all I need is just some class casting.
> >>
> >> But when I do
> >>
> >> HTableInterface hti = hTablePool.getTable("table1");
> >> System.out.println(((HTable)hti).getOperationTimeout);
> >>
> >> I get a class cast exception:
> >>
> >> java.lang.ClassCastException:
> >> org.apache.hadoop.hbase.client.HTablePool$PooledHTable cannot be cast
> >> to org.apache.hadoop.hbase.client.HTable
> >>
> >> What am I missing?  Also how can I check or set the operation timeout?
> >>  I know another way is to use the configuration parameter,
> >> hbase.client.operation.timeout, but it doesn't allow me to check an
> >> actual HTable instance to make sure the correct timeout is set.
> >> Please help.
> >>
> >> I am using hbase 0.94.4 with security enabled.  Thanks.
> >>
> >> -- Jim
> >>
>
>
>
> --
> --------------------------------------
> Standing Bear Has Spoken
> --------------------------------------
>
+
Jim the Standing Bear 2013-04-10, 16:18
+
Ted Yu 2013-04-10, 16:04