Hbase batch get and SocketTimeoutException

…衆ロ難τιáo~ 提交于 2021-01-27 13:24:19

问题


I use java and i want to do batch get like this

final List<Get> gets = uids.stream()
                .map(uid -> new Get(toBytes(uid)))
                .collect(Collectors.toList());

Configuration configuration = HBaseConfiguration.create();

conf.set("hbase.zookeeper.quorum", quorum);
conf.set("hbase.zookeeper.property.clientPort", properties.getString("HBASE_CONFIGURATION_ZOOKEEPER_CLIENTPORT"));
conf.set("zookeeper.znode.parent", properties.getString("HBASE_CONFIGURATION_ZOOKEEPER_ZNODE_PARENT"));

HTable table = new HTable(configuration, tableName);
return table.get(gets);

When get list has 10K gets everything is ok.

When i try to do 100K gets in one batch i have exception:

java.lang.RuntimeException: org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException: Failed 100000 actions: SocketTimeoutException: 100000 times, 
Caused by: org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException: Failed 100000 actions: SocketTimeoutException: 100000 times, 
        at org.apache.hadoop.hbase.client.AsyncProcess$BatchErrors.makeException(AsyncProcess.java:203) ~[hbase-query-layer-r575958b.jar:?]
        at org.apache.hadoop.hbase.client.AsyncProcess$BatchErrors.access$500(AsyncProcess.java:187) ~[hbase-query-layer-r575958b.jar:?]
        at org.apache.hadoop.hbase.client.AsyncProcess.getErrors(AsyncProcess.java:922) ~[hbase-query-layer-r575958b.jar:?]
        at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.processBatchCallback(HConnectionManager.java:2402) ~[hbase-query-layer-r575958b.jar:?]
        at org.apache.hadoop.hbase.client.HTable.batchCallback(HTable.java:868) ~[hbase-query-layer-r575958b.jar:?]
        at org.apache.hadoop.hbase.client.HTable.batchCallback(HTable.java:883) ~[hbase-query-layer-r575958b.jar:?]
        at org.apache.hadoop.hbase.client.HTable.batch(HTable.java:858) ~[hbase-query-layer-r575958b.jar:?]
        at org.apache.hadoop.hbase.client.HTable.get(HTable.java:825) ~[hbase-query-layer-r575958b.jar:?]
        at hbase_query_layer.hbase.HbaseConnector.get(HbaseConnector.java:89) ~[hbase-query-layer-r575958b.jar:?]
        ... 15 more

What is wrong?

Also, I saw (in web interface) that request to regionserver (where table is stored) grows (batch size is 100K, after few minutes i saw that request count is 700K and still grows, but only my clien write sth to this table).

Furthermore on hbase regionserver i saw in hbase-hbase-regionserver.out

Exception in thread "RpcServer.handler=25,port=60020" java.lang.StackOverflowError
        at org.apache.hadoop.hbase.CellUtil$1.advance(CellUtil.java:203)
        at org.apache.hadoop.hbase.CellUtil$1.advance(CellUtil.java:203)

How to fix it?


回答1:


I found problem: https://issues.apache.org/jira/browse/HBASE-11813

Unfortunately I have got HBase Version 0.98.0.2.1.1.0-385-hadoop2 so i need to create chunks like:

final List<List<Increment>> batchesToExecute = chopped(increments, conf.getBatchIncrementSize());


static <T> List<List<T>> chopped(List<T> list, final int L) {
    List<List<T>> parts = new ArrayList<>();
    final int N = list.size();
    for (int i = 0; i < N; i += L) {
        parts.add(new ArrayList<>(list.subList(i, Math.min(N, i + L))));
    }
    return parts;
}


来源:https://stackoverflow.com/questions/31310609/hbase-batch-get-and-sockettimeoutexception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!