测试就是这样啊,帮忙看下啊
HTableInterface table = null;
HTablePool htp = new HTablePool(conf,10);
table = htp.getTable("test12");
table.setAutoFlush(false);
List<Put> list = new ArrayList<Put>();
for (int i=0;i<1000000000;i++){
UUID uuid = UUID.randomUUID();
Put put = new Put(Bytes.toBytes(uuid.toString()));
put.add(Bytes.toBytes("f1"), Bytes.toBytes("k1"), Bytes.toBytes("mary"));
//table.put(put);
list.add(put);
//table.put(list);
// table.flushCommits();
if(i%100000 == 0)
{
table.put(list);
list.clear();
table.flushCommits();
//list.clear();
}
}
table.put(list);
table.flushCommits();
htp.close();
|