[ 
https://issues.apache.org/jira/browse/GOBBLIN-1223?focusedWorklogId=464383&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-464383
 ]

ASF GitHub Bot logged work on GOBBLIN-1223:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Jul/20 07:35
            Start Date: 30/Jul/20 07:35
    Worklog Time Spent: 10m 
      Work Description: ZihanLi58 commented on a change in pull request #3071:
URL: https://github.com/apache/incubator-gobblin/pull/3071#discussion_r462690694



##########
File path: 
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/InputRecordCountHelper.java
##########
@@ -123,7 +125,8 @@ public void saveState (Path dir, State state) throws 
IOException {
     saveState(this.fs, dir, state);
   }
 
-  private static void saveState (FileSystem fs, Path dir, State state) throws 
IOException {
+  @VisibleForTesting

Review comment:
       It's because test class and InputRecordCountHelper are not in the same 
package

##########
File path: 
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/CompactionTimeRangeVerifier.java
##########
@@ -73,10 +75,28 @@ public Result verify (FileSystemDataset dataset) {
       Period minTimeAgo = formatter.parsePeriod(minTimeAgoStr);
       latest = compactionStartTime.minus(minTimeAgo);
 
+      // get latest last run start time, we want to limit the duration between 
two compaction for the same dataset
+      if 
(state.contains(TimeBasedSubDirDatasetsFinder.MIN_RECOMPACTION_DURATION)) {
+        String minDurationStrList = 
this.state.getProp(TimeBasedSubDirDatasetsFinder.MIN_RECOMPACTION_DURATION);
+        String minDurationStr = getMachedLookbackTime(datasetName, 
minDurationStrList, 
TimeBasedSubDirDatasetsFinder.DEFAULT_MIN_RECOMPACTION_DURATION);
+        Period minDurationTime = formatter.parsePeriod(minDurationStr);
+        DateTime latestLastRunTime = 
compactionStartTime.minus(minDurationTime);
+        InputRecordCountHelper helper = new InputRecordCountHelper(state);
+        State compactState = helper.loadState(new 
Path(result.getDstAbsoluteDir()));
+        if (compactState.contains(CompactionSlaEventHelper.LAST_RUN_START_TIME)
+            && 
compactState.getPropAsLong(CompactionSlaEventHelper.LAST_RUN_START_TIME) > 
latestLastRunTime.getMillis()) {
+          log.warn("Last compaction for {} is {}, not before {}", 
dataset.datasetRoot(), new 
DateTime(compactState.getPropAsLong(CompactionSlaEventHelper.LAST_RUN_START_TIME),
 timeZone), latestLastRunTime);
+          return new Result(false, "Last compaction for " + 
dataset.datasetRoot() + " is not before" + latestLastRunTime);
+        }
+
+      }
+
       if (earliest.isBefore(folderTime) && latest.isAfter(folderTime)) {
         log.debug("{} falls in the user defined time range", 
dataset.datasetRoot());
         return new Result(true, "");
       }
+    } catch (RuntimeException e) {

Review comment:
       It's due to the findBugsMain, seems we catch exception and not throw it 
intentionally, I will change the rule to pass it.




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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 464383)
    Time Spent: 50m  (was: 40m)

> Change the criteria for re-compaction, limit the time for re-compaction
> -----------------------------------------------------------------------
>
>                 Key: GOBBLIN-1223
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1223
>             Project: Apache Gobblin
>          Issue Type: Task
>            Reporter: Zihan Li
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to