2015-09-18 56 views
4
Scan s = new Scan(); 
    s.addFamily(Bytes.toBytes("cf1")); 
    s.setCaching(cacheRows); 
    s.setCacheBlocks(false); 
    s.setStartRow("30.0.2.2\01441756800\0"); 
    s.setStopRow("30.0.2.3\01441756800\0"); 

    ResultScanner scanner = table.getScanner(s); 

    long rows = 0; 
    try { 
     for (Result rr = scanner.next(); rr != null; rr = scanner.next()) { 
      rows++; 
     } 
    } finally { 
     scanner.close(); 
    } 

    System.out.println("Total no of rows = " + rows); 

當運行上面cacheRows = 100或10000碼它打印 總計沒有行= 480000HBASE掃描scan.setCaching設置heigher值時不返回的所有行(cacheRow)

當我運行的上面cacheRows = 100000它打印 總代碼沒有行的10090個=

cacheRows = 10083個打印480000

cacheRows = 10084個打印191595

cacheRows = 10085個打印20169

cacheRows = 10086個打印20170個

cacheRows = 10087個打印20171個

cacheRows = 10088個打印20172個

cacheRows = 10089個打印20173

cacheRows = 10090打印20174

cacheRows> = 10091打印10090

回答

4

問題是由設置setMaxResultSize設置相同hbase.server.scanner.max.result.size和HBase的-site.xml中
hbase.client.scanner.max.result.size OR
解決
在掃描對象值等於大小100000(緩存行參數)行,這是我的情況下20971520(20MB)

請參閱bug的更多細節:HBASE-13527