1
0

Optimize hoodie client after implementat auto closeable interface

This commit is contained in:
yanghua
2019-09-03 19:00:37 +08:00
committed by vinoth chandar
parent 90bfb900aa
commit 80c27f2351
7 changed files with 7 additions and 62 deletions

View File

@@ -65,9 +65,6 @@ public class TestHoodieClientBase extends HoodieClientTestHarness {
protected static Logger logger = LogManager.getLogger(TestHoodieClientBase.class);
private HoodieWriteClient writeClient;
private HoodieReadClient readClient;
protected HoodieWriteClient getHoodieWriteClient(HoodieWriteConfig cfg) {
return getHoodieWriteClient(cfg, false);
}
@@ -78,29 +75,11 @@ public class TestHoodieClientBase extends HoodieClientTestHarness {
protected HoodieWriteClient getHoodieWriteClient(HoodieWriteConfig cfg, boolean rollbackInflightCommit,
HoodieIndex index) {
closeWriteClient();
writeClient = new HoodieWriteClient(jsc, cfg, rollbackInflightCommit, index);
return writeClient;
return new HoodieWriteClient(jsc, cfg, rollbackInflightCommit, index);
}
protected HoodieReadClient getHoodieReadClient(String basePath) {
closeReadClient();
readClient = new HoodieReadClient(jsc, basePath);
return readClient;
}
private void closeWriteClient() {
if (null != writeClient) {
writeClient.close();
writeClient = null;
}
}
private void closeReadClient() {
if (null != readClient) {
readClient.close();
readClient = null;
}
return new HoodieReadClient(jsc, basePath);
}
/**

View File

@@ -49,7 +49,6 @@ public class TestMultiFS extends HoodieClientTestHarness {
private static Logger logger = LogManager.getLogger(TestMultiFS.class);
private String tablePath = "file:///tmp/hoodie/sample-table";
protected String tableName = "hoodie_rt";
private HoodieWriteClient hdfsWriteClient;
private String tableType = HoodieTableType.COPY_ON_WRITE.name();
@Before
@@ -67,11 +66,7 @@ public class TestMultiFS extends HoodieClientTestHarness {
}
private HoodieWriteClient getHoodieWriteClient(HoodieWriteConfig config) throws Exception {
if (null != hdfsWriteClient) {
hdfsWriteClient.close();
}
hdfsWriteClient = new HoodieWriteClient(jsc, config);
return hdfsWriteClient;
return new HoodieWriteClient(jsc, config);
}
protected HoodieWriteConfig getHoodieWriteConfig(String basePath) {

View File

@@ -76,7 +76,6 @@ public class TestHbaseIndex extends HoodieClientTestHarness {
private static HBaseTestingUtility utility;
private static Configuration hbaseConfig;
private static String tableName = "test_table";
private HoodieWriteClient writeClient;
public TestHbaseIndex() throws Exception {
}
@@ -112,22 +111,13 @@ public class TestHbaseIndex extends HoodieClientTestHarness {
@After
public void tearDown() throws Exception {
if (null != writeClient) {
writeClient.close();
writeClient = null;
}
cleanupSparkContexts();
cleanupTempFolderAndPath();
cleanupTestDataGenerator();
}
private HoodieWriteClient getWriteClient(HoodieWriteConfig config) throws Exception {
if (null != writeClient) {
writeClient.close();
}
writeClient = new HoodieWriteClient(jsc, config);
return writeClient;
return new HoodieWriteClient(jsc, config);
}
@Test

View File

@@ -58,7 +58,6 @@ public class TestHoodieCommitArchiveLog extends HoodieClientTestHarness {
@Before
public void init() throws Exception {
initDFS();
initTempFolderAndPath();
initSparkContexts("TestHoodieCommitArchiveLog");
hadoopConf = dfs.getConf();
@@ -70,7 +69,6 @@ public class TestHoodieCommitArchiveLog extends HoodieClientTestHarness {
@After
public void clean() throws IOException {
cleanupDFS();
cleanupTempFolderAndPath();
cleanupSparkContexts();
}

View File

@@ -51,7 +51,6 @@ import org.junit.Test;
public class TestHoodieCompactor extends HoodieClientTestHarness {
private HoodieWriteClient writeClient;
private Configuration hadoopConf;
@Before
@@ -76,11 +75,7 @@ public class TestHoodieCompactor extends HoodieClientTestHarness {
}
private HoodieWriteClient getWriteClient(HoodieWriteConfig config) throws Exception {
if (null != writeClient) {
writeClient.close();
}
writeClient = new HoodieWriteClient(jsc, config);
return writeClient;
return new HoodieWriteClient(jsc, config);
}
private HoodieWriteConfig getConfig() {

View File

@@ -53,8 +53,6 @@ import org.junit.Test;
@SuppressWarnings("unchecked")
public class TestHoodieMergeHandle extends HoodieClientTestHarness {
private HoodieWriteClient writeClient;
@Before
public void setUp() throws Exception {
initSparkContexts("TestHoodieMergeHandle");
@@ -74,11 +72,7 @@ public class TestHoodieMergeHandle extends HoodieClientTestHarness {
}
private HoodieWriteClient getWriteClient(HoodieWriteConfig config) throws Exception {
if (null != writeClient) {
writeClient.close();
}
writeClient = new HoodieWriteClient(jsc, config);
return writeClient;
return new HoodieWriteClient(jsc, config);
}
@Test

View File

@@ -78,8 +78,6 @@ import org.junit.rules.TemporaryFolder;
public class TestMergeOnReadTable extends HoodieClientTestHarness {
private HoodieWriteClient writeClient;
@Before
public void init() throws IOException {
initDFS();
@@ -100,11 +98,7 @@ public class TestMergeOnReadTable extends HoodieClientTestHarness {
}
private HoodieWriteClient getWriteClient(HoodieWriteConfig config) throws Exception {
if (null != writeClient) {
writeClient.close();
}
writeClient = new HoodieWriteClient(jsc, config);
return writeClient;
return new HoodieWriteClient(jsc, config);
}
@Test