Skip to content

Commit

Permalink
[HUDI-5345] Avoid fs.exists calls for metadata table in HFileBootstra…
Browse files Browse the repository at this point in the history
…pIndex (#7404)
  • Loading branch information
yihua authored Dec 8, 2022
1 parent 6f4edb0 commit da9fef6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.hudi.exception.HoodieException;
import org.apache.hudi.exception.HoodieIOException;
import org.apache.hudi.io.storage.HoodieHFileUtils;
import org.apache.hudi.metadata.HoodieTableMetadata;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
Expand Down Expand Up @@ -101,7 +102,10 @@ public HFileBootstrapIndex(HoodieTableMetaClient metaClient) {
Path indexByFilePath = fileIdIndexPath(metaClient);
try {
FileSystem fs = metaClient.getFs();
isPresent = fs.exists(indexByPartitionPath) && fs.exists(indexByFilePath);
// The metadata table is never bootstrapped, so the bootstrap index is always absent
// for the metadata table. The fs.exists calls are avoided for metadata table.
isPresent = !HoodieTableMetadata.isMetadataTable(metaClient.getBasePathV2().toString())
&& fs.exists(indexByPartitionPath) && fs.exists(indexByFilePath);
} catch (IOException ioe) {
throw new HoodieIOException(ioe.getMessage(), ioe);
}
Expand Down

0 comments on commit da9fef6

Please sign in to comment.