浏览代码

HADOOP-16632 Speculating & Partitioned S3A magic committers can leave pending files under __magic (#1599)

Contributed by Steve Loughran.

This downgrade the checks for leftover __magic entries from fail to warn now the parallel
test runs make speculation more likely. 

Change-Id: Ia4df2e90f82a06dbae69f3fdaadcbb0e0d713b38
Steve Loughran 5 年之前
父节点
当前提交
9fbfe6c8f9

+ 10 - 8
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/integration/ITestS3ACommitterMRJob.java

@@ -628,16 +628,18 @@ public class ITestS3ACommitterMRJob extends AbstractYarnClusterITest {
       S3AFileSystem fs = getRemoteFS();
       S3AFileSystem fs = getRemoteFS();
       // log the contents
       // log the contents
       lsR(fs, destPath, true);
       lsR(fs, destPath, true);
-      intercept(FileNotFoundException.class, () -> {
+      // and look for the magic directory
+      // HADOOP-16632 shows how partitioned/speculative tasks can leave
+      // data here and it is not an error. So just log and continue
+      try {
         final FileStatus st = fs.getFileStatus(magicDir);
         final FileStatus st = fs.getFileStatus(magicDir);
-        StringBuilder result = new StringBuilder("Found magic dir which should"
-            + " have been deleted at ").append(st).append('\n');
-        result.append(" [");
+        LOG.warn("Found magic dir which should"
+            + " have been deleted at {}", st);
         applyLocatedFiles(fs.listFiles(magicDir, true),
         applyLocatedFiles(fs.listFiles(magicDir, true),
-            (status) -> result.append(" ").append(status.getPath()).append('\n'));
-        result.append("]");
-        return result.toString();
-      });
+            (status) -> LOG.warn("{}", status));
+      } catch (FileNotFoundException ignored) {
+        // expected
+      }
     }
     }
   }
   }