fix htable threadsafe potential issue
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/4617e0a4 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/4617e0a4 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/4617e0a4 Branch: refs/heads/KYLIN-1122 Commit: 4617e0a4783a17007758fed7fb627530ede54518 Parents: 5d35f97 Author: honma <ho...@ebay.com> Authored: Thu Jan 14 15:17:05 2016 +0800 Committer: Xiaoyu Wang <wangxia...@apache.org> Committed: Mon Jan 18 13:38:30 2016 +0800 ---------------------------------------------------------------------- .../kylin/storage/hbase/cube/v2/CubeHBaseEndpointRPC.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/4617e0a4/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/CubeHBaseEndpointRPC.java ---------------------------------------------------------------------- diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/CubeHBaseEndpointRPC.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/CubeHBaseEndpointRPC.java index 1881a23..5cca195 100644 --- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/CubeHBaseEndpointRPC.java +++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/CubeHBaseEndpointRPC.java @@ -34,6 +34,7 @@ import java.util.zip.DataFormatException; import javax.annotation.Nullable; import org.apache.commons.lang.NotImplementedException; +import org.apache.hadoop.hbase.client.HConnection; import org.apache.hadoop.hbase.client.HTableInterface; import org.apache.hadoop.hbase.client.coprocessor.Batch; import org.apache.hadoop.hbase.ipc.BlockingRpcCallback; @@ -217,7 +218,7 @@ public class CubeHBaseEndpointRPC extends CubeHBaseRPC { final ImmutableBitSet selectedColBlocks = scanRequests.get(0).getSelectedColBlocks().set(0); // globally shared connection, does not require close - final HTableInterface hbaseTable = HBaseConnection.get(cubeSeg.getCubeInstance().getConfig().getStorageUrl()).getTable(cubeSeg.getStorageLocationIdentifier()); + final HConnection conn = HBaseConnection.get(cubeSeg.getCubeInstance().getConfig().getStorageUrl()); final List<IntList> hbaseColumnsToGTIntList = Lists.newArrayList(); List<List<Integer>> hbaseColumnsToGT = getHBaseColumnsGTMapping(selectedColBlocks); @@ -269,7 +270,7 @@ public class CubeHBaseEndpointRPC extends CubeHBaseRPC { Map<byte[], CubeVisitProtos.CubeVisitResponse> results; try { - results = getResults(builder.build(), hbaseTable, epRange.getFirst(), epRange.getSecond()); + results = getResults(builder.build(), conn.getTable(cubeSeg.getStorageLocationIdentifier()), epRange.getFirst(), epRange.getSecond()); } catch (Throwable throwable) { throw new RuntimeException("Error when visiting cubes by endpoint:", throwable); }