Close FSDataInputStream for meta file open in HoodiePartitionMetadata
This commit is contained in:
committed by
vinoth chandar
parent
8dddecf00f
commit
639c287cab
@@ -120,14 +120,19 @@ public class HoodiePartitionMetadata {
|
|||||||
/**
|
/**
|
||||||
* Read out the metadata for this partition
|
* Read out the metadata for this partition
|
||||||
*/
|
*/
|
||||||
public void readFromFS() {
|
public void readFromFS() throws IOException {
|
||||||
|
FSDataInputStream is = null;
|
||||||
try {
|
try {
|
||||||
Path metaFile = new Path(partitionPath, HOODIE_PARTITION_METAFILE);
|
Path metaFile = new Path(partitionPath, HOODIE_PARTITION_METAFILE);
|
||||||
FSDataInputStream is = fs.open(metaFile);
|
is = fs.open(metaFile);
|
||||||
props.load(is);
|
props.load(is);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new HoodieException("Error reading Hoodie partition metadata for " + partitionPath,
|
throw new HoodieException("Error reading Hoodie partition metadata for " + partitionPath,
|
||||||
ioe);
|
ioe);
|
||||||
|
} finally {
|
||||||
|
if (is != null) {
|
||||||
|
is.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -206,7 +206,8 @@ public class HoodieInputFormat extends MapredParquetInputFormat implements Confi
|
|||||||
* Read the table metadata from a data path. This assumes certain hierarchy of files which should
|
* Read the table metadata from a data path. This assumes certain hierarchy of files which should
|
||||||
* be changed once a better way is figured out to pass in the hoodie meta directory
|
* be changed once a better way is figured out to pass in the hoodie meta directory
|
||||||
*/
|
*/
|
||||||
protected static HoodieTableMetaClient getTableMetaClient(FileSystem fs, Path dataPath) {
|
protected static HoodieTableMetaClient getTableMetaClient(FileSystem fs, Path dataPath)
|
||||||
|
throws IOException {
|
||||||
int levels = HoodieHiveUtil.DEFAULT_LEVELS_TO_BASEPATH;
|
int levels = HoodieHiveUtil.DEFAULT_LEVELS_TO_BASEPATH;
|
||||||
if (HoodiePartitionMetadata.hasPartitionMetadata(fs, dataPath)) {
|
if (HoodiePartitionMetadata.hasPartitionMetadata(fs, dataPath)) {
|
||||||
HoodiePartitionMetadata metadata = new HoodiePartitionMetadata(fs, dataPath);
|
HoodiePartitionMetadata metadata = new HoodiePartitionMetadata(fs, dataPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user