You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2022/09/23 04:14:49 UTC

[GitHub] [gobblin] AndyJiang99 opened a new pull request, #3568: [GOBBLIN-1714] Prevent silent failure of data copy if files don't exist in source

AndyJiang99 opened a new pull request, #3568:
URL: https://github.com/apache/gobblin/pull/3568

   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-1714
   
   
   ### Description
   - [ ] Here are some details about my PR, including screenshots (if applicable):
   - [ ] 
   - [ ] Throws exception if no files found in source for data copy
   - [ ] Doesn't throw exception if no files found in target for data copy as the files will be created
   
   
   ### Tests
   - [ ] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason:
   - [ ] All current tests pass
   
   
   ### 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] codecov-commenter commented on pull request #3568: [GOBBLIN-1714] Prevent silent failure of data copy if files don't exist in source

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3568:
URL: https://github.com/apache/gobblin/pull/3568#issuecomment-1255790528

   # [Codecov](https://codecov.io/gh/apache/gobblin/pull/3568?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3568](https://codecov.io/gh/apache/gobblin/pull/3568?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f44bfd9) into [master](https://codecov.io/gh/apache/gobblin/commit/78484e23f0b5cdc5098f7438c22705db425140d2?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (78484e2) will **increase** coverage by `3.49%`.
   > The diff coverage is `40.00%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3568      +/-   ##
   ============================================
   + Coverage     46.93%   50.42%   +3.49%     
   + Complexity    10580     5743    -4837     
   ============================================
     Files          2105     1059    -1046     
     Lines         82149    40129   -42020     
     Branches       9147     4496    -4651     
   ============================================
   - Hits          38558    20237   -18321     
   + Misses        40050    18132   -21918     
   + Partials       3541     1760    -1781     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/gobblin/pull/3568?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...gement/copy/TimeAwareRecursiveCopyableDataset.java](https://codecov.io/gh/apache/gobblin/pull/3568/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvVGltZUF3YXJlUmVjdXJzaXZlQ29weWFibGVEYXRhc2V0LmphdmE=) | `84.37% <ø> (ø)` | |
   | [...nt/copy/UnixTimestampRecursiveCopyableDataset.java](https://codecov.io/gh/apache/gobblin/pull/3568/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvVW5peFRpbWVzdGFtcFJlY3Vyc2l2ZUNvcHlhYmxlRGF0YXNldC5qYXZh) | `0.00% <ø> (ø)` | |
   | [...data/management/copy/RecursiveCopyableDataset.java](https://codecov.io/gh/apache/gobblin/pull/3568/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvUmVjdXJzaXZlQ29weWFibGVEYXRhc2V0LmphdmE=) | `85.39% <40.00%> (-0.98%)` | :arrow_down: |
   | [...blin/data/management/copy/RecursivePathFinder.java](https://codecov.io/gh/apache/gobblin/pull/3568/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvUmVjdXJzaXZlUGF0aEZpbmRlci5qYXZh) | `0.00% <0.00%> (-92.86%)` | :arrow_down: |
   | [...data/management/copy/extractor/EmptyExtractor.java](https://codecov.io/gh/apache/gobblin/pull/3568/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvZXh0cmFjdG9yL0VtcHR5RXh0cmFjdG9yLmphdmE=) | `0.00% <0.00%> (-83.34%)` | :arrow_down: |
   | [...a/management/copy/hive/HiveLocationDescriptor.java](https://codecov.io/gh/apache/gobblin/pull/3568/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvaGl2ZS9IaXZlTG9jYXRpb25EZXNjcmlwdG9yLmphdmE=) | `36.17% <0.00%> (-14.90%)` | :arrow_down: |
   | [...anagement/copy/hive/UnpartitionedTableFileSet.java](https://codecov.io/gh/apache/gobblin/pull/3568/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvaGl2ZS9VbnBhcnRpdGlvbmVkVGFibGVGaWxlU2V0LmphdmE=) | `66.66% <0.00%> (-12.97%)` | :arrow_down: |
   | [...ata/management/copy/hive/HiveCopyEntityHelper.java](https://codecov.io/gh/apache/gobblin/pull/3568/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvaGl2ZS9IaXZlQ29weUVudGl0eUhlbHBlci5qYXZh) | `51.41% <0.00%> (-11.59%)` | :arrow_down: |
   | [...ache/gobblin/util/commit/DeleteFileCommitStep.java](https://codecov.io/gh/apache/gobblin/pull/3568/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vdXRpbC9jb21taXQvRGVsZXRlRmlsZUNvbW1pdFN0ZXAuamF2YQ==) | `34.04% <0.00%> (-8.52%)` | :arrow_down: |
   | [...a/management/copy/publisher/CopyDataPublisher.java](https://codecov.io/gh/apache/gobblin/pull/3568/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvcHVibGlzaGVyL0NvcHlEYXRhUHVibGlzaGVyLmphdmE=) | `67.54% <0.00%> (-7.95%)` | :arrow_down: |
   | ... and [1057 more](https://codecov.io/gh/apache/gobblin/pull/3568/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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] arjun4084346 commented on a diff in pull request #3568: [GOBBLIN-1714] Prevent silent failure of data copy if files don't exist in source

Posted by GitBox <gi...@apache.org>.
arjun4084346 commented on code in PR #3568:
URL: https://github.com/apache/gobblin/pull/3568#discussion_r978913179


##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/RecursiveCopyableDataset.java:
##########
@@ -195,22 +196,28 @@ public Collection<? extends CopyEntity> getCopyableFiles(FileSystem targetFs, Co
 
     Map<Path, FileStatus> filesInSource =
         createPathMap(getFilesAtPath(this.fs, this.rootPath, this.pathFilter), this.rootPath);
-    Map<Path, FileStatus> filesInTarget =
-        createPathMap(getFilesAtPath(targetFs, targetPath, this.pathFilter), targetPath);
+
+    // Allow fileNotFoundException for filesInTarget since if it doesn't exist, they will be created.
+    List<FileStatus> filesAtPath = Lists.newArrayList();
+    try {
+      filesAtPath = getFilesAtPath(targetFs, targetPath, this.pathFilter);
+    } catch (FileNotFoundException e) {
+      log.info(String.format("Could not find any files on targetFs %s path %s.", targetFs.getUri(), targetPath));
+    }
+    Map<Path, FileStatus> filesInTarget = createPathMap(filesAtPath, targetPath);
 
     return getCopyableFilesImpl(configuration, filesInSource, filesInTarget, targetFs,
             nonGlobSearchPath, configuration.getPublishDir(), targetPath);
   }
 
   @VisibleForTesting
   protected List<FileStatus> getFilesAtPath(FileSystem fs, Path path, PathFilter fileFilter)
-      throws IOException {
+      throws FileNotFoundException {
     try {
       return FileListUtils
           .listFilesToCopyAtPath(fs, path, fileFilter, applyFilterToDirectories, includeEmptyDirectories);
     } catch (IOException e) {
-      log.warn(String.format("Could not find any files on fs %s path %s due to the following exception. Returning an empty list of files.", fs.getUri(), path), e);
-      return Lists.newArrayList();
+      throw new FileNotFoundException(String.format("Could not find any files on fs %s path %s.", fs.getUri(), path));
     }

Review Comment:
   Yes, lets handle no workunits creation case separately.
   I think we just want to reverse https://github.com/apache/gobblin/pull/3263/files



-- 
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] Will-Lo commented on a diff in pull request #3568: [GOBBLIN-1714] Prevent silent failure of data copy if files don't exist in source

Posted by GitBox <gi...@apache.org>.
Will-Lo commented on code in PR #3568:
URL: https://github.com/apache/gobblin/pull/3568#discussion_r978345925


##########
gobblin-data-management/src/test/java/org/apache/gobblin/data/management/copy/RecursiveCopyableDatasetTest.java:
##########
@@ -326,7 +326,7 @@ public TestRecursiveCopyableDataset(Path source, Path target, List<FileStatus> s
 
     @Override
     protected List<FileStatus> getFilesAtPath(FileSystem fs, Path path, PathFilter fileFilter)
-        throws IOException {
+        throws RuntimeException {

Review Comment:
   It's not standard to declare that functions throw RuntimeException. See: http://www.javapractices.com/topic/TopicAction.do?Id=129
   It's not enforced by Java as this (and its descendants) are considered to be non-recoverable exceptions, so it is not necessary for callers to handle RuntimeException explicitly.



##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/RecursiveCopyableDataset.java:
##########
@@ -195,22 +196,28 @@ public Collection<? extends CopyEntity> getCopyableFiles(FileSystem targetFs, Co
 
     Map<Path, FileStatus> filesInSource =
         createPathMap(getFilesAtPath(this.fs, this.rootPath, this.pathFilter), this.rootPath);
-    Map<Path, FileStatus> filesInTarget =
-        createPathMap(getFilesAtPath(targetFs, targetPath, this.pathFilter), targetPath);
+
+    // Allow fileNotFoundException for filesInTarget since if it doesn't exist, they will be created.
+    List<FileStatus> filesAtPath = Lists.newArrayList();
+    try {
+      filesAtPath = getFilesAtPath(targetFs, targetPath, this.pathFilter);
+    } catch (FileNotFoundException e) {
+      log.info(String.format("Could not find any files on targetFs %s path %s.", targetFs.getUri(), targetPath));
+    }
+    Map<Path, FileStatus> filesInTarget = createPathMap(filesAtPath, targetPath);
 
     return getCopyableFilesImpl(configuration, filesInSource, filesInTarget, targetFs,
             nonGlobSearchPath, configuration.getPublishDir(), targetPath);
   }
 
   @VisibleForTesting
   protected List<FileStatus> getFilesAtPath(FileSystem fs, Path path, PathFilter fileFilter)
-      throws IOException {
+      throws FileNotFoundException {
     try {
       return FileListUtils
           .listFilesToCopyAtPath(fs, path, fileFilter, applyFilterToDirectories, includeEmptyDirectories);
     } catch (IOException e) {
-      log.warn(String.format("Could not find any files on fs %s path %s due to the following exception. Returning an empty list of files.", fs.getUri(), path), e);
-      return Lists.newArrayList();
+      throw new FileNotFoundException(String.format("Could not find any files on fs %s path %s.", fs.getUri(), path));
     }

Review Comment:
   Sorry if I was misleading earlier, I thought about it some more and I think we need to be cautious here. We want to actually do the reverse of what you have. So we have the function catch (FileNotFoundException) here silently, which is the old behavior. We want to actually have this function return the empty list `filesAtPath` since otherwise it would cause all pipelines with one missing target folder to perform a full copy instead of an incremental copy.
   
   This means that there will be a tradeoff, the sourceFS will still fail silently if the folder is missing on the source. 



##########
gobblin-data-management/src/test/java/org/apache/gobblin/data/management/copy/RecursiveCopyableDatasetTest.java:
##########
@@ -326,7 +326,7 @@ public TestRecursiveCopyableDataset(Path source, Path target, List<FileStatus> s
 
     @Override
     protected List<FileStatus> getFilesAtPath(FileSystem fs, Path path, PathFilter fileFilter)
-        throws IOException {
+        throws RuntimeException {

Review Comment:
   Though since this is a test function, so you can probably just have it throw the IOException instead or have it match the function definition but not throw



##########
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/RecursiveCopyableDataset.java:
##########
@@ -195,22 +196,28 @@ public Collection<? extends CopyEntity> getCopyableFiles(FileSystem targetFs, Co
 
     Map<Path, FileStatus> filesInSource =
         createPathMap(getFilesAtPath(this.fs, this.rootPath, this.pathFilter), this.rootPath);
-    Map<Path, FileStatus> filesInTarget =
-        createPathMap(getFilesAtPath(targetFs, targetPath, this.pathFilter), targetPath);
+
+    // Allow fileNotFoundException for filesInTarget since if it doesn't exist, they will be created.
+    List<FileStatus> filesAtPath = Lists.newArrayList();
+    try {
+      filesAtPath = getFilesAtPath(targetFs, targetPath, this.pathFilter);
+    } catch (FileNotFoundException e) {
+      log.info(String.format("Could not find any files on targetFs %s path %s.", targetFs.getUri(), targetPath));
+    }
+    Map<Path, FileStatus> filesInTarget = createPathMap(filesAtPath, targetPath);
 
     return getCopyableFilesImpl(configuration, filesInSource, filesInTarget, targetFs,
             nonGlobSearchPath, configuration.getPublishDir(), targetPath);
   }
 
   @VisibleForTesting
   protected List<FileStatus> getFilesAtPath(FileSystem fs, Path path, PathFilter fileFilter)
-      throws IOException {
+      throws FileNotFoundException {
     try {
       return FileListUtils
           .listFilesToCopyAtPath(fs, path, fileFilter, applyFilterToDirectories, includeEmptyDirectories);
     } catch (IOException e) {
-      log.warn(String.format("Could not find any files on fs %s path %s due to the following exception. Returning an empty list of files.", fs.getUri(), path), e);
-      return Lists.newArrayList();
+      throw new FileNotFoundException(String.format("Could not find any files on fs %s path %s.", fs.getUri(), path));
     }

Review Comment:
   Given that this is the current behavior for the other Gobblin pipelines (if source does not exist, do not fail but report no work done), let's just go with this for now. If we want to fail loudly on no workunits collected, we should handle it holistically at a higher level.



-- 
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] Will-Lo merged pull request #3568: [GOBBLIN-1714] Use FileNotFoundException when determining files in source/target instead of generic IOException

Posted by GitBox <gi...@apache.org>.
Will-Lo merged PR #3568:
URL: https://github.com/apache/gobblin/pull/3568


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