This is an automated email from the ASF dual-hosted git repository. sivabalan pushed a commit to branch release-0.12.3 in repository https://gitbox.apache.org/repos/asf/hudi.git
commit 4774e965c1ea62d5a00fed1f6713d1c55205cb54 Author: Sagar Sumit <[email protected]> AuthorDate: Mon Apr 10 17:40:44 2023 +0530 Init embedded timeline server only when needed --- .../functional/TestRemoteFileSystemViewWithMetadataTable.java | 4 +++- .../java/org/apache/hudi/testutils/HoodieClientTestHarness.java | 9 +++++---- .../apache/hudi/common/testutils/HoodieCommonTestHarness.java | 6 +++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/functional/TestRemoteFileSystemViewWithMetadataTable.java b/hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/functional/TestRemoteFileSystemViewWithMetadataTable.java index 6a50ef179a1..99c7fd35a98 100644 --- a/hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/functional/TestRemoteFileSystemViewWithMetadataTable.java +++ b/hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/functional/TestRemoteFileSystemViewWithMetadataTable.java @@ -67,6 +67,7 @@ import java.util.stream.Collectors; import static org.apache.hudi.common.table.timeline.HoodieTimeline.COMMIT_ACTION; import static org.apache.hudi.common.table.timeline.HoodieTimeline.DELTA_COMMIT_ACTION; +import static org.apache.hudi.common.table.view.FileSystemViewStorageConfig.REMOTE_PORT_NUM; import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -82,7 +83,6 @@ public class TestRemoteFileSystemViewWithMetadataTable extends HoodieClientTestH initSparkContexts(); initFileSystem(); initMetaClient(); - initTimelineService(); dataGen = new HoodieTestDataGenerator(0x1f86); } @@ -134,6 +134,7 @@ public class TestRemoteFileSystemViewWithMetadataTable extends HoodieClientTestH @Test public void testMORGetLatestFileSliceWithMetadataTableEmbeddedTLS() throws IOException { + initTimelineService(); testMORGetLatestFileSliceWithMetadataTable(true); } @@ -233,6 +234,7 @@ public class TestRemoteFileSystemViewWithMetadataTable extends HoodieClientTestH } else { writeConfigBuilder.withFileSystemViewConfig(FileSystemViewStorageConfig.newBuilder() .withStorageType(FileSystemViewStorageType.REMOTE_ONLY) + .withRemoteServerPort(REMOTE_PORT_NUM.defaultValue()) .build()); } HoodieWriteConfig writeConfig = writeConfigBuilder.build(); diff --git a/hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/testutils/HoodieClientTestHarness.java b/hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/testutils/HoodieClientTestHarness.java index a0c093be16b..3978c491018 100644 --- a/hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/testutils/HoodieClientTestHarness.java +++ b/hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/testutils/HoodieClientTestHarness.java @@ -125,10 +125,10 @@ public abstract class HoodieClientTestHarness extends HoodieCommonTestHarness im protected static int timelineServicePort = FileSystemViewStorageConfig.REMOTE_PORT_NUM.defaultValue(); private String testMethodName; - protected transient JavaSparkContext jsc = null; - protected transient HoodieSparkEngineContext context = null; - protected transient SparkSession sparkSession = null; - protected transient Configuration hadoopConf = null; + protected transient JavaSparkContext jsc; + protected transient HoodieSparkEngineContext context; + protected transient SparkSession sparkSession; + protected transient Configuration hadoopConf; protected transient SQLContext sqlContext; protected transient FileSystem fs; protected transient ExecutorService executorService; @@ -332,6 +332,7 @@ public abstract class HoodieClientTestHarness extends HoodieCommonTestHarness im protected void cleanupTimelineService() { if (timelineService != null) { timelineService.close(); + timelineService = null; } } diff --git a/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieCommonTestHarness.java b/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieCommonTestHarness.java index 2f228317934..3f1446c171a 100644 --- a/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieCommonTestHarness.java +++ b/hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieCommonTestHarness.java @@ -35,10 +35,10 @@ import java.net.URI; */ public class HoodieCommonTestHarness { - protected String tableName = null; - protected String basePath = null; + protected String tableName; + protected String basePath; protected URI baseUri; - protected HoodieTestDataGenerator dataGen = null; + protected HoodieTestDataGenerator dataGen; protected HoodieTableMetaClient metaClient; @TempDir public java.nio.file.Path tempDir;
