You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by go...@apache.org on 2020/07/24 21:34:51 UTC
[phoenix] branch master updated: PHOENIX-5986 Fix flapping test
This is an automated email from the ASF dual-hosted git repository.
gokcen 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 d17eb0a PHOENIX-5986 Fix flapping test
d17eb0a is described below
commit d17eb0a96ca2467be6791783eb314f90740fa94c
Author: Gokcen Iskender <gi...@salesforce.com>
AuthorDate: Fri Jul 10 16:23:49 2020 -0700
PHOENIX-5986 Fix flapping test
Signed-off-by: Gokcen Iskender <gi...@salesforce.com>
---
.../apache/phoenix/end2end/DropTableWithViewsIT.java | 20 ++++++++++++++++----
.../apache/phoenix/end2end/IndexRebuildTaskIT.java | 12 ++++++++----
.../apache/phoenix/end2end/SplitSystemCatalogIT.java | 8 +++++++-
.../java/org/apache/phoenix/schema/task/Task.java | 5 +++++
4 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DropTableWithViewsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DropTableWithViewsIT.java
index 28b9d2a..3c7ea0e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DropTableWithViewsIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DropTableWithViewsIT.java
@@ -17,7 +17,6 @@
*/
package org.apache.phoenix.end2end;
-import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_NAME;
import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -30,10 +29,14 @@ import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import com.google.common.collect.Maps;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
+import org.apache.phoenix.query.QueryServices;
import org.apache.phoenix.util.TableViewFinderResult;
import org.apache.phoenix.coprocessor.TaskRegionObserver;
import org.apache.phoenix.util.ViewUtil;
@@ -47,6 +50,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@RunWith(Parameterized.class)
public class DropTableWithViewsIT extends SplitSystemCatalogIT {
@@ -54,12 +59,17 @@ public class DropTableWithViewsIT extends SplitSystemCatalogIT {
private final boolean isMultiTenant;
private final boolean columnEncoded;
private final String TENANT_SPECIFIC_URL1 = getUrl() + ';' + TENANT_ID_ATTRIB + "=" + TENANT1;
-
+ public static final Logger LOGGER = LoggerFactory.getLogger(DropTableWithViewsIT.class);
private static RegionCoprocessorEnvironment TaskRegionEnvironment;
@BeforeClass
public static synchronized void doSetup() throws Exception {
- SplitSystemCatalogIT.doSetup();
+ Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(10);
+ serverProps.put(QueryServices.TASK_HANDLING_INTERVAL_MS_ATTRIB,
+ Long.toString(Long.MAX_VALUE));
+ serverProps.put(QueryServices.TASK_HANDLING_INITIAL_DELAY_MS_ATTRIB,
+ Long.toString(Long.MAX_VALUE));
+ SplitSystemCatalogIT.doSetup(serverProps);
TaskRegionEnvironment =
getUtility()
.getRSForFirstRegionInTable(
@@ -107,6 +117,8 @@ public class DropTableWithViewsIT extends SplitSystemCatalogIT {
try (Connection conn = DriverManager.getConnection(getUrl());
Connection viewConn =
isMultiTenant ? DriverManager.getConnection(TENANT_SPECIFIC_URL1) : conn) {
+ conn.setAutoCommit(true);
+ viewConn.setAutoCommit(true);
// Empty the task table first.
conn.createStatement().execute("DELETE " + " FROM " + PhoenixDatabaseMetaData.SYSTEM_TASK_NAME);
@@ -115,7 +127,7 @@ public class DropTableWithViewsIT extends SplitSystemCatalogIT {
+ " %s PK2 VARCHAR NOT NULL, V1 VARCHAR, V2 VARCHAR "
+ " CONSTRAINT NAME_PK PRIMARY KEY (%s PK2)" + " ) %s";
conn.createStatement().execute(generateDDL(ddlFormat));
- conn.commit();
+
// Create a view tree (i.e., tree of views) with depth of 2 and fanout factor of 4
for (int i = 0; i < 4; i++) {
String childView = SchemaUtil.getTableName(SCHEMA2, generateUniqueName());
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexRebuildTaskIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexRebuildTaskIT.java
index f9db41e..26e02db 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexRebuildTaskIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexRebuildTaskIT.java
@@ -178,11 +178,15 @@ public class IndexRebuildTaskIT extends BaseUniqueNamesOwnClusterIT {
String taskData = "";
do {
Thread.sleep(2000);
- ResultSet rs = conn.createStatement().executeQuery("SELECT * " +
+ String stmt = "SELECT * " +
" FROM " + PhoenixDatabaseMetaData.SYSTEM_TASK_NAME +
- " WHERE " + PhoenixDatabaseMetaData.TABLE_NAME + "='" + expectedTableName + "' AND " +
- PhoenixDatabaseMetaData.TASK_TYPE + " = " +
- taskType.getSerializedValue());
+ " WHERE " + PhoenixDatabaseMetaData.TASK_TYPE + " = " +
+ taskType.getSerializedValue();
+ if (expectedTableName != null) {
+ stmt += " AND " + PhoenixDatabaseMetaData.TABLE_NAME + "='" + expectedTableName + "'";
+ }
+
+ ResultSet rs = conn.createStatement().executeQuery(stmt);
while (rs.next()) {
taskStatus = rs.getString(PhoenixDatabaseMetaData.TASK_STATUS);
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SplitSystemCatalogIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SplitSystemCatalogIT.java
index ebe818f..2fc31d7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SplitSystemCatalogIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SplitSystemCatalogIT.java
@@ -51,8 +51,14 @@ public class SplitSystemCatalogIT extends BaseTest {
@BeforeClass
public static synchronized void doSetup() throws Exception {
+ doSetup(null);
+ }
+
+ public static synchronized void doSetup(Map<String, String> props) throws Exception {
NUM_SLAVES_BASE = 6;
- Map<String, String> props = Collections.emptyMap();
+ if (props == null) {
+ props = Collections.emptyMap();
+ }
boolean splitSystemCatalog = (driver == null);
setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
// Split SYSTEM.CATALOG once after the mini-cluster is started
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/task/Task.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/task/Task.java
index 988004b..a816d09 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/task/Task.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/task/Task.java
@@ -21,10 +21,13 @@ import com.google.common.base.Strings;
import org.apache.hadoop.hbase.ipc.RpcCall;
import org.apache.hadoop.hbase.ipc.RpcUtil;
import org.apache.hadoop.hbase.security.User;
+import org.apache.phoenix.coprocessor.tasks.DropChildViewsTask;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
import org.apache.phoenix.schema.PTable;
import org.apache.phoenix.util.EnvironmentEdgeManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.security.PrivilegedExceptionAction;
@@ -38,6 +41,7 @@ import java.util.ArrayList;
import java.util.List;
public class Task {
+ public static final Logger LOGGER = LoggerFactory.getLogger(Task.class);
private static void mutateSystemTaskTable(PhoenixConnection conn, PreparedStatement stmt, boolean accessCheckEnabled)
throws IOException {
// we need to mutate SYSTEM.TASK with HBase/login user if access is enabled.
@@ -138,6 +142,7 @@ public class Task {
PhoenixDatabaseMetaData.TASK_DATA +
" ) VALUES(?,?,?,?,?,?,?,?,?)");
stmt = setValuesToAddTaskPS(stmt, taskType, tenantId, schemaName, tableName, taskStatus, data, priority, startTs, endTs);
+ LOGGER.info("Adding task " + taskType + "," +tableName + "," + taskStatus + "," + startTs, ","+endTs);
} catch (SQLException e) {
throw new IOException(e);
}