[GitHub] incubator-carbondata pull request #156: [CARBONDATA-244] Load and delete seg...

2016-09-17 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/incubator-carbondata/pull/156


---
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] incubator-carbondata pull request #156: [CARBONDATA-244] Load and delete seg...

2016-09-17 Thread sujith71955
Github user sujith71955 commented on a diff in the pull request:

https://github.com/apache/incubator-carbondata/pull/156#discussion_r79291710
  
--- Diff: 
processing/src/main/java/org/apache/carbondata/lcm/status/SegmentStatusManager.java
 ---
@@ -287,12 +307,18 @@ private Integer compareDateValues(Long loadValue, 
Long userValue) {
 }
 
   } else {
-LOG.error("Unable to acquire the metadata lock");
+String errorMsg = "Delete segment by id is failed for " + 
tableDetails
++ ". Not able to acquire the delete segment lock due to other 
operation running "
--- End diff --

LGTM


---
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] incubator-carbondata pull request #156: [CARBONDATA-244] Load and delete seg...

2016-09-17 Thread sujith71955
Github user sujith71955 commented on a diff in the pull request:

https://github.com/apache/incubator-carbondata/pull/156#discussion_r79291381
  
--- Diff: 
processing/src/main/java/org/apache/carbondata/lcm/status/SegmentStatusManager.java
 ---
@@ -287,12 +307,18 @@ private Integer compareDateValues(Long loadValue, 
Long userValue) {
 }
 
   } else {
-LOG.error("Unable to acquire the metadata lock");
+String errorMsg = "Delete segment by id is failed for " + 
tableDetails
++ ". Not able to acquire the delete segment lock due to other 
operation running "
--- End diff --

update message, provide operation name


---
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] incubator-carbondata pull request #156: [CARBONDATA-244] Load and delete seg...

2016-09-17 Thread sujith71955
Github user sujith71955 commented on a diff in the pull request:

https://github.com/apache/incubator-carbondata/pull/156#discussion_r79291346
  
--- Diff: 
processing/src/main/java/org/apache/carbondata/lcm/locks/LockUsage.java ---
@@ -28,5 +28,7 @@
   public static String COMPACTION_LOCK = "compaction.lock";
   public static String SYSTEMLEVEL_COMPACTION_LOCK = 
"system_level_compaction.lock";
   public static String TABLE_STATUS_LOCK = "tablestatus.lock";
+  public static String DELETE_SEGMENT_LOCK = "delete_segment.lock";
--- End diff --

make it final/use enum


---
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] incubator-carbondata pull request #156: [CARBONDATA-244] Load and delete seg...

2016-09-17 Thread akashrn5
Github user akashrn5 commented on a diff in the pull request:

https://github.com/apache/incubator-carbondata/pull/156#discussion_r79291255
  
--- Diff: 
integration/spark/src/main/scala/org/apache/carbondata/spark/rdd/CarbonDataRDDFactory.scala
 ---
