Login  Register

[GitHub] [carbondata] vikramahuja1001 commented on a change in pull request #4072: [CARBONDATA-4110] Support clean files dry run operation and show statistics after clean files operation

Posted by GitBox on Feb 19, 2021; 6:42am
URL: http://apache-carbondata-dev-mailing-list-archive.168.s1.nabble.com/GitHub-carbondata-vikramahuja1001-opened-a-new-pull-request-4072-WIP-Clean-files-phase2-tp105322p106342.html


vikramahuja1001 commented on a change in pull request #4072:
URL: https://github.com/apache/carbondata/pull/4072#discussion_r578962180



##########
File path: integration/spark/src/main/scala/org/apache/carbondata/trash/DataTrashManager.scala
##########
@@ -87,13 +108,70 @@ object DataTrashManager {
     }
   }
 
-  private def checkAndCleanTrashFolder(carbonTable: CarbonTable, isForceDelete: Boolean): Unit = {
+  /**
+   * Checks the size of the segment files as well as datafiles, this method is used before and after
+   * clean files operation to check how much space is actually freed, during the operation.
+   */
+  def getSizeScreenshot(carbonTable: CarbonTable): Long = {
+    val segmentPath = CarbonTablePath.getSegmentFilesLocation(carbonTable.getTablePath)
+    var size : Long = 0
+    if (!carbonTable.isHivePartitionTable) {
+      if (carbonTable.getTableInfo.getFactTable.getTableProperties.containsKey(
+          CarbonCommonConstants.FLAT_FOLDER)) {
+        // the size is table size + segment folder size - (metadata folder size + lockFiles size)
+        (FileFactory.getDirectorySize(carbonTable.getTablePath) + FileFactory.getDirectorySize(

Review comment:
       done

##########
File path: integration/spark/src/main/scala/org/apache/spark/sql/secondaryindex/events/CleanFilesPostEventListener.scala
##########
@@ -56,7 +56,6 @@ class CleanFilesPostEventListener extends OperationEventListener with Logging {
           cleanFilesPostEvent.carbonTable,
           cleanFilesPostEvent.options.getOrElse("force", "false").toBoolean,
           cleanFilesPostEvent.options.getOrElse("stale_inprogress", "false").toBoolean)
-

Review comment:
       done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[hidden email]