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

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


Copy link to this message
-
Re: Unable to add co-processor to table through HBase api
anil gupta 2012-10-19, 04:58
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(className,
>               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(className,
>               new Path("hdfs://hbasecluster/tmp/hbase_cdh4.jar"),
> Coprocessor.PRIORITY_USER,map);
>
>       if(
>
> hAdmin.getTableDescriptor(Bytes.toBytes(tableName)).hasCoprocessor(className)
>               )
>       {
>         System.err.println("YIPPPPPPPPPIEEEEE!!!!!!!");
>       }
>       hAdmin.enableTable(tableName);
>
>     }
>     hAdmin.close();
>    }
>
> Thanks,
> Anil Gupta
>
> On Wed, Oct 17, 2012 at 9:27 PM, Ramkrishna.S.Vasudevan <
> [EMAIL PROTECTED]> wrote:
>
> > Do let me know if you are stuck up.  May be I did not get your actual
> > problem.
> >
> > All the best.
> >
> > Regards
> > Ram
> >
> > > -----Original Message-----
> > > From: anil gupta [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, October 17, 2012 11:34 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: Unable to add co-processor to table through HBase api
> > >
> > > Hi Ram,
> > >
> > > The table exists and I don't get any error while running the program(i
> > > would get an error if the table did not exist). I am running a
> > > distributed
> > > cluster.
> > >
> > > Tried following additional ways also:
> > >
> > >    1. I tried loading the AggregationImplementation coproc.
> > >    2. I also tried adding the coprocs while the table is enabled.
> > >
> > >
> > > Also had a look at the JUnit test cases and could not find any
> > > difference.
> > >
> > > I am going to try adding the coproc along with jar in Hdfs and see what
> > > happens.
> > >
> > > Thanks,
> > > Anil Gupta
> > >
> > > On Tue, Oct 16, 2012 at 11:44 PM, Ramkrishna.S.Vasudevan <
> > > [EMAIL PROTECTED]> wrote:
> > >
> > > > I tried out a sample test class.  It is working properly.  I just
> > > have a
> > > > doubt whether you are doing the
> > > > Htd.addCoprocessor() step before creating the table?  Try that way
> > > hope it
> > > > should work.
> > > >
> > > > Regards

Thanks & Regards,
Anil Gupta