[GitHub] carbondata pull request #978: [CARBONDATA-1109] Acquire semaphore before sub...

2017-06-02 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/carbondata/pull/978


---
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.
---


[GitHub] carbondata pull request #978: [CARBONDATA-1109] Acquire semaphore before sub...

2017-06-01 Thread manishgupta88
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 rowsPlease 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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---