[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 {
|
public List<String> allMarkerFilePaths() throws IOException {
|
||||||
List<String> markerFiles = new ArrayList<>();
|
List<String> markerFiles = new ArrayList<>();
|
||||||
FSUtils.processFiles(fs, markerDirPath.toString(), fileStatus -> {
|
if (doesMarkerDirExist()) {
|
||||||
markerFiles.add(stripMarkerFolderPrefix(fileStatus.getPath().toString()));
|
FSUtils.processFiles(fs, markerDirPath.toString(), fileStatus -> {
|
||||||
return true;
|
markerFiles.add(stripMarkerFolderPrefix(fileStatus.getPath().toString()));
|
||||||
}, false);
|
return true;
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
return markerFiles;
|
return markerFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ public class TestMarkerFiles extends HoodieCommonTestHarness {
|
|||||||
public void testDeletionWhenMarkerDirNotExists() throws IOException {
|
public void testDeletionWhenMarkerDirNotExists() throws IOException {
|
||||||
// then
|
// then
|
||||||
assertFalse(markerFiles.doesMarkerDirExist());
|
assertFalse(markerFiles.doesMarkerDirExist());
|
||||||
|
assertTrue(markerFiles.allMarkerFilePaths().isEmpty());
|
||||||
assertFalse(markerFiles.deleteMarkerDir(context, 2));
|
assertFalse(markerFiles.deleteMarkerDir(context, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user