You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ch...@apache.org on 2019/06/06 20:34:54 UTC
[phoenix] branch master updated: PHOENIX-5311 Fix distributed
cluster test resource (hbase table) leak
This is an automated email from the ASF dual-hosted git repository.
chinmayskulkarni pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push:
new 5303d29 PHOENIX-5311 Fix distributed cluster test resource (hbase table) leak
5303d29 is described below
commit 5303d292a4c875f8ee8f484094c897f8e7595e63
Author: István Tóth <st...@cloudera.com>
AuthorDate: Thu May 30 14:37:29 2019 +0200
PHOENIX-5311 Fix distributed cluster test resource (hbase table) leak
Change-Id: Ie325febbdf613198e2c2037760d5d6cdc79e997e
---
.../phoenix/end2end/ParallelStatsDisabledIT.java | 4 ++--
.../phoenix/end2end/ParallelStatsEnabledIT.java | 4 ++--
.../java/org/apache/phoenix/query/BaseTest.java | 25 ++++++++++++++++------
3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledIT.java
index 8ea8dc8..a46de49 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsDisabledIT.java
@@ -62,8 +62,8 @@ public abstract class ParallelStatsDisabledIT extends BaseTest {
}
@AfterClass
- public static void tearDownMiniCluster() throws Exception {
- BaseTest.tearDownMiniClusterIfBeyondThreshold();
+ public static void freeResources() throws Exception {
+ BaseTest.freeResourcesIfBeyondThreshold();
}
protected ResultSet executeQuery(Connection conn, QueryBuilder queryBuilder) throws SQLException {
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsEnabledIT.java
index 7028db3..a383ea1 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsEnabledIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelStatsEnabledIT.java
@@ -48,7 +48,7 @@ public abstract class ParallelStatsEnabledIT extends BaseTest {
}
@AfterClass
- public static void tearDownMiniCluster() throws Exception {
- BaseTest.tearDownMiniClusterIfBeyondThreshold();
+ public static void freeResources() throws Exception {
+ BaseTest.freeResourcesIfBeyondThreshold();
}
}
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index e4a8e86..96992ee 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -19,6 +19,7 @@ package org.apache.phoenix.query;
import static org.apache.phoenix.hbase.index.write.ParallelWriterIndexCommitter.NUM_CONCURRENT_INDEX_WRITER_THREADS_CONF_KEY;
import static org.apache.phoenix.query.QueryConstants.MILLIS_IN_DAY;
+import static org.apache.phoenix.query.QueryServices.DROP_METADATA_ATTRIB;
import static org.apache.phoenix.util.PhoenixRuntime.CURRENT_SCN_ATTRIB;
import static org.apache.phoenix.util.PhoenixRuntime.JDBC_PROTOCOL;
import static org.apache.phoenix.util.PhoenixRuntime.JDBC_PROTOCOL_TERMINATOR;
@@ -444,7 +445,7 @@ public abstract class BaseTest {
boolean isDistributedCluster = isDistributedClusterModeEnabled(conf);
if (!isDistributedCluster) {
return initMiniCluster(conf, overrideProps);
- } else {
+ } else {
return initClusterDistributedMode(conf, overrideProps);
}
}
@@ -629,6 +630,11 @@ public abstract class BaseTest {
private static PhoenixTestDriver newTestDriver(ReadOnlyProps props) throws Exception {
PhoenixTestDriver newDriver;
String driverClassName = props.get(DRIVER_CLASS_NAME_ATTRIB);
+ if(isDistributedClusterModeEnabled(config)) {
+ HashMap<String, String> distPropMap = new HashMap<>(1);
+ distPropMap.put(DROP_METADATA_ATTRIB, Boolean.TRUE.toString());
+ props = new ReadOnlyProps(props, distPropMap.entrySet().iterator());
+ }
if (driverClassName == null) {
newDriver = new PhoenixTestDriver(props);
} else {
@@ -767,14 +773,21 @@ public abstract class BaseTest {
return "S" + Integer.toString(MAX_SEQ_SUFFIX_VALUE + nextName).substring(1);
}
- public static void tearDownMiniClusterIfBeyondThreshold() throws Exception {
+ public static void freeResourcesIfBeyondThreshold() throws Exception {
if (TABLE_COUNTER.get() > TEARDOWN_THRESHOLD) {
int numTables = TABLE_COUNTER.get();
TABLE_COUNTER.set(0);
- logger.info(
- "Shutting down mini cluster because number of tables on this mini cluster is likely greater than "
- + TEARDOWN_THRESHOLD);
- tearDownMiniClusterAsync(numTables);
+ if(isDistributedClusterModeEnabled(config)) {
+ logger.info(
+ "Deleting old tables on distributed cluster because number of tables is likely greater than "
+ + TEARDOWN_THRESHOLD);
+ deletePriorMetaData(HConstants.LATEST_TIMESTAMP, url);
+ } else {
+ logger.info(
+ "Shutting down mini cluster because number of tables on this mini cluster is likely greater than "
+ + TEARDOWN_THRESHOLD);
+ tearDownMiniClusterAsync(numTables);
+ }
}
}