Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> How to create HTableInterface in coprocessor?


Copy link to this message
-
Re: How to create HTableInterface in coprocessor?
Ok. I will give a try.

regards!

Yong
On Wed, Oct 23, 2013 at 11:53 PM, Ted Yu <[EMAIL PROTECTED]> wrote:

> Yong:
> I have attached the backport to HBASE-9819.
>
> If you can patch your build and see if it fixes the problem, that would be
> great.
>
>
> On Tue, Oct 22, 2013 at 2:58 PM, Ted Yu <[EMAIL PROTECTED]> wrote:
>
> > Yong:
> > There is unit test exercising CoprocessorEnvironment.getTable().
> > See
> src/test/java/org/apache/hadoop/hbase/coprocessor/TestOpenTableInCoprocessor.java
> > :
> >
> >       HTableInterface table = e.getEnvironment().getTable(otherTable);
> >       Put p = new Put(new byte[] { 'a' });
> >       p.add(family, null, new byte[] { 'a' });
> >       table.put(put);
> >
> > If you can modify the above test to show how the exception is reproduced,
> > that would help us fully understand the case and verify the fix.
> >
> > Thanks
> >
> >
> > On Tue, Oct 22, 2013 at 12:51 PM, Ted Yu <[EMAIL PROTECTED]> wrote:
> >
> >> I logged HBASE-9819 to backport HBASE-8372 'Provide mutability to
> >> CompoundConfiguration' to 0.94
> >>
> >> If you have time, you can work on the backport.
> >>
> >> Cheers
> >>
> >>
> >> On Tue, Oct 22, 2013 at 11:56 AM, yonghu <[EMAIL PROTECTED]> wrote:
> >>
> >>> Hi Ted,
> >>>
> >>> This is because I tried different ways to generate a HTableInterface.
> >>>
> >>> One is as Gray mentioned, use RegionCoprocessorEnvironment "rce" to
> >>> create
> >>> a HTableInterface "td", but it did not work. So I commented it.
> >>>
> >>> Later I tried the approach which is suggested by
> >>> http://hbase.apache.org/book.html#client.connections. First create a
> >>> HConnection "hc", and then create a  HTableInterface "td". It still did
> >>> not
> >>> work.
> >>>
> >>> Both of them return the same error messages. Such as:
> >>>
> >>> ERROR: org.apache.hadoop.hbase.
> >>> client.RetriesExhaustedWithDetailsException: Failed 1 action:
> >>> org.apache.hadoop.hbase.DoNotRetryIOException: Coprocessor:
> >>>
> >>>
> 'org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$RegionEnvironment@9a99eb
> >>> '
> >>> threw: 'java.lang.UnsupportedOperationException: Immutable
> Configuration'
> >>> and has been removedfrom the active coprocessor set.
> >>>     at
> >>>
> >>>
> org.apache.hadoop.hbase.coprocessor.CoprocessorHost.handleCoprocessorThrowable(CoprocessorHost.java:740)
> >>>     at
> >>>
> >>>
> org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.prePut(RegionCoprocessorHost.java:810)
> >>> .............................
> >>>
> >>> and indicate the errors caused by rce.getTable() or hc.getTable().
> >>>
> >>> regards!
> >>>
> >>> Yong
> >>>
> >>>
> >>> On Tue, Oct 22, 2013 at 8:42 PM, Ted Yu <[EMAIL PROTECTED]> wrote:
> >>>
> >>> > There're two types of exceptions. In the code below, I saw
> >>> rce.getTable()
> >>> > being commented out.
> >>> >
> >>> > Can you tell us the correlation between types of exception and
> >>> getTable()
> >>> > calls ?
> >>> >
> >>> > Thanks
> >>> >
> >>> >
> >>> > On Tue, Oct 22, 2013 at 11:24 AM, yonghu <[EMAIL PROTECTED]>
> >>> wrote:
> >>> >
> >>> > > public void prePut(ObserverContext<RegionCoprocessorEnvironment> e,
> >>> Put
> >>> > > put, WALEdit edit, boolean writeToWAL){
> >>> > >         RegionCoprocessorEnvironment rce = e.getEnvironment();
> >>> > > HTableInterface td = null;
> >>> > >         HTableDescriptor htd = hr.getTableDesc();
> >>> > >         Configuration conf = rce.getConfiguration();
> >>> > >         HConnection hc = null;
> >>> > >         try {
> >>> > >             hc = HConnectionManager.createConnection(conf);
> >>> > >         } catch (ZooKeeperConnectionException e1) {
> >>> > >             // TODO Auto-generated catch block
> >>> > >             e1.printStackTrace();
> >>> > >         }
> >>> > >         try {
> >>> > >             td = hc.getTable(Bytes.toBytes(tracking));
> >>> > >         } catch (IOException e1) {
> >>> > >             // TODO Auto-generated catch block
> >>> > >             e1.printStackTrace();
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB