vinothchandar commented on a change in pull request #2417: URL: https://github.com/apache/hudi/pull/2417#discussion_r553710593
########## File path: hudi-common/src/main/java/org/apache/hudi/common/config/HoodieMetadataConfig.java ########## @@ -39,6 +39,7 @@ // Validate contents of Metadata Table on each access against the actual filesystem public static final String METADATA_VALIDATE_PROP = METADATA_PREFIX + ".validate"; public static final boolean DEFAULT_METADATA_VALIDATE = false; + public static final boolean DEFAULT_METADATA_ENABLE_FOR_READERS = false; Review comment: can we move this closer to the actual property for which this is the default property? ########## File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java ########## @@ -221,8 +221,9 @@ public HoodieBackedTableMetadata metadata() { protected abstract void initialize(HoodieEngineContext engineContext, HoodieTableMetaClient datasetMetaClient); private void initTableMetadata() { - this.metadata = new HoodieBackedTableMetadata(hadoopConf.get(), datasetWriteConfig.getBasePath(), datasetWriteConfig.getSpillableMapBasePath(), - datasetWriteConfig.useFileListingMetadata(), datasetWriteConfig.getFileListingMetadataVerify(), false, + this.metadata = new HoodieBackedTableMetadata(engineContext, hadoopConf.get(), datasetWriteConfig.getBasePath(), Review comment: the `engineContext` has the `hadoopConf` as well right? use that? ########## File path: hudi-common/src/main/java/org/apache/hudi/common/engine/HoodieMREngineContext.java ########## @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hudi.common.engine; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hudi.common.config.SerializableConfiguration; +import org.apache.hudi.common.function.SerializableConsumer; +import org.apache.hudi.common.function.SerializableFunction; +import org.apache.hudi.common.function.SerializablePairFunction; +import org.apache.hudi.common.util.Option; + +import org.apache.hudi.common.util.collection.Pair; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static java.util.stream.Collectors.toList; +import static org.apache.hudi.common.function.FunctionWrapper.throwingFlatMapWrapper; +import static org.apache.hudi.common.function.FunctionWrapper.throwingForeachWrapper; +import static org.apache.hudi.common.function.FunctionWrapper.throwingMapToPairWrapper; +import static org.apache.hudi.common.function.FunctionWrapper.throwingMapWrapper; + +/** + * A java based engine context that can be used from map-reduce tasks executing in query engines like + * spark, hive and presto. + */ +public final class HoodieMREngineContext extends HoodieEngineContext { Review comment: any reason why this cannot be in `hudi-hadoop-mr`? ########## File path: hudi-common/src/main/java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java ########## @@ -49,12 +60,48 @@ public FileSystemBackedTableMetadata(SerializableConfiguration conf, String data @Override public List<String> getAllPartitionPaths() throws IOException { - FileSystem fs = new Path(datasetBasePath).getFileSystem(hadoopConf.get()); if (assumeDatePartitioning) { + FileSystem fs = new Path(datasetBasePath).getFileSystem(hadoopConf.get()); return FSUtils.getAllPartitionFoldersThreeLevelsDown(fs, datasetBasePath); - } else { - return FSUtils.getAllFoldersWithPartitionMetaFile(fs, datasetBasePath); } + + List<Path> pathsToList = new LinkedList<>(); + pathsToList.add(new Path(datasetBasePath)); + List<String> partitionPaths = new ArrayList<>(); + + // TODO: Get the parallelism from HoodieWriteConfig + final int fileListingParallelism = 1500; Review comment: +1 there can we pass this in as an arg to `FileSystemBackedTableMetadata` class? This default is too much for query side. ########## File path: hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/utils/HoodieRealtimeInputFormatUtils.java ########## @@ -82,7 +82,7 @@ HoodieTableMetaClient metaClient = partitionsToMetaClient.get(partitionPath); if (!fsCache.containsKey(metaClient)) { - HoodieTableFileSystemView fsView = FileSystemViewManager.createInMemoryFileSystemView(metaClient, + HoodieTableFileSystemView fsView = FileSystemViewManager.createInMemoryFileSystemViewForReaders(metaClient, Review comment: Can we avoid special naming methods based on caller. We should keep stuff like `FileSystemViewManager` totally agnostic of reader/writer. If you want special behavior, can you please add a new method arg and control it like that. ########## File path: hudi-common/src/main/java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java ########## @@ -64,6 +111,6 @@ public FileSystemBackedTableMetadata(SerializableConfiguration conf, String data @Override public boolean isInSync() { - throw new UnsupportedOperationException(); + return false; Review comment: this should be `true`? FileSystem and Data timeline cannot be divergent right ########## File path: hudi-common/src/main/java/org/apache/hudi/metadata/FileSystemBackedTableMetadata.java ########## @@ -49,12 +60,48 @@ public FileSystemBackedTableMetadata(SerializableConfiguration conf, String data @Override public List<String> getAllPartitionPaths() throws IOException { - FileSystem fs = new Path(datasetBasePath).getFileSystem(hadoopConf.get()); if (assumeDatePartitioning) { + FileSystem fs = new Path(datasetBasePath).getFileSystem(hadoopConf.get()); return FSUtils.getAllPartitionFoldersThreeLevelsDown(fs, datasetBasePath); - } else { - return FSUtils.getAllFoldersWithPartitionMetaFile(fs, datasetBasePath); } + + List<Path> pathsToList = new LinkedList<>(); Review comment: is this block verbatim the code @prashantwason had for parallelizing bootstrapping.. Prashant, can you also please help review this PR ########## File path: hudi-common/src/main/java/org/apache/hudi/common/table/view/FileSystemViewManager.java ########## @@ -159,12 +160,12 @@ private static HoodieTableFileSystemView createInMemoryFileSystemView(Serializab return new HoodieTableFileSystemView(metaClient, timeline, viewConf.isIncrementalTimelineSyncEnabled()); } - public static HoodieTableFileSystemView createInMemoryFileSystemView(HoodieTableMetaClient metaClient, - boolean useFileListingFromMetadata, - boolean verifyListings) { + public static HoodieTableFileSystemView createInMemoryFileSystemViewForReaders(HoodieTableMetaClient metaClient, + boolean useFileListingFromMetadata, boolean verifyListings) { Review comment: lets pass the `HoodieEngineContext` as a parameter? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org