[HUDI-1523] Call mkdir(partition) only if not exists (#2501)
This commit is contained in:
committed by
GitHub
parent
d74d8e2084
commit
eb91e5ba70
@@ -108,7 +108,9 @@ public abstract class HoodieWriteHandle<T extends HoodieRecordPayload, I, K, O>
|
|||||||
public Path makeNewPath(String partitionPath) {
|
public Path makeNewPath(String partitionPath) {
|
||||||
Path path = FSUtils.getPartitionPath(config.getBasePath(), partitionPath);
|
Path path = FSUtils.getPartitionPath(config.getBasePath(), partitionPath);
|
||||||
try {
|
try {
|
||||||
fs.mkdirs(path); // create a new partition as needed.
|
if (!fs.exists(path)) {
|
||||||
|
fs.mkdirs(path); // create a new partition as needed.
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new HoodieIOException("Failed to make dir " + path, e);
|
throw new HoodieIOException("Failed to make dir " + path, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,7 +189,9 @@ public class MarkerFiles implements Serializable {
|
|||||||
public Path create(String partitionPath, String dataFileName, IOType type) {
|
public Path create(String partitionPath, String dataFileName, IOType type) {
|
||||||
Path path = FSUtils.getPartitionPath(markerDirPath, partitionPath);
|
Path path = FSUtils.getPartitionPath(markerDirPath, partitionPath);
|
||||||
try {
|
try {
|
||||||
fs.mkdirs(path); // create a new partition as needed.
|
if (!fs.exists(path)) {
|
||||||
|
fs.mkdirs(path); // create a new partition as needed.
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new HoodieIOException("Failed to make dir " + path, e);
|
throw new HoodieIOException("Failed to make dir " + path, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,9 @@ public class HoodieRowCreateHandle implements Serializable {
|
|||||||
private Path makeNewPath(String partitionPath) {
|
private Path makeNewPath(String partitionPath) {
|
||||||
Path path = FSUtils.getPartitionPath(writeConfig.getBasePath(), partitionPath);
|
Path path = FSUtils.getPartitionPath(writeConfig.getBasePath(), partitionPath);
|
||||||
try {
|
try {
|
||||||
fs.mkdirs(path); // create a new partition as needed.
|
if (!fs.exists(path)) {
|
||||||
|
fs.mkdirs(path); // create a new partition as needed.
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new HoodieIOException("Failed to make dir " + path, e);
|
throw new HoodieIOException("Failed to make dir " + path, e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user