[HUDI-1552] Improve performance of key lookups from base file in Metadata Table. (#2494)
* [HUDI-1552] Improve performance of key lookups from base file in Metadata Table. 1. Cache the KeyScanner across lookups so that the HFile index does not have to be read for each lookup. 2. Enable block caching in KeyScanner. 3. Move the lock to a limited scope of the code to reduce lock contention. 4. Removed reuse configuration * Properly close the readers, when metadata table is accessed from executors - Passing a reuse boolean into HoodieBackedTableMetadata - Preserve the fast return behavior when reusing and opening from multiple threads (no contention) - Handle concurrent close() and open readers, for reuse=false, by always synchronizing Co-authored-by: Vinoth Chandar <vinoth@apache.org>
This commit is contained in:
@@ -24,6 +24,7 @@ import org.apache.hudi.cli.HoodieCLI;
|
||||
import org.apache.hudi.cli.utils.SparkUtil;
|
||||
import org.apache.hudi.client.common.HoodieSparkEngineContext;
|
||||
import org.apache.hudi.common.config.HoodieMetadataConfig;
|
||||
import org.apache.hudi.common.engine.HoodieLocalEngineContext;
|
||||
import org.apache.hudi.common.util.HoodieTimer;
|
||||
import org.apache.hudi.common.util.ValidationUtils;
|
||||
import org.apache.hudi.config.HoodieWriteConfig;
|
||||
@@ -147,7 +148,8 @@ public class MetadataCommand implements CommandMarker {
|
||||
public String stats() throws IOException {
|
||||
HoodieCLI.getTableMetaClient();
|
||||
HoodieMetadataConfig config = HoodieMetadataConfig.newBuilder().enable(true).build();
|
||||
HoodieBackedTableMetadata metadata = new HoodieBackedTableMetadata(HoodieCLI.conf, config, HoodieCLI.basePath, "/tmp");
|
||||
HoodieBackedTableMetadata metadata = new HoodieBackedTableMetadata(new HoodieLocalEngineContext(HoodieCLI.conf),
|
||||
config, HoodieCLI.basePath, "/tmp");
|
||||
Map<String, String> stats = metadata.stats();
|
||||
|
||||
StringBuffer out = new StringBuffer("\n");
|
||||
@@ -197,7 +199,7 @@ public class MetadataCommand implements CommandMarker {
|
||||
final String partition) throws IOException {
|
||||
HoodieCLI.getTableMetaClient();
|
||||
HoodieMetadataConfig config = HoodieMetadataConfig.newBuilder().enable(true).build();
|
||||
HoodieBackedTableMetadata metaReader = new HoodieBackedTableMetadata(HoodieCLI.conf, config, HoodieCLI.basePath, "/tmp");
|
||||
HoodieBackedTableMetadata metaReader = new HoodieBackedTableMetadata(new HoodieLocalEngineContext(HoodieCLI.conf), config, HoodieCLI.basePath, "/tmp");
|
||||
|
||||
StringBuffer out = new StringBuffer("\n");
|
||||
if (!metaReader.enabled()) {
|
||||
|
||||
Reference in New Issue
Block a user