@@ -,25 +1131,32 @@ object CarbonDataRDDFactory extends Logging {
 val table = 
org.apache.carbondata.core.carbon.metadata.CarbonMetadata.getInstance
   .getCarbonTable(carbonLoadModel.getDatabaseName + "_" + 
carbonLoadModel.getTableName)
 val metaDataPath: String = table.getMetaDataFilepath
-val carbonLock = CarbonLockFactory
+val carbonCleanFilesLock = CarbonLockFactory
   
.getCarbonLockObj(table.getAbsoluteTableIdentifier.getCarbonTableIdentifier,
-LockUsage.METADATA_LOCK
+LockUsage.CLEAN_FILES_LOCK
   )
 try {
-  if (carbonLock.lockWithRetries()) {
+  if (carbonCleanFilesLock.lockWithRetries()) {
+logger.info("Clean files lock has been successfully acquired.")
 deleteLoadsAndUpdateMetadata(carbonLoadModel,
   table,
   partitioner,
   hdfsStoreLocation,
   isForceDeletion = true)
   }
+  else {
+val errorMsg = "Clean files request is failed for " + 
carbonLoadModel.getDatabaseName +
--- End diff --

 "Clean file request is running in the background, please try after some 
time". u[date the comment since already we know the operation


---
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] incubator-carbondata pull request #156: [CARBONDATA-244] Load and delete seg...

2016-09-16 Thread ManoharVanam
Github user ManoharVanam commented on a diff in the pull request:

https://github.com/apache/incubator-carbondata/pull/156#discussion_r79222066
  
--- Diff: 
processing/src/main/java/org/apache/carbondata/lcm/status/SegmentStatusManager.java
 ---
@@ -306,13 +330,18 @@ private Integer compareDateValues(Long loadValue, 
Long userValue) {
* @return
*/
   public List updateDeletionStatus(String loadDate, String 
tableFolderPath,
-  Long loadStartTime) {
-ICarbonLock carbonLock = CarbonLockFactory
-
.getCarbonLockObj(absoluteTableIdentifier.getCarbonTableIdentifier(),
-LockUsage.METADATA_LOCK);
+  Long loadStartTime) throws Exception {
+CarbonTableIdentifier carbonTableIdentifier =
+absoluteTableIdentifier.getCarbonTableIdentifier();
+ICarbonLock carbonMetadataLock =
+CarbonLockFactory.getCarbonLockObj(carbonTableIdentifier, 
LockUsage.METADATA_LOCK);
+ICarbonLock carbonTableStatusLock =
+CarbonLockFactory.getCarbonLockObj(carbonTableIdentifier, 
LockUsage.TABLE_STATUS_LOCK);
+String tableDetails =
+carbonTableIdentifier.getDatabaseName() + "." + 
carbonTableIdentifier.getTableName();
 List invalidLoadTimestamps = new ArrayList(0);
 try {
-  if (carbonLock.lockWithRetries()) {
+  if (carbonMetadataLock.lockWithRetries()) {
--- End diff --

ok


---
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] incubator-carbondata pull request #156: [CARBONDATA-244] Load and delete seg...

2016-09-16 Thread ManoharVanam
Github user ManoharVanam commented on a diff in the pull request:

https://github.com/apache/incubator-carbondata/pull/156#discussion_r79217913
  
--- Diff: 
integration/spark/src/main/scala/org/apache/carbondata/spark/rdd/CarbonDataRDDFactory.scala
 ---
@@ -1077,19 +1077,38 @@ object CarbonDataRDDFactory extends Logging {
   val segmentStatusManager = new 
SegmentStatusManager(table.getAbsoluteTableIdentifier)
   val details = segmentStatusManager
 .readLoadMetadata(loadMetadataFilePath)
+  val carbonTableStatusLock = CarbonLockFactory
+
.getCarbonLockObj(table.getAbsoluteTableIdentifier.getCarbonTableIdentifier,
+  LockUsage.TABLE_STATUS_LOCK)
 
   // Delete marked loads
   val isUpdationRequired = DeleteLoadFolders
 .deleteLoadFoldersFromFileSystem(carbonLoadModel, 
hdfsStoreLocation,
   partitioner.partitionCount, isForceDeletion, details)
 
   if (isUpdationRequired) {
+try {
 // Update load metadate file after cleaning deleted nodes
-CarbonLoaderUtil.writeLoadMetadata(
-  carbonLoadModel.getCarbonDataLoadSchema,
-  carbonLoadModel.getDatabaseName,
-  carbonLoadModel.getTableName, details.toList.asJava
-)
+if (carbonTableStatusLock.lockWithRetries()) {
+  logger.info("Table status lock has been successfully acquired.")
+  CarbonLoaderUtil.writeLoadMetadata(
+carbonLoadModel.getCarbonDataLoadSchema,
+carbonLoadModel.getDatabaseName,
+carbonLoadModel.getTableName, details.toList.asJava
+  )
+}
+else {
+  val errorMsg = "Clean files request is failed for " + 
carbonLoadModel.getDatabaseName +
+ "." + carbonLoadModel.getTableName +
+ ". Not able to acquire the table status lock."
--- End diff --

ok


---
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] incubator-carbondata pull request #156: [CARBONDATA-244] Load and delete seg...

2016-09-16 Thread sujith71955
Github user sujith71955 commented on a diff in the pull request:

https://github.com/apache/incubator-carbondata/pull/156#discussion_r79204842
  
--- Diff: 
processing/src/main/java/org/apache/carbondata/lcm/status/SegmentStatusManager.java
 ---
@@ -306,13 +330,18 @@ private Integer compareDateValues(Long loadValue, 
Long userValue) {
* @return
*/
   public List updateDeletionStatus(String loadDate, String 
tableFolderPath,
-  Long loadStartTime) {
-ICarbonLock carbonLock = CarbonLockFactory
-
.getCarbonLockObj(absoluteTableIdentifier.getCarbonTableIdentifier(),
-LockUsage.METADATA_LOCK);
+  Long loadStartTime) throws Exception {
+CarbonTableIdentifier carbonTableIdentifier =
+absoluteTableIdentifier.getCarbonTableIdentifier();
+ICarbonLock carbonMetadataLock =
+CarbonLockFactory.getCarbonLockObj(carbonTableIdentifier, 
LockUsage.METADATA_LOCK);
+ICarbonLock carbonTableStatusLock =
+CarbonLockFactory.getCarbonLockObj(carbonTableIdentifier, 
LockUsage.TABLE_STATUS_LOCK);
+String tableDetails =
+carbonTableIdentifier.getDatabaseName() + "." + 
carbonTableIdentifier.getTableName();
 List invalidLoadTimestamps = new ArrayList(0);
 try {
-  if (carbonLock.lockWithRetries()) {
+  if (carbonMetadataLock.lockWithRetries()) {
--- End diff --

make it as operational log


---
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] incubator-carbondata pull request #156: [CARBONDATA-244] Load and delete seg...

2016-09-16 Thread sujith71955
Github user sujith71955 commented on a diff in the pull request:

https://github.com/apache/incubator-carbondata/pull/156#discussion_r79187047
  
--- Diff: 
integration/spark/src/main/scala/org/apache/carbondata/spark/rdd/CarbonDataRDDFactory.scala
 ---
@@ -1077,19 +1077,38 @@ object CarbonDataRDDFactory extends Logging {
   val segmentStatusManager = new 
SegmentStatusManager(table.getAbsoluteTableIdentifier)
   val details = segmentStatusManager
 .readLoadMetadata(loadMetadataFilePath)
+  val carbonTableStatusLock = CarbonLockFactory
+
.getCarbonLockObj(table.getAbsoluteTableIdentifier.getCarbonTableIdentifier,
+  LockUsage.TABLE_STATUS_LOCK)
 
   // Delete marked loads
   val isUpdationRequired = DeleteLoadFolders
 .deleteLoadFoldersFromFileSystem(carbonLoadModel, 
hdfsStoreLocation,
   partitioner.partitionCount, isForceDeletion, details)
 
   if (isUpdationRequired) {
+try {
 // Update load metadate file after cleaning deleted nodes
-CarbonLoaderUtil.writeLoadMetadata(
-  carbonLoadModel.getCarbonDataLoadSchema,
-  carbonLoadModel.getDatabaseName,
-  carbonLoadModel.getTableName, details.toList.asJava
-)
+if (carbonTableStatusLock.lockWithRetries()) {
+  logger.info("Table status lock has been successfully acquired.")
+  CarbonLoaderUtil.writeLoadMetadata(
+carbonLoadModel.getCarbonDataLoadSchema,
+carbonLoadModel.getDatabaseName,
+carbonLoadModel.getTableName, details.toList.asJava
+  )
+}
+else {
+  val errorMsg = "Clean files request is failed for " + 
carbonLoadModel.getDatabaseName +
+ "." + carbonLoadModel.getTableName +
+ ". Not able to acquire the table status lock."
--- End diff --

also mention that "due to  other operation running in the  background ", 
this message will give more clear picture to user about the task failure


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