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

Switch to Plain View
HBase, mail # user - Re: Unable to add co-processor to table through HBase api


+
anil gupta 2012-10-17, 18:04
+
Ramkrishna.S.Vasudevan 2012-10-18, 04:27
+
anil gupta 2012-10-16, 22:35
+
anil gupta 2012-10-17, 02:43
+
Ramkrishna.S.Vasudevan 2012-10-17, 04:44
+
anil gupta 2012-10-18, 21:16
+
Anoop Sam John 2012-10-19, 04:43
+
anil gupta 2012-10-19, 04:58
+
Ramkrishna.S.Vasudevan 2012-10-19, 05:23
+
anil gupta 2012-10-19, 16:07
Copy link to this message
-
Re: Unable to add co-processor to table through HBase api
anil gupta 2012-10-19, 05:31
Hi Guys,

Do you mean to say that i need to call the following method after the call
to addCoprocessor method:

public void *modifyTable*(byte[] tableName,
                        HTableDescriptor
<http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/HTableDescriptor.html>
htd)
                 throws IOException
<http://download.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true>
http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HBaseAdmin.html#modifyTable%28byte[],%20org.apache.hadoop.hbase.HTableDescriptor%29

Thanks,
Anil Gupta

On Thu, Oct 18, 2012 at 10:23 PM, Ramkrishna.S.Vasudevan <
[EMAIL PROTECTED]> wrote:

> I can attach the code that I tried.  Here as the HTD is getting modified we
> may need to call modifyTable().
> My testclass did try this while doing creation of table itself.
>
> I will attach shortly.
>
> Regards
> Ram
>
> > -----Original Message-----
> > From: anil gupta [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, October 19, 2012 10:29 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Unable to add co-processor to table through HBase api
> >
> > Hi Anoop,
> >
> > Sorry, i am unable to understand what you mean by "have to modify the
> > table
> > calling Admin API??". Am i missing some other calls in my code?
> >
> > Thanks,
> > Anil Gupta
> >
> > On Thu, Oct 18, 2012 at 9:43 PM, Anoop Sam John <[EMAIL PROTECTED]>
> > wrote:
> >
> > >
> > >
> > >
> > >hAdmin.getTableDescriptor(Bytes.toBytes(tableName)).addCoprocessor(cla
> > ssName,
> > >               new Path("hdfs://hbasecluster/tmp/hbase_cdh4.jar"),
> > > Coprocessor.PRIORITY_USER,map);
> > >
> > > Anil,
> > >
> > > Don't you have to modify the table calling Admin API??  !!!!!  Not
> > seeing
> > > that code here...
> > >
> > > -Anoop-
> > >
> > > ________________________________________
> > > From: anil gupta [[EMAIL PROTECTED]]
> > > Sent: Friday, October 19, 2012 2:46 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: Unable to add co-processor to table through HBase api
> > >
> > > Hi Folks,
> > >
> > > Still, i am unable to add the co-processors through HBase client api.
> > This
> > > time i tried loading the coprocessor by providing the jar path along
> > with
> > > parameters. But, it failed.
> > > I was able to add the same coprocessor to the table through HBase
> > shell.
> > > I also dont see any logs regarding adding coprocessors in
> > regionservers
> > > when i try to add the co-processor through api.I strongly feel that
> > HBase
> > > client api for adding coprocessor seems to be broken. Please let me
> > know if
> > > the code below seems to be problematic.
> > >
> > > Here is the code i used to add the coprocessor through HBase api:
> > >     private static void modifyTable() throws IOException
> > >     {
> > >     Configuration conf = HBaseConfiguration.create();
> > >     HBaseAdmin hAdmin = new HBaseAdmin(conf);
> > >     String tableName = "txn";
> > >     hAdmin.disableTable(tableName);
> > >     if(!hAdmin.isTableEnabled(tableName))
> > >     {
> > >       System.out.println("Trying to add coproc to table"); // using
> > err so
> > > that it's easy to read this on eclipse console.
> > >       HashMap<String, String> map = new HashMap<String,String>();
> > >       map.put("arg1", "batchdate");
> > >       String className > > >
> > "com.intuit.ihub.hbase.poc.coprocessor.observer.IhubTxnRegionObserver";
> > >
> > >
> > >
> > hAdmin.getTableDescriptor(Bytes.toBytes(tableName)).addCoprocessor(clas
> > sName,
> > >               new Path("hdfs://hbasecluster/tmp/hbase_cdh4.jar"),
> > > Coprocessor.PRIORITY_USER,map);
> > >
> > >       if(
> > >
> > >
> > hAdmin.getTableDescriptor(Bytes.toBytes(tableName)).hasCoprocessor(clas
> > sName)
> > >               )
> > >       {
> > >         System.err.println("YIPPPPPPPPPIEEEEE!!!!!!!");
> > >       }
> > >       hAdmin.enableTable(tableName);
> > >
> > >     }
> > >     hAdmin.close();
> > >    }
> > >
> > > Thanks,
> > > Anil Gupta
Thanks & Regards,
Anil Gupta
+
Anoop Sam John 2012-10-19, 05:37
+
Ramkrishna.S.Vasudevan 2012-10-19, 05:40
+
anil gupta 2012-10-19, 05:51
+
Ramkrishna.S.Vasudevan 2012-10-19, 05:54