Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 52877D7D2 for ; Tue, 26 Jun 2012 22:02:37 +0000 (UTC) Received: (qmail 35197 invoked by uid 500); 26 Jun 2012 22:02:37 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 35166 invoked by uid 500); 26 Jun 2012 22:02:37 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 35159 invoked by uid 99); 26 Jun 2012 22:02:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2012 22:02:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2012 22:02:35 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id CDC172388AA6 for ; Tue, 26 Jun 2012 22:02:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1354256 - /hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java Date: Tue, 26 Jun 2012 22:02:15 -0000 To: commits@hbase.apache.org From: apurtell@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120626220215.CDC172388AA6@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: apurtell Date: Tue Jun 26 22:02:14 2012 New Revision: 1354256 URL: http://svn.apache.org/viewvc?rev=1354256&view=rev Log: HBASE-6276. TestClassLoading is racy Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java?rev=1354256&r1=1354255&r2=1354256&view=diff ============================================================================== --- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java (original) +++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java Tue Jun 26 22:02:14 2012 @@ -33,7 +33,6 @@ import org.apache.hadoop.fs.Path; import javax.tools.*; import java.io.*; import java.util.*; -import java.util.Arrays; import java.util.jar.*; import org.junit.*; @@ -51,7 +50,6 @@ public class TestClassLoading { private static final Log LOG = LogFactory.getLog(TestClassLoading.class); private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); - private static Configuration conf; private static MiniDFSCluster cluster; static final int BUFFER_SIZE = 4096; @@ -82,7 +80,7 @@ public class TestClassLoading { @BeforeClass public static void setUpBeforeClass() throws Exception { - conf = TEST_UTIL.getConfiguration(); + Configuration conf = TEST_UTIL.getConfiguration(); // regionCoprocessor1 will be loaded on all regionservers, since it is // loaded for any tables (user or meta). @@ -229,12 +227,13 @@ public class TestClassLoading { // with configuration values htd.setValue("COPROCESSOR$2", jarFileOnHDFS2.toString() + "|" + cpName2 + "|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3"); - HBaseAdmin admin = new HBaseAdmin(this.conf); + HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); if (admin.tableExists(tableName)) { admin.disableTable(tableName); admin.deleteTable(tableName); } admin.createTable(htd); + TEST_UTIL.waitTableAvailable(htd.getName(), 5000); // verify that the coprocessors were loaded boolean found1 = false, found2 = false, found2_k1 = false, @@ -275,8 +274,9 @@ public class TestClassLoading { htd.addFamily(new HColumnDescriptor("test")); htd.setValue("COPROCESSOR$1", jarFile.toString() + "|" + cpName3 + "|" + Coprocessor.PRIORITY_USER); - HBaseAdmin admin = new HBaseAdmin(this.conf); + HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); admin.createTable(htd); + TEST_UTIL.waitTableAvailable(htd.getName(), 5000); // verify that the coprocessor was loaded boolean found = false; @@ -331,12 +331,13 @@ public class TestClassLoading { htd.addCoprocessor(cpName5, new Path(jarFile5.getPath()), Coprocessor.PRIORITY_USER, kvs); - HBaseAdmin admin = new HBaseAdmin(this.conf); + HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); if (admin.tableExists(tableName)) { admin.disableTable(tableName); admin.deleteTable(tableName); } admin.createTable(htd); + TEST_UTIL.waitTableAvailable(htd.getName(), 5000); // verify that the coprocessor was loaded boolean found_2 = false, found_1 = false, found_3 = false, @@ -433,12 +434,13 @@ public class TestClassLoading { // with configuration values htd.setValue("COPROCESSOR$2", jarFileOnHDFS.toString() + "|" + cpName2 + "|" + Coprocessor.PRIORITY_USER + "|k1=v1,k2=v2,k3=v3"); - HBaseAdmin admin = new HBaseAdmin(this.conf); + HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); if (admin.tableExists(tableName)) { admin.disableTable(tableName); admin.deleteTable(tableName); } admin.createTable(htd); + TEST_UTIL.waitTableAvailable(htd.getName(), 5000); // verify that the coprocessors were loaded boolean found1 = false, found2 = false, found2_k1 = false, @@ -480,7 +482,7 @@ public class TestClassLoading { // name "ColumnAggregationEndpoint" will appear before regionCoprocessor2's // name "GenericEndpoint" because "C" is before "G" lexicographically. - HBaseAdmin admin = new HBaseAdmin(this.conf); + HBaseAdmin admin = TEST_UTIL.getHBaseAdmin(); // disable all user tables, if any are loaded. for (HTableDescriptor htd: admin.listTables()) { @@ -510,6 +512,8 @@ public class TestClassLoading { String userTable1 = "userTable1"; HTableDescriptor userTD1 = new HTableDescriptor(userTable1); admin.createTable(userTD1); + TEST_UTIL.waitTableAvailable(userTD1.getName(), 5000); + // table should be enabled now. assertTrue(admin.isTableEnabled(userTable1)); assertAllRegionServers(regionServerSystemAndUserCoprocessors, userTable1); @@ -528,6 +532,7 @@ public class TestClassLoading { htd2.setValue("COPROCESSOR$1", jarFile1.toString() + "|" + userTableCP + "|" + Coprocessor.PRIORITY_USER); admin.createTable(htd2); + TEST_UTIL.waitTableAvailable(htd2.getName(), 5000); // table should be enabled now. assertTrue(admin.isTableEnabled(userTable2));