Github user manishgupta88 commented on a diff in the pull request: https://github.com/apache/incubator-carbondata/pull/454#discussion_r94295193 --- Diff: core/src/main/java/org/apache/carbondata/core/carbon/datastore/BlockIndexStore.java --- @@ -244,124 +222,96 @@ public static BlockIndexStore getInstance() { * * @param loadedBlockArray array of blocks which will be filled * @param blocksList blocks loaded in thread - * @throws IndexBuilderException in case of any failure + * @throws CarbonUtilException in case of any failure */ - private void fillLoadedBlocks(AbstractIndex[] loadedBlockArray, List<BlockInfo> blockInfos) - throws IndexBuilderException { + private void fillLoadedBlocks(AbstractIndex[] loadedBlockArray, + List<Future<AbstractIndex>> blocksList) throws CarbonUtilException { + int blockCounter = 0; + boolean exceptionOccurred = false; + Throwable exceptionRef = null; for (int i = 0; i < loadedBlockArray.length; i++) { - if (null == loadedBlockArray[i]) { - try { - loadedBlockArray[i] = mapOfBlockInfoToFuture.get(blockInfos.get(i)).get(); - } catch (InterruptedException | ExecutionException e) { - throw new IndexBuilderException(e); - } + try { + loadedBlockArray[i] = blocksList.get(blockCounter++).get(); + } catch (Throwable e) { --- End diff -- @kumarvishal09 @mohammadshahidkhan ...throwable has been added here because get method of FutureTask class can even thrown unchecked exceptions (like CancellationException) apart from the checked exception (ExecutionException and InterruptedException) listed by get() API. In case of any failure we need to decrement the access count else access count will never be decremented for successfully loaded blocks and they will always remain in memory.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---