Repository: phoenix
Updated Branches:
  refs/heads/master f3ea39279 -> 19eab955a


PHOENIX-2575 Prevent LocalIndexIT from hanging indefinitely


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cb019906
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cb019906
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cb019906

Branch: refs/heads/master
Commit: cb019906de005a842deb5783e914c8d6868786be
Parents: f3ea392
Author: Samarth <[email protected]>
Authored: Wed Jan 6 19:03:28 2016 -0800
Committer: Samarth <[email protected]>
Committed: Wed Jan 6 19:03:28 2016 -0800

----------------------------------------------------------------------
 .../java/org/apache/phoenix/end2end/index/LocalIndexIT.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/cb019906/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
index ee523de..8190f64 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
@@ -34,6 +34,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
@@ -82,6 +83,7 @@ public class LocalIndexIT extends BaseHBaseManagedTimeIT {
 
     private static CountDownLatch latch1 = new CountDownLatch(1);
     private static CountDownLatch latch2 = new CountDownLatch(1);
+    private static final int WAIT_TIME_SECONDS = 60;
 
     @BeforeClass 
     @Shadower(classBeingShadowed = BaseHBaseManagedTimeIT.class)
@@ -967,7 +969,8 @@ public class LocalIndexIT extends BaseHBaseManagedTimeIT {
             }
 
             assertEquals(5, regionsOfIndexTable.size());
-            latch1.await();
+            boolean success = latch1.await(WAIT_TIME_SECONDS, 
TimeUnit.SECONDS);
+            assertTrue("Timed out waiting for 
MockedLocalIndexSplitter.preSplitAfterPONR to complete", success);
             // Verify the metadata for index is correct.
             rs = conn1.getMetaData().getTables(null, 
StringUtil.escapeLike(TestUtil.DEFAULT_SCHEMA_NAME), 
TestUtil.DEFAULT_INDEX_TABLE_NAME,
                     new String[] { PTableType.INDEX.toString() });
@@ -999,7 +1002,8 @@ public class LocalIndexIT extends BaseHBaseManagedTimeIT {
         public void postCompact(ObserverContext<RegionCoprocessorEnvironment> 
e, Store store,
                 StoreFile resultFile) throws IOException {
             try {
-                latch2.await();
+                boolean success = latch2.await(WAIT_TIME_SECONDS, 
TimeUnit.SECONDS);
+                assertTrue("Timed out waiting for test to complete", success);
             } catch (InterruptedException e1) {
             }
             super.postCompact(e, store, resultFile);

Reply via email to