Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 97830200BCA for ; Mon, 7 Nov 2016 03:15:47 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 96145160AFC; Mon, 7 Nov 2016 02:15:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B799A160B0D for ; Mon, 7 Nov 2016 03:15:46 +0100 (CET) Received: (qmail 10221 invoked by uid 500); 7 Nov 2016 02:15:45 -0000 Mailing-List: contact commits-help@carbondata.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@carbondata.incubator.apache.org Delivered-To: mailing list commits@carbondata.incubator.apache.org Received: (qmail 10212 invoked by uid 99); 7 Nov 2016 02:15:45 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Nov 2016 02:15:45 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 812211A94F6 for ; Mon, 7 Nov 2016 02:15:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id SuP3y_bb0_uc for ; Mon, 7 Nov 2016 02:15:43 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id B972E5FAE5 for ; Mon, 7 Nov 2016 02:15:42 +0000 (UTC) Received: (qmail 10042 invoked by uid 99); 7 Nov 2016 02:15:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Nov 2016 02:15:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A86FBF16B4; Mon, 7 Nov 2016 02:15:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ravipesala@apache.org To: commits@carbondata.incubator.apache.org Date: Mon, 07 Nov 2016 02:15:41 -0000 Message-Id: <070225f1754849b5bbd2896960675601@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-carbondata git commit: fixed block loading issue in case of blocklet distribution archived-at: Mon, 07 Nov 2016 02:15:47 -0000 Repository: incubator-carbondata Updated Branches: refs/heads/master ed3810aa4 -> d2041356d fixed block loading issue in case of blocklet distribution Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/041dab09 Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/041dab09 Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/041dab09 Branch: refs/heads/master Commit: 041dab09f09c31aae95f1de954a7261bde53830c Parents: ed3810a Author: kumarvishal Authored: Wed Nov 2 22:32:42 2016 +0530 Committer: ravipesala Committed: Mon Nov 7 07:44:05 2016 +0530 ---------------------------------------------------------------------- .../core/carbon/datastore/BlockIndexStore.java | 25 ++++++++++++++------ .../core/carbon/datastore/block/BlockInfo.java | 2 +- .../core/constants/CarbonCommonConstants.java | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/041dab09/core/src/main/java/org/apache/carbondata/core/carbon/datastore/BlockIndexStore.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/BlockIndexStore.java b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/BlockIndexStore.java index bbebda0..34c2983 100644 --- a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/BlockIndexStore.java +++ b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/BlockIndexStore.java @@ -80,6 +80,13 @@ public class BlockIndexStore { */ private Map tableLockMap; + /** + * block info to future task mapping + * useful when blocklet distribution is enabled and + * same block is loaded by multiple thread + */ + private Map> mapOfBlockInfoToFuture; + private BlockIndexStore() { tableBlocksMap = new ConcurrentHashMap>( CarbonCommonConstants.DEFAULT_COLLECTION_SIZE); @@ -87,6 +94,7 @@ public class BlockIndexStore { CarbonCommonConstants.DEFAULT_COLLECTION_SIZE); blockInfoLock = new ConcurrentHashMap(); segmentIdToBlockListMap = new ConcurrentHashMap<>(); + mapOfBlockInfoToFuture = new ConcurrentHashMap<>(); } /** @@ -137,7 +145,6 @@ public class BlockIndexStore { blockInfosNeedToLoad = fillSegmentIdToTableInfoMap(tableBlocksInfos, absoluteTableIdentifier); } AbstractIndex tableBlock = null; - List> blocksList = new ArrayList>(); int counter = -1; for (BlockInfo blockInfo : blockInfosNeedToLoad) { counter++; @@ -173,7 +180,12 @@ public class BlockIndexStore { tableBlock = tableBlockMapTemp.get(blockInfo); // if still block is not present then load the block if (null == tableBlock) { - blocksList.add(executor.submit(new BlockLoaderThread(blockInfo, tableBlockMapTemp))); + if (null == mapOfBlockInfoToFuture.get(blockInfo)) { + mapOfBlockInfoToFuture.put(blockInfo, executor + .submit(new BlockLoaderThread(blockInfo, tableBlockMapTemp))); + } + } else { + loadedBlock[counter] = tableBlock; } } } else { @@ -190,7 +202,7 @@ public class BlockIndexStore { throw new IndexBuilderException(e); } // fill the block which were not loaded before to loaded blocks array - fillLoadedBlocks(loadedBlock, blocksList); + fillLoadedBlocks(loadedBlock, blockInfosNeedToLoad); return Arrays.asList(loadedBlock); } @@ -234,13 +246,12 @@ public class BlockIndexStore { * @param blocksList blocks loaded in thread * @throws IndexBuilderException in case of any failure */ - private void fillLoadedBlocks(AbstractIndex[] loadedBlockArray, - List> blocksList) throws IndexBuilderException { - int blockCounter = 0; + private void fillLoadedBlocks(AbstractIndex[] loadedBlockArray, List blockInfos) + throws IndexBuilderException { for (int i = 0; i < loadedBlockArray.length; i++) { if (null == loadedBlockArray[i]) { try { - loadedBlockArray[i] = blocksList.get(blockCounter++).get(); + loadedBlockArray[i] = mapOfBlockInfoToFuture.get(blockInfos.get(i)).get(); } catch (InterruptedException | ExecutionException e) { throw new IndexBuilderException(e); } http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/041dab09/core/src/main/java/org/apache/carbondata/core/carbon/datastore/block/BlockInfo.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/block/BlockInfo.java b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/block/BlockInfo.java index 8092c7c..96879aa 100644 --- a/core/src/main/java/org/apache/carbondata/core/carbon/datastore/block/BlockInfo.java +++ b/core/src/main/java/org/apache/carbondata/core/carbon/datastore/block/BlockInfo.java @@ -91,7 +91,7 @@ public class BlockInfo { if (info.getBlockOffset() != other.info.getBlockOffset()) { return false; } - if (info.getBlockLength() != info.getBlockLength()) { + if (info.getBlockLength() != other.info.getBlockLength()) { return false; } http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/041dab09/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java b/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java index 997f412..e217d5d 100644 --- a/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java +++ b/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java @@ -882,7 +882,7 @@ public final class CarbonCommonConstants { /** * to enable blocklet distribution default value */ - public static String ENABLE_BLOCKLET_DISTRIBUTION_DEFAULTVALUE = "true"; + public static String ENABLE_BLOCKLET_DISTRIBUTION_DEFAULTVALUE = "false"; /** * This batch size is used to send rows from load step to another step in batches.