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 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
Copy link to this message
-
Re: Unable to add co-processor to table through HBase api
It worked. :)

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

> Ok Anil.. Not a problem.. My intention was to just see if the api was
> working during createtable so that it will help you.
>
> Regards
> Ram
>
> > -----Original Message-----
> > From: anil gupta [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, October 19, 2012 11:22 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Unable to add co-processor to table through HBase api
> >
> > Thanks a lot Guys. I really appreciate you help. I'll try this change
> > in
> > the morning and let you know the outcome.
> >
> > @Ram: Actually, i was trying to add the coprocessor to a per-existing
> > table. I think yesterday you assumed that I am trying to add the
> > coprocessor while creating the table. That's why there was a confusion
> > between us.
> >
> > On Thu, Oct 18, 2012 at 10:40 PM, Ramkrishna.S.Vasudevan <
> > [EMAIL PROTECTED]> wrote:
> >
> > > Yes you are right. modifyTable has to be called.
> > >
> > > public class TestClass {
> > >   private static HBaseTestingUtility UTIL = new
> > HBaseTestingUtility();
> > >   @BeforeClass
> > >   public static void setupBeforeClass() throws Exception {
> > >     Configuration conf = UTIL.getConfiguration();
> > >
> > >   }
> > >
> > >   @Before
> > >   public void setUp() throws Exception{
> > >     UTIL.startMiniCluster(1);
> > >   }
> > >
> > >   @Test
> > >   public void testSampe() throws Exception{
> > >     HBaseAdmin admin = UTIL.getHBaseAdmin();
> > >     Configuration conf = UTIL.getConfiguration();
> > >     ZooKeeperWatcher zkw > > HBaseTestingUtility.getZooKeeperWatcher(UTIL);
> > >     String userTableName = "testSampe";
> > >     HTableDescriptor htd = new HTableDescriptor(userTableName);
> > >
> > >
> > >
> > //htd.addCoprocessor("org.apache.hadoop.hbase.regionserver.MockRegionOb
> > serve
> > > r");
> > >     HColumnDescriptor hcd = new HColumnDescriptor("col");
> > >     htd.addFamily(hcd);
> > >     admin.createTable(htd);
> > >     ZKAssign.blockUntilNoRIT(zkw);
> > >
> > >     admin.disableTable(userTableName);
> > >
> > >
> > >
> > htd.addCoprocessor("org.apache.hadoop.hbase.regionserver.MockRegionObse
> > rver"
> > > );
> > >     admin.modifyTable(Bytes.toBytes(userTableName), htd);
> > >     admin.enableTable(userTableName);
> > >     HTable table = new HTable(conf, userTableName);
> > >
> > >     HTableDescriptor tableDescriptor > > > admin.getTableDescriptor(Bytes.toBytes(userTableName));
> > >     boolean hasCoprocessor > > >
> > >
> > tableDescriptor.hasCoprocessor("org.apache.hadoop.hbase.regionserver.Mo
> > ckReg
> > > ionObserver");
> > >     System.out.println(hasCoprocessor);
> > >
> > >
> > >
> > >   }
> > > }
> > >
> > > If you comment the modifyTable() you will not be able to see the
> > > coprocessor
> > > added.
> > > That's what I told in my previous reply itself like try doing this
> > while
> > > createTable itself.  If you want to add it later then its thro modify
> > table
> > > you can do because it involves changes the HTD.
> > >
> > > Regards
> > > Ram
> > >
> > > > -----Original Message-----
> > > > From: anil gupta [mailto:[EMAIL PROTECTED]]
> > > > Sent: Friday, October 19, 2012 11:02 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: Unable to add co-processor to table through HBase api
> > > >
> > > > 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/HTableDescript
> > > > or.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/HBaseAdm
Thanks & Regards,
Anil Gupta
+
anil gupta 2012-10-19, 05:31
+
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
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