diff --git a/hudi-common/src/main/java/org/apache/hudi/common/bootstrap/index/HFileBootstrapIndex.java b/hudi-common/src/main/java/org/apache/hudi/common/bootstrap/index/HFileBootstrapIndex.java index b8a2c202cb6c..718fff3cf3a7 100644 --- a/hudi-common/src/main/java/org/apache/hudi/common/bootstrap/index/HFileBootstrapIndex.java +++ b/hudi-common/src/main/java/org/apache/hudi/common/bootstrap/index/HFileBootstrapIndex.java @@ -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; @@ -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); }