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



##########
File path: 
core/src/main/java/org/apache/carbondata/core/util/CarbonProperties.java
##########
@@ -2086,6 +2087,41 @@ public int getMaxSIRepairLimit(String dbName, String 
tableName) {
     return Math.abs(Integer.parseInt(thresholdValue));
   }
 
+  /**
+   * The below method returns the time(in milliseconds) for which timestamp 
folder retention in
+   * trash folder will take place.
+   */
+  public long getTrashFolderRetentionTime() {
+    String propertyValue = 
getProperty(CarbonCommonConstants.CARBON_TRASH_RETENTION_DAYS, Integer
+        .toString(CarbonCommonConstants.CARBON_TRASH_RETENTION_DAYS_DEFAULT));
+    int configuredValue = 0;
+    try {
+      configuredValue = Integer.parseInt(propertyValue);
+      if (configuredValue < 0 || configuredValue > CarbonCommonConstants
+          .CARBON_TRASH_RETENTION_DAYS_MAXIMUM) {
+        LOGGER.warn("Value of " + 
CarbonCommonConstants.CARBON_TRASH_RETENTION_DAYS + " is" +
+            " invalid, taking default value instead");
+        configuredValue = 
CarbonCommonConstants.CARBON_TRASH_RETENTION_DAYS_DEFAULT;
+      }
+    } catch (NumberFormatException e) {
+      LOGGER.error("Invalid value configured for " + CarbonCommonConstants
+          .CARBON_TRASH_RETENTION_DAYS + ", considering the default value");
+      configuredValue = 
CarbonCommonConstants.CARBON_TRASH_RETENTION_DAYS_DEFAULT;
+    }
+    long milliSecondsInADay = TimeUnit.DAYS.toMillis(1);
+    return (long) configuredValue * milliSecondsInADay;
+  }

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:
us...@infra.apache.org


Reply via email to