From f29ec5f217bf204ea29b204115cfd5c06654a224 Mon Sep 17 00:00:00 2001 From: majian1998 <1253791041@qq.com> Date: Mon, 13 Nov 2023 10:10:08 +0800 Subject: [PATCH] [HUDI-7069] Optimize metaclient construction and include table config in write config for multi-table services. --- .../main/java/org/apache/hudi/utilities/HoodieCompactor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieCompactor.java b/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieCompactor.java index 08e9ad80252ab..9b03cb7a72417 100644 --- a/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieCompactor.java +++ b/hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieCompactor.java @@ -56,7 +56,7 @@ public class HoodieCompactor { private transient FileSystem fs; private TypedProperties props; private final JavaSparkContext jsc; - private final HoodieTableMetaClient metaClient; + private HoodieTableMetaClient metaClient; public HoodieCompactor(JavaSparkContext jsc, Config cfg) { this(jsc, cfg, UtilHelpers.buildProperties(jsc.hadoopConfiguration(), cfg.propsFilePath, cfg.configs), @@ -257,7 +257,7 @@ private int doCompact(JavaSparkContext jsc) throws Exception { // If no compaction instant is provided by --instant-time, find the earliest scheduled compaction // instant from the active timeline if (StringUtils.isNullOrEmpty(cfg.compactionInstantTime)) { - HoodieTableMetaClient metaClient = UtilHelpers.createMetaClient(jsc, cfg.basePath, true); + metaClient = HoodieTableMetaClient.reload(metaClient); Option firstCompactionInstant = metaClient.getActiveTimeline().filterPendingCompactionTimeline().firstInstant(); if (firstCompactionInstant.isPresent()) { cfg.compactionInstantTime = firstCompactionInstant.get().getTimestamp();