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 8882D200CA9 for ; Fri, 2 Jun 2017 07:44:02 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8705A160BDF; Fri, 2 Jun 2017 05:44:02 +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 CD912160BC4 for ; Fri, 2 Jun 2017 07:44:01 +0200 (CEST) Received: (qmail 3050 invoked by uid 500); 2 Jun 2017 05:44:00 -0000 Mailing-List: contact issues-help@carbondata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@carbondata.apache.org Delivered-To: mailing list issues@carbondata.apache.org Received: (qmail 3041 invoked by uid 99); 2 Jun 2017 05:44:00 -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; Fri, 02 Jun 2017 05:44:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B5E05DF9F8; Fri, 2 Jun 2017 05:44:00 +0000 (UTC) From: manishgupta88 To: issues@carbondata.apache.org Reply-To: issues@carbondata.apache.org References: In-Reply-To: Subject: [GitHub] carbondata pull request #978: [CARBONDATA-1109] Acquire semaphore before sub... Content-Type: text/plain Message-Id: <20170602054400.B5E05DF9F8@git1-us-west.apache.org> Date: Fri, 2 Jun 2017 05:44:00 +0000 (UTC) archived-at: Fri, 02 Jun 2017 05:44:02 -0000 Github user manishgupta88 commented on a diff in the pull request: https://github.com/apache/carbondata/pull/978#discussion_r119785140 --- Diff: processing/src/main/java/org/apache/carbondata/processing/store/CarbonFactDataHandlerColumnar.java --- @@ -488,13 +488,19 @@ private NodeHolder processDataRows(List dataRows) public void finish() throws CarbonDataWriterException { // still some data is present in stores if entryCount is more // than 0 - producerExecutorServiceTaskList.add(producerExecutorService - .submit(new Producer(blockletDataHolder, dataRows, ++writerTaskSequenceCounter, true))); - blockletProcessingCount.incrementAndGet(); - processedDataCount += entryCount; - closeWriterExecutionService(producerExecutorService); - processWriteTaskSubmitList(producerExecutorServiceTaskList); - processingComplete = true; + try { + semaphore.acquire(); --- End diff -- @watermen .....here a check is required for entryCount > 0.....because we need to acquire a semaphore lock only if total number of rows in raw data are not exactly divisible by page size...in this case only we will have some extra rows to be process by finish method else addDataToStore method will handle all the rows....Please refer the below code snippet.... public void finish() throws CarbonDataWriterException { // still some data is present in stores if entryCount is more // than 0 if (this.entryCount > 0) { try { semaphore.acquire(); producerExecutorServiceTaskList.add(producerExecutorService .submit(new Producer(blockletDataHolder, dataRows, ++writerTaskSequenceCounter, true))); blockletProcessingCount.incrementAndGet(); processedDataCount += entryCount; } catch (InterruptedException e) { LOGGER.error(e, e.getMessage()); throw new CarbonDataWriterException(e.getMessage(), e); } } closeWriterExecutionService(producerExecutorService); processWriteTaskSubmitList(producerExecutorServiceTaskList); processingComplete = true; --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. ---