hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wukang Lin <vboylin1...@gmail.com>
Subject Strange Problem on using HRegion's getScanner Method in RegionServer
Date Tue, 03 Dec 2013 16:22:17 GMT
Hi all,
    I got a trouble in using HRegion's RegionScanner in RegionServer.
    In my project, a custom RPC server was started in RegionServer using
coprocessor mechanism, and it work well. In this RPC server, it receive a
call from client, and scan the HRegion specialised by the params setted by
the client like this:
HRegion region = this.getHRegionByEncodeName(encodeName);

Scan scan = new Scan();
RegionScanner scanner = null;
try {
      scanner = region.getScanner(scan);
      long total = 0;
      boolean hasNext = true;
      List<KeyValue> kvs = new ArrayList<KeyValue>();
      while (hasNext) {
          hasNext = scanner.next(kvs);
          if (kvs.size() > 0) {
      } catch (IOException e) {
           LOG.warn("Exception thrown when scanning region '" + regionName
+ "', SKIP IT!", e);
      } finally {

              if (scanner != null) {
                   try {
                   } catch (IOException e) {
       LOG.info("Total " + total + " rows scanned.");
Then, I put a row to a HRegion by HTable interface, and make an RPC call of
my custom RPC server to scan the HRegion(the code lines above is executed
in a HRegionServer, a HRegion is scanned), and got nothing, total = 0. But
if I use client side scan like HTable's scan interface or HBase shell, I
can get the row I insert just now. I tried to flush the region and do a
major compaction on the HRegion using hbase shell, Nothing changed.
So, what's wrong with the code above? how to scan a HRegion in
HRegionServer instance?
Any responses is Appreciated!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message