phet commented on code in PR #3683:
URL: https://github.com/apache/gobblin/pull/3683#discussion_r1178715485


##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/retention/DatasetCleaner.java:
##########
@@ -164,9 +171,11 @@ public void onFailure(Throwable throwable) {
         }
 
         @Override
-        public void onSuccess(Void arg0) {
+        public void onSuccess(Integer datasetsDeleted) {
           DatasetCleaner.this.finishCleanSignal.get().countDown();
-          LOG.info("Successfully cleaned: " + dataset.datasetURN());
+          DatasetRetentionSummary summary = new 
DatasetRetentionSummary(dataset.datasetURN(), datasetsDeleted, true);

Review Comment:
   is it certain we'd only ever overwrite the summary, rather than potentially 
needing to add this new count to whatever accumulating sum was already tracked 
for the same dataset URN?



##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/retention/version/DatasetRetentionSummary.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.retention.version;
+
+import lombok.Data;
+
+
+/**
+ * Aggregates information from {@link 
org.apache.gobblin.data.management.retention.DatasetCleaner} to
+ * track the number of versions selected for deletion for a dataset.
+ */
+@Data
+public class DatasetRetentionSummary {
+  private final String datasetUrn;
+  private final int versionsSelectedForDeletion;
+  private final boolean successfullyDeleted;

Review Comment:
   in the impl, it appeared that `versionsSelectedForDeletion` is truly the 
total number successfully deleted.  e.g. is there any way that the number 
selected might not equal a *non-zero* number successfully deleted?
   
   if not, I suggest renaming to `versionsDeleted` and reversing the boolean to 
`hadExecutionFailure`. the latter of course discerns between 0 found to delete 
and >0 found, but none actually successful.  calling out a tad more explicitly 
in javadoc seems worthwhile



##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/retention/dataset/CleanableDataset.java:
##########
@@ -28,10 +29,11 @@
 public interface CleanableDataset extends Dataset {
 
   /**
-   * Cleans the {@link CleanableDataset}. In general, this means to apply a
+   * Cleans the {@link CleanableDataset}.
+   * Returns the number of versions marked for deletion
    * {@link 
org.apache.gobblin.data.management.retention.policy.RetentionPolicy} and delete 
files and directories that need deleting.

Review Comment:
   looks like new line 33 cut in mid-sentence to the prior javadoc.
   
   also, prefer a `@return` tag



##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/retention/RetentionEvents.java:
##########
@@ -34,6 +35,12 @@ static class CleanFailed {
      */
     static final String FAILURE_CONTEXT_METADATA_KEY = "failureContext";
   }
+
+  static class RetentionJobSummary {

Review Comment:
   nit: `RetentionEvents.JobSummary` would avoid redundant `Retention`



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to