1
0

[HUDI-3869] Improve error handling of loading Hudi conf (#5311)

This commit is contained in:
Y Ethan Guo
2022-04-13 14:25:31 -07:00
committed by GitHub
parent 6f9b02decb
commit c7f41f9018

View File

@@ -99,7 +99,11 @@ public class DFSPropertiesConfiguration {
if (defaultConfPath.isPresent()) {
conf.addPropsFromFile(defaultConfPath.get());
} else {
conf.addPropsFromFile(DEFAULT_PATH);
try {
conf.addPropsFromFile(DEFAULT_PATH);
} catch (Exception e) {
LOG.warn("Cannot load default config file: " + DEFAULT_PATH, e);
}
}
return conf.getProps();
}
@@ -126,13 +130,17 @@ public class DFSPropertiesConfiguration {
filePath.toString(),
Option.ofNullable(hadoopConfig).orElseGet(Configuration::new)
);
try {
if (filePath.equals(DEFAULT_PATH) && !fs.exists(filePath)) {
LOG.warn("Properties file " + filePath + " not found. Ignoring to load props file");
return;
}
} catch (IOException ioe) {
throw new HoodieIOException("Cannot check if the properties file exist: " + filePath, ioe);
}
BufferedReader reader = new BufferedReader(new InputStreamReader(fs.open(filePath)));
try (BufferedReader reader = new BufferedReader(new InputStreamReader(fs.open(filePath)))) {
visitedFilePaths.add(filePath.toString());
currentFilePath = filePath;
addPropsFromStream(reader);