You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by "Will-Lo (via GitHub)" <gi...@apache.org> on 2023/04/21 17:24:00 UTC

[GitHub] [gobblin] Will-Lo opened a new pull request, #3683: Add retention job summary events

Will-Lo opened a new pull request, #3683:
URL: https://github.com/apache/gobblin/pull/3683

   Dear Gobblin maintainers,
   
   Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below!
   
   
   ### JIRA
   - [ ] My PR addresses the following [Gobblin JIRA](https://issues.apache.org/jira/browse/GOBBLIN/) issues and references them in the PR title. For example, "[GOBBLIN-XXX] My Gobblin PR"
       - https://issues.apache.org/jira/browse/GOBBLIN-XXX
   
   
   ### Description
   - [ ] Here are some details about my PR, including screenshots (if applicable):
   
   
   ### Tests
   - [ ] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason:
   
   
   ### Commits
   - [ ] My commits all reference JIRA issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
       1. Subject is separated from body by a blank line
       2. Subject is limited to 50 characters
       3. Subject does not end with a period
       4. Subject uses the imperative mood ("add", not "adding")
       5. Body wraps at 72 characters
       6. Body explains "what" and "why", not "how"
   
   


-- 
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: dev-unsubscribe@gobblin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [gobblin] phet commented on a diff in pull request #3683: Add retention job summary events

Posted by "phet (via GitHub)" <gi...@apache.org>.
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: dev-unsubscribe@gobblin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org