1
0

[MINOR] Ensure directory exists before listing all marker files. (#2594)

This commit is contained in:
Prashant Wason
2021-02-23 08:05:59 -08:00
committed by GitHub
parent 2efd0760ac
commit d2f360f5dd
2 changed files with 7 additions and 4 deletions

View File

@@ -166,10 +166,12 @@ public class MarkerFiles implements Serializable {
public List<String> allMarkerFilePaths() throws IOException {
List<String> markerFiles = new ArrayList<>();
FSUtils.processFiles(fs, markerDirPath.toString(), fileStatus -> {
markerFiles.add(stripMarkerFolderPrefix(fileStatus.getPath().toString()));
return true;
}, false);
if (doesMarkerDirExist()) {
FSUtils.processFiles(fs, markerDirPath.toString(), fileStatus -> {
markerFiles.add(stripMarkerFolderPrefix(fileStatus.getPath().toString()));
return true;
}, false);
}
return markerFiles;
}

View File

@@ -119,6 +119,7 @@ public class TestMarkerFiles extends HoodieCommonTestHarness {
public void testDeletionWhenMarkerDirNotExists() throws IOException {
// then
assertFalse(markerFiles.doesMarkerDirExist());
assertTrue(markerFiles.allMarkerFilePaths().isEmpty());
assertFalse(markerFiles.deleteMarkerDir(context, 2));
}