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运行上面的代码时,它会打印出来 总行数= 480000
当我使用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
答案 0 :(得分:4)
通过设置相同的 hbase.server.scanner.max.result.size 和 hbase.client.scanner.max.result.size 来解决问题在hbase-site.xml中,或者通过在扫描对象值中设置setMaxResultSize等于大小为100000(缓存行参数)的行,在我的情况下为20971520(20MB)
有关详细信息,请参阅错误:HBASE-13527