[MINOR] Ensure directory exists before listing all marker files. (#2594)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user