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 >> Insert blocked


Copy link to this message
-
Re: Insert blocked
I am now using HTablePool but still the call hangs at "put". My code is
something like this:
hTablePool = *new* HTablePool(config,*MAX_POOL_SIZE*);

result = *new* SessionTimelineDAO(hTablePool.getTable(t.name()),
ColumnFamily.*S_T_MTX*);

 public SessionTimelineDAO(HTableInterface hTableInterface, ColumnFamily
cf){
  this.tableInt = hTableInterface;
  this.cf = cf.name().getBytes();
  log.info("Table " + hTableInterface + " " + cf);
 }

 @Override
 public void create(DataStoreModel dm) throws DataStoreException {
  if(null == dm || null == dm.getKey()){
   log.error("DataStoreModel is invalid");
   return;
  }

  Put p = new Put(dm.getKey().array());

  for(ByteBuffer bf : dm.getCols().keySet()){
   p.add(cf, bf.array(), dm.getColumnValue(bf).array());
  }

  try {
   log.info("In create ");
   tableInt.put(p);
  } catch (IOException e) {
   log.error("Error writing " , e);
   throw new DataStoreException(e);
  } finally{
   cleanUp();

  }
 }
 private void cleanUp() {
  if(null != tableInt){
   try {
    tableInt.close();
   } catch (IOException e) {
    log.error("Failed while closing table interface", e);
   }
  }
 }
On Mon, Jul 23, 2012 at 4:15 PM, Mohit Anchlia <[EMAIL PROTECTED]>wrote:

>
>
>  On Mon, Jul 23, 2012 at 3:54 PM, Elliott Clark <[EMAIL PROTECTED]>wrote:
>
>> HTable is not thread safe[1]. It's better to use HTablePool if you want to
>> share things across multiple threads.[2]
>>
>> 1
>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html
>> 2
>>
>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTablePool.html
>>
>> Thanks! I'll change my code to use HtablePool
>
>> On Mon, Jul 23, 2012 at 3:48 PM, Mohit Anchlia <[EMAIL PROTECTED]
>> >wrote:
>>
>> > I am writing a stress tool to test my specific use case. In my current
>> > implementation HTable is a global static variable that I initialize just
>> > once and use it accross multiple threads. Is this ok?
>> >
>> > My row key consists of (timestamp - (timestamp % 1000)) and cols are
>> > counters. What I am seeing is that when I run my test after first row is
>> > created the application just hangs. I just wanted to check if there are
>> > obvious things that I should watch out for.
>> >
>> > I am currently testing few threads in eclipse, but I'll still try and
>> > generate stackTrace
>> >
>>
>
>
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