You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2016/07/13 07:40:49 UTC
phoenix git commit: PHOENIX-3061 IndexTool marks index as ACTIVE and
exit 0 even if bulkload has error
Repository: phoenix
Updated Branches:
refs/heads/master 776af74af -> 8346c470f
PHOENIX-3061 IndexTool marks index as ACTIVE and exit 0 even if bulkload has error
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8346c470
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8346c470
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8346c470
Branch: refs/heads/master
Commit: 8346c470fff04b2b6bab57ecfba93c9879afad7e
Parents: 776af74
Author: James Taylor <ja...@apache.org>
Authored: Wed Jul 13 09:40:42 2016 +0200
Committer: James Taylor <ja...@apache.org>
Committed: Wed Jul 13 09:40:42 2016 +0200
----------------------------------------------------------------------
.../end2end/index/AsyncImmutableIndexIT.java | 55 +++++++++-----------
1 file changed, 25 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/8346c470/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/AsyncImmutableIndexIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/AsyncImmutableIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/AsyncImmutableIndexIT.java
index 8c90b6e..46bbfca 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/AsyncImmutableIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/AsyncImmutableIndexIT.java
@@ -23,35 +23,21 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.sql.Connection;
+import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
-import java.util.Map;
import java.util.Properties;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT;
-import org.apache.phoenix.end2end.IndexToolIT;
-import org.apache.phoenix.mapreduce.index.IndexTool;
-import org.apache.phoenix.query.QueryServices;
-import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.end2end.BaseHBaseManagedTimeIT;
+import org.apache.phoenix.schema.PIndexState;
+import org.apache.phoenix.schema.PTableType;
import org.apache.phoenix.util.PropertiesUtil;
import org.apache.phoenix.util.QueryUtil;
-import org.apache.phoenix.util.ReadOnlyProps;
-import org.junit.BeforeClass;
+import org.apache.phoenix.util.StringUtil;
import org.junit.Test;
-import com.google.common.collect.Maps;
-
-public class AsyncImmutableIndexIT extends BaseOwnClusterHBaseManagedTimeIT {
-
- @BeforeClass
- public static void doSetup() throws Exception {
- Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(1);
- serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB,
- QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS);
- setUpRealDriver(new ReadOnlyProps(serverProps.entrySet().iterator()),
- ReadOnlyProps.EMPTY_PROPS);
- }
+public class AsyncImmutableIndexIT extends BaseHBaseManagedTimeIT {
+ private static final long MAX_WAIT_FOR_INDEX_BUILD_TIME_MS = 45000;
@Test
public void testDeleteFromImmutable() throws Exception {
@@ -77,13 +63,22 @@ public class AsyncImmutableIndexIT extends BaseOwnClusterHBaseManagedTimeIT {
conn.createStatement().execute("delete from TEST_TABLE where pk1 = 'a'");
conn.commit();
- // run the index MR job
- final IndexTool indexingTool = new IndexTool();
- indexingTool.setConf(new Configuration(getUtility().getConfiguration()));
- final String[] cmdArgs =
- IndexToolIT.getArgValues(null, "TEST_TABLE", "TEST_INDEX", true);
- int status = indexingTool.run(cmdArgs);
- assertEquals(0, status);
+ DatabaseMetaData dbmd = conn.getMetaData();
+ String escapedTableName = StringUtil.escapeLike("TEST_INDEX");
+ String[] tableType = new String[] {PTableType.INDEX.toString()};
+ long startTime = System.currentTimeMillis();
+ boolean isIndexActive = false;
+ do {
+ ResultSet rs = dbmd.getTables("", "", escapedTableName, tableType);
+ assertTrue(rs.next());
+ if (PIndexState.valueOf(rs.getString("INDEX_STATE")) == PIndexState.ACTIVE) {
+ isIndexActive = true;
+ break;
+ }
+ Thread.sleep(3000);
+ } while (System.currentTimeMillis() - startTime < MAX_WAIT_FOR_INDEX_BUILD_TIME_MS);
+
+ assertTrue(isIndexActive);
// upsert two more rows
conn.createStatement().execute(
@@ -97,8 +92,8 @@ public class AsyncImmutableIndexIT extends BaseOwnClusterHBaseManagedTimeIT {
String query = "SELECT pk3 from TEST_TABLE ORDER BY pk3";
ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + query);
String expectedPlan =
- "CLIENT 1-CHUNK PARALLEL 1-WAY FULL SCAN OVER TEST_INDEX\n"
- + " SERVER FILTER BY FIRST KEY ONLY";
+ "CLIENT PARALLEL 1-WAY FULL SCAN OVER TEST_INDEX\n" +
+ " SERVER FILTER BY FIRST KEY ONLY";
assertEquals("Wrong plan ", expectedPlan, QueryUtil.getExplainPlan(rs));
rs = conn.createStatement().executeQuery(query);
assertTrue(rs.next());