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

Switch to Threaded View
HBase, mail # user - problem in running coprocessor


Copy link to this message
-
problem in running coprocessor
ch huang 2013-07-16, 03:02
here is my example code , and regionserver error output. anyone can help?

public class TestMyCo {
 /**
  * @param args
  */
 private static Configuration conf =null;

 static {
 conf = HBaseConfiguration.create();
    conf.addResource( "hbase-site.xml");

 }
 public static void main(String[] args) throws IOException {
  // TODO Auto-generated method stub
  Configuration conf = HBaseConfiguration.create();
  conf.addResource( "hbase-site.xml");
  String tableName = "mytest";

  final Scan scan = new Scan();
  scan.addColumn("myfl".getBytes(), "myqf".getBytes());
  final Filter filter = new ValueFilter(CompareFilter.CompareOp.EQUAL,new
RegexStringComparator(".*\\.5"));
       HTable table = new HTable(conf,tableName);
  try{
   System.out.println("start coprocessor search...");
  long startTime = System.currentTimeMillis();
        Map<byte[],Long> results table.coprocessorExec(MyTestProtocol.class, null, null,
          new Batch.Call<MyTestProtocol, Long>() {
                  public Long call(MyTestProtocol mycheck) throws
IOException {
                   return mycheck.myFilter(scan, filter);
                  }
    });
        long elapsedTime = System.currentTimeMillis() - startTime;
        System.out.println("table search time( 1M rows ) : "+elapsedTime+"
ms\n");
        for(Map.Entry<byte[], Long> entry : results.entrySet()){
         System.out.println("find : " +entry.getKey() + " : " +
entry.getValue() );
        }
        System.out.println("coprocessor search end");
        System.out.println("scan search start....");
        startTime = System.currentTimeMillis();
        Filter filter2 = new ValueFilter(CompareFilter.CompareOp.EQUAL,new
RegexStringComparator(".*6$"));
        Scan scan2 = new Scan();
        scan2.addColumn("myfl".getBytes(), "myqf".getBytes());
        scan2.setFilter(filter2);
        ResultScanner rs = table.getScanner(scan2);
        System.out.println("scan search end");
        elapsedTime = System.currentTimeMillis() - startTime;
        System.out.println("scan time( 1M rows ) : "+elapsedTime+" ms\n");
        int count = 0;
        for(Result res : rs){
       //  System.out.println(res);
         count++;
        }
        System.out.println("find "+count+" records");

        table.close();

     }catch(Throwable throwable){
      throwable.printStackTrace();
     }
 }
13/07/16 10:56:27 ERROR regionserver.HRegionServer:
org.apache.hadoop.hbase.ipc.CallerDisconnectedException: Aborting call
execCoprocessor([B@229961ae,
myFilter({"timeRange":[0,9223372036854775807],"batch":-1,"startRow":"","stopRow":"","totalColumns":1,"cacheBlocks":true,"families":{"myfl":["myqf"]},"maxVersions":1,"filter":"ValueFilter
(EQUAL, .*\\x5C.5)","caching":-1}, ValueFilter (EQUAL, .*\x5C.5)), rpc
version=1, client version=0, methodsFingerPrint=0), rpc version=1, client
version=29, methodsFingerPrint=-1368823753 from 192.168.2.166:5541 after
60126 ms, since caller disconnected
        at
org.apache.hadoop.hbase.ipc.HBaseServer$Call.throwExceptionIfCallerDisconnected(HBaseServer.java:436)
        at
org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.nextInternal(HRegion.java:3856)
        at
org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.nextRaw(HRegion.java:3776)
        at
org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.next(HRegion.java:3759)
        at
org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.next(HRegion.java:3790)
        at MyTestEndpoint.myFilter(MyTestEndpoint.java:33)
        at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.hadoop.hbase.regionserver.HRegion.exec(HRegion.java:5482)
        at
org.apache.hadoop.hbase.regionserver.HRegionServer.execCoprocessor(HRegionServer.java:3720)
        at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.hadoop.hbase.ipc.WritableRpcEngine$Server.call(WritableRpcEngine.java:320)
        at
org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1426)