Skip to content

Commit

Permalink
[HUDI-4437] Fix test conflicts by clearing file system cache (#6123)
Browse files Browse the repository at this point in the history
Co-authored-by: jian.feng <[email protected]>
Co-authored-by: jian.feng <[email protected]>
Co-authored-by: Raymond Xu <[email protected]>
  • Loading branch information
4 people authored Jul 23, 2022
1 parent af10a97 commit 340c3db
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private static Iterable<Object[]> syncModeAndSchemaFromCommitMetadata() {
private HoodieHiveSyncClient hiveClient;

@AfterAll
public static void cleanUpClass() {
public static void cleanUpClass() throws IOException {
HiveTestUtil.shutdown();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.hadoop.fs.Path;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

Expand All @@ -49,7 +48,6 @@
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Disabled
public class TestHiveSyncGlobalCommitTool {

@RegisterExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public static void setUp() throws IOException, InterruptedException, HiveExcepti
hiveSyncProps.setProperty(META_SYNC_PARTITION_FIELDS.key(), "datestr");
hiveSyncProps.setProperty(HIVE_BATCH_SYNC_PARTITION_NUM.key(), "3");

hiveSyncConfig = new HiveSyncConfig(hiveSyncProps, configuration);
hiveSyncConfig = new HiveSyncConfig(hiveSyncProps, getHiveConf());

dtfOut = DateTimeFormatter.ofPattern("yyyy/MM/dd");
ddlExecutor = new HiveQueryDDLExecutor(hiveSyncConfig);
Expand Down Expand Up @@ -176,7 +176,7 @@ public static HiveConf getHiveConf() {
return hiveServer.getHiveConf();
}

public static void shutdown() {
public static void shutdown() throws IOException {
if (hiveServer != null) {
hiveServer.stop();
}
Expand All @@ -186,6 +186,7 @@ public static void shutdown() {
if (zkServer != null) {
zkServer.shutdown();
}
FileSystem.closeAll();
}

public static void createCOWTable(String instantTime, int numberOfPartitions, boolean useSchemaFromCommitMetadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.apache.hudi.hive.testutils;

import org.apache.hadoop.fs.FileSystem;
import org.apache.hudi.avro.HoodieAvroWriteSupport;
import org.apache.hudi.common.bloom.BloomFilter;
import org.apache.hudi.common.bloom.BloomFilterFactory;
Expand Down Expand Up @@ -264,10 +265,11 @@ public void startHiveServer2() {
}
}

public void shutDown() {
public void shutDown() throws IOException {
stopHiveServer2();
Hive.closeCurrent();
hiveTestService.getHiveMetaStore().stop();
hdfsTestService.stop();
FileSystem.closeAll();
}
}

0 comments on commit 340c3db

Please sign in to comment.