KYLIN-1579 revise logging
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/b2a38612 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/b2a38612 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/b2a38612 Branch: refs/heads/master Commit: b2a386126e075ac6cc2d15d0c1a42d720abed06a Parents: 71d3f30 Author: Hongbin Ma <mahong...@apache.org> Authored: Tue Apr 12 15:27:45 2016 +0800 Committer: Hongbin Ma <mahong...@apache.org> Committed: Wed Apr 13 11:11:15 2016 +0800 ---------------------------------------------------------------------- .../hbase/cube/v2/CubeHBaseEndpointRPC.java | 23 +++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/b2a38612/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 38041b3..81d5baa 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 @@ -342,28 +342,35 @@ public class CubeHBaseEndpointRPC extends CubeHBaseRPC { builder.setBehavior(toggle); builder.setStartTime(System.currentTimeMillis()); builder.setTimeout(epResultItr.getTimeout()); + String logHeader = "<sub-thread for GTScanRequest " + Integer.toHexString(System.identityHashCode(scanRequest)) + "> "; Map<byte[], CubeVisitProtos.CubeVisitResponse> results; try { results = getResults(builder.build(), conn.getTable(cubeSeg.getStorageLocationIdentifier()), epRange.getFirst(), epRange.getSecond()); } catch (Throwable throwable) { - throw new RuntimeException("<sub-thread for GTScanRequest " + Integer.toHexString(System.identityHashCode(scanRequest)) + "> " + "Error when visiting cubes by endpoint", throwable); + throw new RuntimeException(logHeader + "Error when visiting cubes by endpoint", throwable); } + boolean abnormalFinish = false; for (Map.Entry<byte[], CubeVisitProtos.CubeVisitResponse> result : results.entrySet()) { totalScannedCount.addAndGet(result.getValue().getStats().getScannedRowCount()); - logger.info("<sub-thread for GTScanRequest " + Integer.toHexString(System.identityHashCode(scanRequest)) + "> " + getStatsString(result)); + logger.info(logHeader + getStatsString(result)); if (result.getValue().getStats().getNormalComplete() != 1) { - throw new RuntimeException("The coprocessor thread stopped itself due to scan timeout."); + abnormalFinish = true; } - - try { - epResultItr.append(CompressionUtils.decompress(HBaseZeroCopyByteString.zeroCopyGetBytes(result.getValue().getCompressedRows()))); - } catch (IOException | DataFormatException e) { - throw new RuntimeException("Error when decompressing", e); + else { + try { + epResultItr.append(CompressionUtils.decompress(HBaseZeroCopyByteString.zeroCopyGetBytes(result.getValue().getCompressedRows()))); + } catch (IOException | DataFormatException e) { + throw new RuntimeException(logHeader + "Error when decompressing", e); + } } } + + if (abnormalFinish) { + throw new RuntimeException(logHeader + "The coprocessor thread stopped itself due to scan timeout, failing current query..."); + } } }); }